コード例 #1
0
        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);
            }
        }
コード例 #2
0
        public static AdminEmployeeTable GetInstance()
        {
            if (State == null)
            {
                State = new AdminEmployeeTable();
            }

            State.SetContext();
            return(State);
        }
コード例 #3
0
 private void EmployeesViewer_Click(object sender, RoutedEventArgs e)
 {
     EmployeeWorkArea.Content = AdminEmployeeTable.GetInstance();
 }
コード例 #4
0
 public AdminEmployees(Employee empl)
 {
     employee = empl;
     InitializeComponent();
     EmployeeWorkArea.Content = AdminEmployeeTable.GetInstance();
 }