private void btnExistingCustomer_Click(object sender, RoutedEventArgs e)
        {
            ExistingCustomer win = new ExistingCustomer();

            win.Show();
            this.Close();
        }
Example #2
0
        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");
                }
            }
        }
Example #3
0
 public CustomerWindow(Customer c, ExistingCustomer win)
 {
     InitializeComponent();
     this.customer             = c;
     this.win                  = win;
     txtCustomerName.Text      = customer.Name;
     txtCustomerAddress.Text   = customer.Address;
     btnAddCustomer.Visibility = Visibility.Hidden;
     btnBack.Visibility        = Visibility.Hidden;
 }
        public InvoiceWindow(ExistingCustomer win, CarHire car, int guests)
        {
            this.existingCustomer = win;
            InitializeComponent();


            int breakfast      = 0;
            int carHire        = 0;
            int eveningMeal    = 0;
            int numberOfGuests = guests;
            int totalDays      = (this.existingCustomer.getBooking().DepartureDate - this.existingCustomer.getBooking().ArrivalDate).Days;

            int chaletPrice = (60 + numberOfGuests * 25) * totalDays;

            lblCustomerName.Content   = this.existingCustomer.getCustomer().Name;
            lblNumberOfDays.Content   = totalDays;
            lblNumberOfGuests.Content = numberOfGuests + " Guests";


            if (car != null)
            {
                int carHireRentalDays = (car.EndDate - car.StartDate).Days;
                carHire            = carHireRentalDays * 50;
                lblCarHire.Content = carHire + " $";
            }
            else if (car == null)
            {
                lblCarHire.Content = "Not Included";
            }
            if (existingCustomer.getBooking().Breakfast == true)
            {
                breakfast            = (numberOfGuests * 5) * totalDays;
                lblBreakfast.Content = breakfast + " $";
            }
            else if (this.existingCustomer.getBooking().Breakfast == false)
            {
                lblBreakfast.Content = "Not Included";
            }

            if (this.existingCustomer.getBooking().EveningMeal == true)
            {
                eveningMeal            = (numberOfGuests * 10) * (totalDays - 1);
                lblEveningMeal.Content = eveningMeal + " $";
            }
            else if (this.existingCustomer.getBooking().EveningMeal == false)
            {
                lblEveningMeal.Content = "Not Included";
            }



            int totalPrice = chaletPrice + breakfast + eveningMeal + carHire;

            lblTotal.Content = totalPrice + " $";
        }
Example #5
0
        public BookingDetails(Booking booking, List <Guest> guests, Customer customer, ExistingCustomer win, CarHire car)
        {
            InitializeComponent();

            this.booking  = booking;
            this.customer = customer;
            this.win      = win;

            this.lblDIsplayCustomerName.Content    = customer.Name;
            this.lblDIsplayCustomerAddress.Content = customer.Address;


            this.lblArrivalDate.Content   = booking.ArrivalDate.Date;
            this.lblDepartureDate.Content = booking.DepartureDate.Date;

            this.checkBoxBreakfast.IsChecked = booking.Breakfast;
            this.checkBoxEvening.IsChecked   = booking.EveningMeal;

            this.disableButtons();

            if (car != null)
            {
                this.car = car;
                this.checkBoxCar.IsChecked = true;
                this.btnAddCar.IsEnabled   = true;
            }

            this.btnUpdateBooking.Visibility          = Visibility.Visible;
            this.btnSaveCustomerAndBooking.Visibility = Visibility.Hidden;


            facade.Guests.Clear();


            foreach (Guest x in guests)
            {
                if (lstBoxViewGuests.Items.Contains(x.PassportNo) == false)
                {
                    this.facade.Guests.Add(x);
                    lstBoxViewGuests.Items.Add(x.PassportNo);
                    countGuest++;
                }
            }
        }
        public NewBooking(Booking b, ExistingCustomer win)
        {
            this.booking = b;

            this.win = win;

            InitializeComponent();

            this.facade = win.accessFacade();

            this.calendarBookingDate.BlackoutDates.AddDatesInPast();

            this.btnNext.IsEnabled = false;

            this.btnNext.Visibility = Visibility.Hidden;

            this.btnBack.Visibility = Visibility.Hidden;

            this.btnUpdateBooking.IsEnabled = false;
        }