Example #1
0
        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");
                }
            }
        }