private void btnModifyCustomer_Click(object sender, RoutedEventArgs e) { try { if (txtCustomerName.Text == String.Empty || txtCustomerAddress.Text == String.Empty) { throw new ArgumentException("You need to fill both customer name and address!", "Customer"); } customer.Address = txtCustomerAddress.Text; customer.Name = txtCustomerName.Text; win.updateCustomer(customer); win.dataGridCustomer.SelectedItem = null; win.disableButtons(); win.dataGridBooking.Items.Refresh(); win.Show(); this.Close(); } catch (Exception ee) { MessageBox.Show(ee.Message); } }
private void btnBack_Click(object sender, RoutedEventArgs e) { if (win != null) { win.Show(); } else { MainWindow win = new MainWindow(); win.Show(); this.Close(); } }
private void btnExistingCustomer_Click(object sender, RoutedEventArgs e) { ExistingCustomer win = new ExistingCustomer(); win.Show(); this.Close(); }
private void btnSaveCustomerAndBooking_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("Are you sure of the details?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { return; } else { try { if (facade.Guests.Count < 1 && lstBoxViewGuests.Items.Count < 1) { throw new ArgumentException("There are no guests! Add guests!"); } if (checkBoxCar.IsChecked != true && car != null) { car = null; } int breakfast = checkBreakfast(); int eveningMeal = checkEveningMeal(); if (addBooking == true) { facade.SaveCustomerAndBooking(customer, facade.Guests, booking, car, breakfast, eveningMeal, addBooking); MessageBox.Show("Succesfully Saved!", "Confirmation"); facade.Guests.Clear(); ExistingCustomer win = new ExistingCustomer(); win.Show(); this.Close(); } else { facade.SaveCustomerAndBooking(customer, facade.Guests, booking, car, breakfast, eveningMeal, false); MessageBox.Show("Succesfully Saved!", "Confirmation"); facade.Guests.Clear(); MainWindow win = new MainWindow(); win.Show(); this.Close(); } } catch (Exception ee) { MessageBox.Show(ee.Message, "Save"); } } }
private void btnUpdateBooking_Click(object sender, RoutedEventArgs e) { if (MessageBox.Show("Are you sure of the details?", "Confirmation", MessageBoxButton.YesNo, MessageBoxImage.Warning) == MessageBoxResult.No) { return; } else { Guest g = new Guest(); try { if (facade.Guests.Count < 1 || lstBoxViewGuests.Items.IsEmpty) { throw new ArgumentException("There are no guests! Add guests!"); } int breakfast = checkBreakfast(); int eveningMeal = checkEveningMeal(); facade.UpdateBooking(customer, facade.Guests, booking, car, breakfast, eveningMeal, checkBoxCar.IsChecked.Value); facade.Guests.Clear(); MessageBox.Show("Succesfully Saved!", "Confirmation"); win.dataGridBooking.SelectedItem = null; win.dataGridCustomer.SelectedItem = null; win.disableButtons(); win.dataGridBooking.ItemsSource = null; win.dataGridBooking.Items.Refresh(); win.Show(); this.Close(); } catch (Exception ee) { MessageBox.Show(ee.Message, "Update"); } } }
private void btnGoBack_Click(object sender, RoutedEventArgs e) { if (win != null) { win.Show(); this.Close(); } else if (existingCustomer != null) { existingCustomer.Show(); this.Close(); } }