Beispiel #1
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            int intResult = 0;

            using (clsEmployeeType et = new clsEmployeeType())
            {
                et.Name        = txtType.Text;
                et.Description = txtDetails.Text;
                et.Enabled     = "1";
                et.CreateBy    = HRMSCore.Username;
                et.CreateOn    = DateTime.Now;
                et.ModifyBy    = HRMSCore.Username;
                et.ModifyOn    = DateTime.Now;
                intResult      = et.Insert();
            }
            if (intResult > 0)
            {
                switch (_FormCaller)
                {
                case FormCallers.EmployeeDetails:
                    _frmEmployeeDetails.BindEmployeeType();
                    break;

                case FormCallers.EmployeeTypeList:
                    _frmEmployeeTypeList.BindEmployeeTypeList();
                    break;
                }
            }
            else
            {
                MessageBox.Show("An error occured while adding employee type.\n\nPlease contact your system administrator.", clsMessageBox.MessageBoxText, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            this.Close();
        }
Beispiel #2
0
 private void BindFields()
 {
     txtEmployeeTypeCode.Text = _strEmployeeTypeCode;
     using (clsEmployeeType et = new clsEmployeeType())
     {
         et.EmployeeTypeCode = _strEmployeeTypeCode;
         et.Fill();
         txtType.Text    = et.Name;
         txtDetails.Text = et.Description;
     }
     txtType.Focus();
 }
Beispiel #3
0
        ///////////////////////////////
        ///////// Form Events /////////
        ///////////////////////////////

        private void btnSave_Click(object sender, EventArgs e)
        {
            if (IsCorrectData())
            {
                using (clsEmployeeType et = new clsEmployeeType())
                {
                    et.EmployeeTypeCode = _strEmployeeTypeCode;
                    et.Name             = txtType.Text;
                    et.Description      = txtDetails.Text;
                    et.Update();
                    _frmEmployeeTypeList.BindEmployeeTypeList();
                    this.Close();
                }
            }
        }
Beispiel #4
0
 private void tbtnDelete_Click(object sender, EventArgs e)
 {
     if (dgEmployeeTypeList.SelectedRows.Count > 0)
     {
         if (MessageBox.Show(clsMessageBox.MessageBoxDeleteAsk, clsMessageBox.MessageBoxText, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
         {
             using (clsEmployeeType et = new clsEmployeeType())
             {
                 et.EmployeeTypeCode = dgEmployeeTypeList.SelectedRows[0].Cells[0].Value.ToString();
                 et.Delete();
             }
             BindEmployeeTypeList();
         }
     }
 }