Пример #1
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsCorrectData())
     {
         using (clsOffense objOffense = new clsOffense())
         {
             objOffense.OffenseCode = _strOffenseCode;
             objOffense.Fill();
             objOffense.Details   = txtDetails.Text;
             objOffense.ClassCode = cmbClass.SelectedValue.ToString();
             objOffense.DateStart = dtpDateStart.Value;
             objOffense.DateEnd   = dtpDateEnd.Value;
             objOffense.Enabled   = (chkEnabled.Checked ? "1" : "0");
             objOffense.ModifyBy  = HRMSCore.Username;
             objOffense.Update();
             if (_frmCaller == _mdiIpanema)
             {
                 _mdiIpanema.LoadDSGOffenseNotification();
                 _frmOffenseList.BindOffenseList();
             }
             else
             {
                 _frmOffenseList.BindOffenseList();
             }
             this.Close();
         }
     }
     else
     {
         MessageBox.Show(clsMessageBox.MessageBoxErrorAdd, clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Пример #2
0
 private void btnSave_Click(object sender, EventArgs e)
 {
     if (IsCorrectData())
     {
         using (clsOffense objOffense = new clsOffense())
         {
             objOffense.Username  = cmbEmployeeName.SelectedValue.ToString();
             objOffense.Details   = txtDetails.Text;
             objOffense.ClassCode = cmbClass.SelectedValue.ToString();
             objOffense.DateStart = dtpDateStart.Value;
             objOffense.DateEnd   = dtpDateEnd.Value;
             objOffense.Enabled   = "1";
             objOffense.CreateBy  = HRMSCore.Username;
             objOffense.ModifyBy  = HRMSCore.Username;
             if (objOffense.Insert() > 0)
             {
                 _frmOffenseList.BindOffenseList();
                 if (MessageBox.Show(clsMessageBox.MessageBoxSuccessAddAskNew, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Information) == DialogResult.Yes)
                 {
                     InitializeFields();
                 }
                 else
                 {
                     this.Close();
                 }
             }
             else
             {
                 MessageBox.Show(clsMessageBox.MessageBoxErrorAdd, clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
     }
 }