private void extrasButton_Click(object sender, RoutedEventArgs e)   //Calls the appropriate classes to modify tje extras of a booking
        {
            AddEditExtras AEE = new AddEditExtras(currentCustomerID, currentBookingRef);

            AEE.Show();
            this.Close();
        }
示例#2
0
        private void cancelButton_Click(object sender, RoutedEventArgs e)   //Cancel operation if at least 1 guest exists then open the appropriate window
        {
            List <Guest> currentGuests = MainWindow.AllCustomers.getGuests(currentCustomerID, currentBookingRef);

            if (currentGuests.Count == 0)
            {
                MessageBox.Show("Cannot cancel, at least 1 guest must be added to a booking!");
            }
            else
            {
                if (newBooking == true)
                {
                    AddEditExtras AEE = new AddEditExtras(currentCustomerID, currentBookingRef);
                    AEE.Show();
                    this.Close();
                }
                else
                {
                    DetailsWindow DW = new DetailsWindow(currentCustomerID, currentBookingRef);
                    DW.Show();
                    DW.PageRefresh();
                    this.Close();
                }
            }
        }
示例#3
0
        private void addButton_Click(object sender, RoutedEventArgs e)  //Controls to take in, validate and add the fields to create or amend a guest upon button press
        {
            int Errors = 0;

            try
            {
                currentGuest.GuestName = nameInBox.Text;
                nameError.Content      = "";
                if (currentGuest.GuestName.Equals(""))
                {
                    Errors++;
                    nameError.Content = "!";
                }
            }
            catch
            {
                Errors++;
                nameError.Content = "!";
            }

            try
            {
                currentGuest.PassportNo = passNoInBox.Text;
                passNoError.Content     = "";
                if (currentGuest.PassportNo.Equals("") || currentGuest.PassportNo.Length > 10 || currentGuest.PassportNo.Contains(" "))
                {
                    Errors++;
                    passNoError.Content = "!";
                }
            }
            catch
            {
                Errors++;
                passNoError.Content = "!";
            }

            try
            {
                currentGuest.GuestAge = Int32.Parse(ageInBox.Text);
                ageError.Content      = "";
                if (currentGuest.GuestAge > 101)
                {
                    Errors++;
                    ageError.Content = "!";
                }
            }
            catch
            {
                Errors++;
                ageError.Content = "!";
            }

            if (Errors == 0)
            {
                if (newOrEdit.Equals("N"))
                {
                    MainWindow.AllCustomers.addGuest(currentCustomerID, currentBookingRef, currentGuest);
                    Booking currentBooking = MainWindow.AllCustomers.findBooking(currentCustomerID, currentBookingRef);
                    if (currentBooking.Guests.Count <= 6)
                    {
                        MessageBoxResult makeNewBooking = MessageBox.Show("Would you like to add another Guest? This can also be done from Manage Booking Details > Add New Guest.", "Add another Guest?", MessageBoxButton.YesNo);
                        if (makeNewBooking == MessageBoxResult.Yes)
                        {
                            AddExitGuest AEG = new AddExitGuest("N", true, currentCustomerID, currentBookingRef);
                            AEG.Show();
                            this.Close();
                        }
                        else if (newBooking == true)
                        {
                            AddEditExtras AEE = new AddEditExtras(currentCustomerID, currentBookingRef);
                            AEE.Show();
                            this.Close();
                        }
                        else
                        {
                            DetailsWindow DW = new DetailsWindow(currentCustomerID, currentBookingRef);
                            DW.Show();
                            DW.PageRefresh();
                            this.Close();
                        }
                    }
                    else if (newBooking == true)
                    {
                        AddEditExtras AEE = new AddEditExtras(currentCustomerID, currentBookingRef);
                        AEE.Show();
                        this.Close();
                    }
                    else
                    {
                        DetailsWindow DW = new DetailsWindow(currentCustomerID, currentBookingRef);
                        DW.Show();
                        DW.PageRefresh();
                        this.Close();
                    }
                }
                else
                {
                    DetailsWindow DW = new DetailsWindow(currentCustomerID, currentBookingRef);
                    DW.Show();
                    DW.PageRefresh();
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("There are " + Errors + " invalid entries, they have each been marked with '!'. Please fix these then try again!");
            }
        }