Exemple #1
0
        private void DeleteEmloyeesButton_Click(object sender, RoutedEventArgs e)
        {
            if (!CheckEmployeeSelected())
            {
                return;
            }

            // Delete only the first one of selected employees
            IEmployeePresentationData emp = (IEmployeePresentationData)availableEmployeesListbox.SelectedItem;

            // Make sure user really wants to delete
            if (MessageBox.Show($"Czy na pewno chcesz usunąć pracownika {emp.FirstName} {emp.LastName} z bazy danych i wszystkich grafików?", "Potwierdź usunięcie", MessageBoxButton.YesNo,
                                MessageBoxImage.Warning) != MessageBoxResult.Yes)
            {
                return;
            }

            // Delete employee
            try
            {
                GlobalAccess.DataAccess.DeleteEmployee(emp.Id);
            }
            catch (Exception)
            {
                Helpers.ShowGeneralError();
                return;
            }
            RefreshListOfEmployees();
            Helpers.LoadAndRefreshSchedule(GlobalAccess.Schedule.Id);
        }
 public bool Equals(IEmployeePresentationData other)
 {
     return(other != null &&
            Id == other.Id &&
            FirstName == other.FirstName &&
            LastName == other.LastName);
 }