private void EmployeeDelete_Click(object sender, RoutedEventArgs e) { try { if (Id.Text == "") { throw new Exception("Укажите ID сотрудника, которого нужно кикнуть"); } int delete_id = Convert.ToInt32(Id.Text); Employee empl = controller.FindEmployeeById(delete_id); if (empl.role.Equals("Администратор") || empl.role.Equals("Admin")) { throw new Exception("Администратор не может удалять других администраторов"); } controller.DeleteEmployee(delete_id); EmployeeWorkArea.Content = AdminEmployeeTable.GetInstance(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
public static AdminEmployeeTable GetInstance() { if (State == null) { State = new AdminEmployeeTable(); } State.SetContext(); return(State); }
private void EmployeesViewer_Click(object sender, RoutedEventArgs e) { EmployeeWorkArea.Content = AdminEmployeeTable.GetInstance(); }
public AdminEmployees(Employee empl) { employee = empl; InitializeComponent(); EmployeeWorkArea.Content = AdminEmployeeTable.GetInstance(); }