private void BtnRemove_Click(object sender, EventArgs e)
        {
            MasterForm master = (this.Parent.Parent as MasterForm);

            try
            {
                if (DBEmployee.DeleteEmployee((int)this.nudEmployeeIdInput.Value))
                {
                    master.SetStatus("Employee " + this.txtFirstNameInput.Text + " " + this.txtLastNameInput.Text + " has been deleted.");
                    if (this.nudEmployeeIdInput.Value > this.nudEmployeeIdInput.Minimum)
                    {
                        this.nudEmployeeIdInput.Value--;
                    }
                }
            }
            catch (Exception ex)
            {
                master.SetStatus("Error! Deletion failed: " + ex.Message);
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Deletes an employee from the database based on the id of this employee
 /// </summary>
 /// <returns>If an employee was deleted</returns>
 public bool Delete()
 {
     return(DBEmployee.DeleteEmployee(this.EmployeeID));
 }