Пример #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 LoadDetails()
        {
            cmbClass.DataSource    = clsOffense.GetDSLClass();
            cmbClass.ValueMember   = "pvalue";
            cmbClass.DisplayMember = "ptext";

            using (clsOffense objOffense = new clsOffense())
            {
                objOffense.OffenseCode = _strOffenseCode;
                objOffense.Fill();
                txtOffenseCode.Text    = _strOffenseCode;
                chkEnabled.Checked     = objOffense.Enabled == "1";
                txtEmployeeName.Text   = Employee.GetName(objOffense.Username);
                dtpDateStart.Value     = objOffense.DateStart;
                dtpDateEnd.Value       = objOffense.DateEnd;
                txtDetails.Text        = objOffense.Details;
                cmbClass.SelectedValue = objOffense.ClassCode;
                txtCreatedBy.Text      = objOffense.CreateBy;
                txtDateCreated.Text    = objOffense.CreateOn.ToString("MMM dd, yyyy");
                txtModifiedBy.Text     = objOffense.ModifyBy;
                txtDateModified.Text   = objOffense.ModifyOn.ToString("MMM dd, yyyy");
            }
        }