Exemple #1
0
        } // end method BtnEmpBenefits_Click()

        /// <summary>
        /// To save the employees data
        /// </summary>
        /// <param name="sender">The object generating the event</param>
        /// <param name="e">The event args</param>
        private void BtnSave_Click(object sender, EventArgs e)
        {
            //If fields are valid
            if (AuditFields())
            {
                //Set flag to inform OnFormClosing that user initiated close
                userCloseFlag = true;

                //Update the current employee
                UpdateCurrEmp();

                //Save current employee changes
                BusinessRules.Instance[uint.Parse(CurrEmp.EmpID)] = CurrEmp;

                //Get reference to admin form
                FrmAdmin form = Application.OpenForms["FrmAdmin"] as FrmAdmin;

                //Clear the employee list in the admin form
                form.ListAllEmp.Items.Clear();

                //Re-populate the employee list in the admin form
                form.PopulateEmployeeList();

                //Refresh the employee list in the admin form
                form.ListAllEmp.Refresh();

                //Close this form
                Close();
            } // end if
        }     // end method BtnSave_Click()
        } // end method MnuExit_Click()

        /// <summary>
        /// To show FrmAdmin form
        /// </summary>
        /// <param name="sender">the object generating the event</param>
        /// <param name="e">the event args</param>
        private void PBxAdmin_Click(object sender, EventArgs e)
        {
            //Create new instance of FrmAdmin
            FrmAdmin form = new FrmAdmin();

            //Show form
            form.ShowDialog(this);
        } // end method PBxAdmin_Click()