public void SaveExecute() { if (String.IsNullOrEmpty(Manager.NameAndSurname) || String.IsNullOrEmpty(Manager.DateOfBirth.ToString()) || String.IsNullOrEmpty(Manager.Email) || String.IsNullOrEmpty(Manager.Username) || String.IsNullOrEmpty(Manager.Password) || String.IsNullOrEmpty(Manager.HotelFloor.ToString()) || String.IsNullOrEmpty(Manager.ExperienceWorkingInHotels.ToString()) || String.IsNullOrEmpty(Manager.ProfessionalQualifications) || Manager.DateOfBirth == DateTime.MinValue) { MessageBox.Show("Please fill all fields.", "Notification"); } else { try { MessageBoxResult result = MessageBox.Show("Are you sure you want to save the manager?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { bool isCreated = managers.AddManager(Manager); if (isCreated) { MessageBox.Show("Manager is created.", "Notification", MessageBoxButton.OK); managerView.Close(); } else { MessageBox.Show("Manager cannot be created.", "Notification", MessageBoxButton.OK); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } } }
public void SaveExecute() { try { managers.AddManager(manager); IsVisibleAdding = Visibility.Hidden; } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }
public void SaveManagerExecute() { try { MessageBoxResult result = MessageBox.Show("Are you sure you want to save the manager?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Question); if (result == MessageBoxResult.Yes) { bool isCreated = managers.AddManager(manager); if (isCreated == true) { MessageBox.Show("Manager is created.", "Notification", MessageBoxButton.OK); IsVisibleAddingManager = Visibility.Hidden; } else { MessageBox.Show("Manager cannot be created.", "Notification", MessageBoxButton.OK); } } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }