Exemple #1
0
        protected void lnkEmployeeStatusChanger_OnCommand(object sender, CommandEventArgs e)
        {
            string   employeeID = e.CommandArgument.ToString();
            Employee employee   = new Employee();

            employee.EmployeeID     = Convert.ToInt32(employeeID);
            employee.ModifiedDate   = DateTime.Now.ToLocalTime();
            employee.ModifiedBy     = User.Identity.Name.ToString();
            employee.RehiredDate    = DateTime.Now.ToLocalTime();
            employee.TerminatedDate = DateTime.Now.ToLocalTime();

            //check if the action will be activate or deactivate
            if (e.CommandName == "deactivate")
            {
                //deactivate the account
                //Call the AccountManager to deactivate the account
                EmployeeManager.Deactivate(employee);
            }
            else
            {
                //re-activate the account
                EmployeeManager.Activate(employee);
            }

            //re-bind the gridview
            BindGridview();
        }
 private void activateBtn_Click(object sender, EventArgs e)
 {
     EmployeeManager.Activate(GetSelectedEmployee());
     updateEmployeeListViewByActive(this.comboBox1.SelectedItem.ToString());
 }