using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data; using System.Data.SqlClient; using CY.Model; using CY.BLL; using CY.Infrastructure.Common; using CY.Infrastructure.Query; namespace CY.WebForm.Pages.personnel { //吴辉 //新增/修改招聘信息 public partial class OA_StaffRecruitmentsAdd : BasePage { OA_StaffRecruitmentsBLL bll_OA_StaffRecruitmentsBLL = null; OA_StaffPostCategoryBLL bll_OA_StaffPostCategoryBLL = null; OA_StaffPostBLL bll_OA_StaffPostBLL = null; public string Province = ""; //接收值 Request["selectProvince"].ToString2(); public string City = "";//接收值 Request["selectCity"].ToString2(); //初始化 public OA_StaffRecruitmentsAdd() { bll_OA_StaffRecruitmentsBLL = new OA_StaffRecruitmentsBLL(); bll_OA_StaffPostCategoryBLL = new OA_StaffPostCategoryBLL(); bll_OA_StaffPostBLL = new OA_StaffPostBLL(); } //页面加载 protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { InitData(); } } //数据加载 public void InitData() { Pagination pa = new Pagination(); pa.PageSize = 500; pa.PageIndex = 1; this.selP_CateId.DataSource = bll_OA_StaffPostCategoryBLL.SelectModelPage(pa, AdminAccount.MemberId, "", null, null, null, ""); this.selP_CateId.DataTextField = "PC_Name"; this.selP_CateId.DataValueField = "Keyid"; this.selP_CateId.DataBind(); this.selP_CateId.Items.Insert(0, new ListItem("请选择", "")); OA_StaffRecruitments m_OA_StaffRecruitments = bll_OA_StaffRecruitmentsBLL.GetModelByKeyid(Request["keyid"].ToInt32()); if (m_OA_StaffRecruitments != null) { OA_StaffPost m_OA_StaffPost = bll_OA_StaffPostBLL.GetModelByKeyid(m_OA_StaffRecruitments.Postid); this.selP_CateId.SelectedValue = m_OA_StaffPost.P_CateId.ToString2(); Pagination pa1 = new Pagination(); pa1.PageSize = 500; pa1.PageIndex = 1; this.txtPostid.DataSource = bll_OA_StaffPostBLL.SelectModelPage(pa1, AdminAccount.MemberId, "", null, this.selP_CateId.SelectedValue.ToInt32(), null, null, null, ""); this.txtPostid.DataTextField = "P_Name"; this.txtPostid.DataValueField = "Keyid"; this.txtPostid.DataBind(); this.txtPostid.Items.Insert(0, new ListItem("请选择", "")); this.txtPostid.Value = m_OA_StaffRecruitments.Postid.ToString2(); Province = m_OA_StaffRecruitments.R_WorkProvence.ToString2(); City = m_OA_StaffRecruitments.R_WorkCity.ToString2(); this.txtR_EndTime.Value = m_OA_StaffRecruitments.R_EndTime.Value.ToString("yyyy-MM-dd"); this.txtR_Vacancies.Value = m_OA_StaffRecruitments.R_Vacancies.ToString2(); this.txtR_PostDetail.Text = m_OA_StaffRecruitments.R_PostDetail.ToString2(); this.txtR_PostNeed.Text = m_OA_StaffRecruitments.R_PostNeed.ToString2(); this.txtR_Salary.Value = m_OA_StaffRecruitments.R_Salary.ToString2(); } else { this.txtR_EndTime.Value = DateTime.Now.AddDays(7).ToString("yyyy-MM-dd"); } } //表单提交 protected void btn_submit_form(object sender, EventArgs e) { try { DateTime nowTime = DateTime.Now; if (string.IsNullOrEmpty(Request["selectProvince"].ToString2()) || string.IsNullOrEmpty(Request["selectCity"].ToString2())) { JavaScript.MessageBox("请选择工作地点", this); return; } if (string.IsNullOrEmpty(this.txtR_EndTime.Value)) { JavaScript.MessageBox("请选择报名结束时间", this); return; } if (this.txtR_EndTime.Value.ToDateTime2() <= nowTime) { JavaScript.MessageBox("报名结束时间 需 大于当前时间", this); return; } OA_StaffRecruitments m_OA_StaffRecruitments = bll_OA_StaffRecruitmentsBLL.GetModelByKeyid(Request["keyid"].ToInt32()); if (m_OA_StaffRecruitments == null) { m_OA_StaffRecruitments = new OA_StaffRecruitments(); m_OA_StaffRecruitments.R_ResumeAllCount = 0; m_OA_StaffRecruitments.R_ResumeNewCount = 0; m_OA_StaffRecruitments.R_StartTime = DateTime.Now; m_OA_StaffRecruitments.R_Status = 2; } if (m_OA_StaffRecruitments.R_Status == 0 || m_OA_StaffRecruitments.R_Status == 1) { m_OA_StaffRecruitments.R_StartTime = DateTime.Now; m_OA_StaffRecruitments.R_Status = 2; } m_OA_StaffRecruitments.FirmId = CurrentUser.MemberId; m_OA_StaffRecruitments.Postid = this.txtPostid.Value.ToInt32(); m_OA_StaffRecruitments.R_WorkProvence = Request["selectProvince"].ToString2(); m_OA_StaffRecruitments.R_WorkCity = Request["selectCity"].ToString2(); m_OA_StaffRecruitments.R_EndTime = this.txtR_EndTime.Value.ToDateTime2(); m_OA_StaffRecruitments.R_Vacancies = this.txtR_Vacancies.Value.ToInt32(); m_OA_StaffRecruitments.R_PostDetail = this.txtR_PostDetail.Text.ToString2(); m_OA_StaffRecruitments.R_PostNeed = this.txtR_PostNeed.Text.ToString2(); m_OA_StaffRecruitments.R_Salary = this.txtR_Salary.Value.ToString2(); m_OA_StaffRecruitments.LastUpdateTime = DateTime.Now; m_OA_StaffRecruitments.Operator = CurrentUser.ShortName; m_OA_StaffRecruitments.Remark = ""; if (Request["keyid"].ToInt32() > 0) { if (bll_OA_StaffRecruitmentsBLL.UpdateModel(m_OA_StaffRecruitments)) JavaScript.MessageBoxAndFirstRefresh("更新成功", this, true); else JavaScript.MessageBox("更新失败", this); } else { if (bll_OA_StaffRecruitmentsBLL.InsertModel(m_OA_StaffRecruitments)) JavaScript.MessageBoxAndFirstRefresh("新增成功", this, false); else JavaScript.MessageBox("操作失败", this); } } catch (Exception ex) { PAGEHandleException(ex); JavaScript.MessageBox("操作失败", this); } } protected void selP_CateId_SelectedIndexChanged(object sender, EventArgs e) { Pagination pa = new Pagination(); pa.PageSize = 500; pa.PageIndex = 1; this.txtPostid.DataSource = bll_OA_StaffPostBLL.SelectModelPage(pa, AdminAccount.MemberId, "", null, this.selP_CateId.SelectedValue.ToInt32(), null, null, null, ""); this.txtPostid.DataTextField = "P_Name"; this.txtPostid.DataValueField = "Keyid"; this.txtPostid.DataBind(); this.txtPostid.Items.Insert(0, new ListItem("请选择", "")); } } }