예제 #1
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();
                }
            }
        }
 private void detailsButton_Click(object sender, RoutedEventArgs e)  //Calls the appropriate class to load DetailsWindow
 {
     try
     {
         String[]      selectedLine = BookingBox.SelectedItem.ToString().Split(' ');
         int           selectedInt  = Int32.Parse(selectedLine[0]);
         DetailsWindow DW           = new DetailsWindow(currentCustomerID, selectedInt);
         DW.Show();
         DW.PageRefresh();
         this.Close();
     }
     catch
     {
         MessageBox.Show("Click on an item in the above list to select it!");
     }
 }
예제 #3
0
        private void cancelButton_Click(object sender, RoutedEventArgs e)   //Cancel operation if a set of car hire details exists then open the appropriate window
        {
            List <HireCar> currentHire = MainWindow.AllCustomers.getHire(currentCustomerID, currentBookingRef);

            if (currentHire.Count == 0)
            {
                MessageBox.Show("Cannot cancel until hire completed! To delete a hire go to Manage Booking Details > Edit Extras then deselect 'Hire a Car'");
            }
            else
            {
                DetailsWindow DW = new DetailsWindow(currentCustomerID, currentBookingRef);
                DW.Show();
                DW.PageRefresh();
                this.Close();
            }
        }
        private void addButton_Click(object sender, RoutedEventArgs e)  //Controls to take in and validate the fields to change selected extras upon button press
        {
            Booking currentBooking = MainWindow.AllCustomers.findBooking(currentCustomerID, currentBookingRef);

            if (breakfastBox.IsChecked == true)
            {
                currentBooking.BreakfastExtra = true;
            }
            else
            {
                currentBooking.BreakfastExtra = false;
            }

            if (dinnerBox.IsChecked == true)
            {
                currentBooking.EveningMealExtra = true;
            }
            else
            {
                currentBooking.EveningMealExtra = false;
            }

            if (carHireBox.IsChecked == true && currentBooking.Hires.Count == 0)
            {
                addCarHire ACH = new addCarHire("N", currentCustomerID, currentBookingRef);
                ACH.Show();
                this.Close();
            }
            else if (carHireBox.IsChecked == true && currentBooking.Hires.Count != 0)
            {
                addCarHire ACH = new addCarHire("A", currentCustomerID, currentBookingRef);
                ACH.Show();
                ACH.loadData();
                this.Close();
            }
            else if (carHireBox.IsChecked == false && currentBooking.Hires.Count != 0)
            {
                currentBooking.Hires.Clear();
            }
            else
            {
                DetailsWindow DW = new DetailsWindow(currentCustomerID, currentBookingRef);
                DW.Show();
                DW.PageRefresh();
                this.Close();
            }
        }
예제 #5
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!");
            }
        }
예제 #6
0
        private void addButton_Click(object sender, RoutedEventArgs e)  //Controls to take in, validate and add the fields to create or amend a set if car hire details upon button press
        {
            int Errors = 0;

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

            try
            {
                currentHire.HireDate = DateTime.Parse(hireInBox.Text);
                hireError.Content    = "";
            }
            catch
            {
                Errors++;
                hireError.Content = "!";
            }

            try
            {
                currentHire.ReturnDate = DateTime.Parse(returnInBox.Text);
                returnError.Content    = "";
                if (currentHire.HireDate.Date > currentHire.ReturnDate.Date)
                {
                    Errors++;
                    returnError.Content = "!";
                }
            }
            catch
            {
                Errors++;
                returnError.Content = "!";
            }

            if (Errors == 0)
            {
                if (newOrEdit.Equals("N"))
                {
                    MainWindow.AllCustomers.addHire(currentCustomerID, currentBookingRef, currentHire);
                }
                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!");
            }
        }