Exemplo n.º 1
0
 private void btnOK_Click(object sender, System.EventArgs e)
 {
     try
     {
         if (txtJobName.Text.Trim().Length == 0)
         {
             throw new BusinessException("招聘会新设", "请输入招聘会名称!");
         }
         DataTable dtJob = Helper.Query("select * from tbJob where cnvcJobName ='" + txtJobName.Text + "'");
         if (dtJob.Rows.Count > 0)
         {
             throw new BusinessException("招聘会新设", "同名招聘会已存在!");
         }
         Job job = new Job();
         job.cnvcJobName      = txtJobName.Text;
         job.cnvcJobTheme     = this.ultraCombo1.Value.ToString();//this.ultraComboEditor1.Text;//txtJobTheme.Text;
         job.cndBeginDate     = DateTime.Parse(cmbBegin.Text);
         job.cndEndDate       = DateTime.Parse(cmbEnd.Text);
         job.cndBookBeginDate = DateTime.Parse(cmbBookBeginDate.Text);
         job.cndBookEndDate   = DateTime.Parse(cmbBookEndDate.Text);
         job.cnvcOperName     = this.oper.cnvcOperName;
         job.cndOperDate      = DateTime.Now;
         if (job.cndEndDate < job.cndBeginDate)
         {
             throw new BusinessException("招聘会新设", "招聘会开始时间不能大于结束时间!");
         }
         if (job.cndBookEndDate < job.cndBookBeginDate)
         {
             throw new BusinessException("招聘会新设", "招聘会预订开始时间不能大于预订结束时间!");
         }
         if (job.cndEndDate < job.cndBookEndDate)
         {
             throw new BusinessException("招聘会新设", "招聘会预订开始时间不能大于招聘会结束时间!");
         }
         JobManage jobManage = new JobManage();
         jobManage.AddJob(job);
         MessageBox.Show(this, "添加招聘会成功!", "招聘会新设", MessageBoxButtons.OK, MessageBoxIcon.Information);
         txtJobName.Text = "";
         //txtJobTheme.Text = "";
     }
     catch (BusinessException bex)
     {
         MessageBox.Show(this, bex.Message, bex.Type, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
     catch (System.Exception ex)
     {
         MessageBox.Show(this, ex.Message, "系统错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }