// When the confirm booking button is clicked
 private void ConfirmBookingButton_Click(object sender, EventArgs e)
 {
     //Add the new booking to the database
     cyclingDAL.AddNewCyclingCertification(ChildNameSuggestingTextBox.textBox.Text, Int32.Parse(CustomerIDComboBox.Text), skillLevel, 20.0f);
     TaskCompletedMessage message = new TaskCompletedMessage(ConfirmBookingButton);
     message.Disposed += new EventHandler(CancelBookingButton_Click);
 }
        // When the Confirm booking button is pressed
        private void ConfirmBookingButton_Click(object sender, EventArgs e)
        {
            if (seatsLeft < (int)GroupSizeNumeric.Value)
            {
                MessageBox.Show("Sorry, there aren't enough seats left");
                return;
            }

            if (TripComboBox.Text == "") // Validate that a trip has been chosen
            {
                MessageBox.Show("Please select a Trip");
                return;
            }
            else if (CustomerSuggestingTextBox.textBox.Text == "") // Validate that a customer name has been chosen
            {
                MessageBox.Show("Please enter a Customer Name");
                return;
            }

            int customerID = Int32.Parse(CustomerIDComboBox.Text);

            // Save the booking into the database
            busDal.AddNewPassenger(TripComboBox.Text, TimeSlotComboBox.Text, DatePicker.Value, (int)GroupSizeNumeric.Value, Int32.Parse(CustomerIDComboBox.Text), RefreshPriceLabel());
            timetableDetails = busDal.GetTimetableDetails(startTime.Date);

            // Update the data now that the booking has been saved
            RefreshBusLabels(TimeSlotComboBox);

            TaskCompletedMessage message = new TaskCompletedMessage(ConfirmBookingButton);
            message.Disposed += new EventHandler(CancelBookingButton_Click);
        }
        // When the confirm button is clicked
        private void ConfirmBookingButton_Click(object sender, EventArgs e)
        {
            if (IndefiniteCheckBox.Checked) // If the number of nights stayed is indefinite then make nightsStayed a negative value
            {
                nightsStayed = -1; // A negative value is recognised by this software as an indefinite number of nights.
            }

            // Create a new CampingBooking object to store the details about the booking
            CampingBooking booking = new CampingBooking( CustomerNameTextBox.Text, StartDateTimePicker.Value, nightsStayed, CalculatePricePerDay(), RefreshPriceLabel(), rating, RentedItemComboBox.Text, (int)GroupSizeNumeric.Value);

            if (booking.customerName.Length <= 0) // Validate that a customer name has been entered
            {
                MessageBox.Show("Please enter a Customer Name");
                return;
            }
            else if(booking.type.Length <= 0) // Validate that a Rented Facility has been entered
            {
                MessageBox.Show("Please enter a Rented Facility");
                return;
            }
            bookingDAL.AddNewCampingBooking(booking); // Save the booking in the database

            TaskCompletedMessage message = new TaskCompletedMessage(ConfirmBookingButton); // Creates a new Tick box indiciating a task has been completed
            message.Disposed += new EventHandler(MessageDisposed);
        }
        // When the confirm booking button is clicked
        private void ConfirmBookingButton_Click(object sender, EventArgs e)
        {
            if (bicyclesLeft < (int)NumBicyclesNumeric.Value)
            {
                MessageBox.Show("Sorry, not enough bicycles");
                return;
            }

            if (CustomerSuggestingTextBox.textBox.Text == "") // Verify that a customer name has been entered
            {
                MessageBox.Show("Please enter a Customer Name");
                return;
            }
            else if (TimeSlotComboBox.Text == "") // Verify that a time slot has been entered
            {
                MessageBox.Show("Please enter a Time Slot");
                return;
            }

            // Save the booking in the database
            cyclingDAL.RentNewBicycles(TimeSlotComboBox.Text, DatePicker.Value, (int)NumBicyclesNumeric.Value, Int32.Parse(CustomerIDComboBox.Text), RefreshPriceLabel(), (int)NumberCyclistsNumeric.Value, (int)NumBicyclesNumeric.Value);

            // Update labels now that a new booking has been made
            SignedUpLabel.Text = "Signed up: " + cyclingDAL.GetNumberSignedUp(DatePicker.Value, TimeSlotComboBox.Text);
            bicyclesLeft = cyclingDAL.GetBicyclesLeft(DatePicker.Value, TimeSlotComboBox.Text);
            BicyclesLeftLabel.Text = "Bicycles Left: " + bicyclesLeft;

            TaskCompletedMessage message = new TaskCompletedMessage(ConfirmBookingButton);
            message.Disposed += new EventHandler(CancelBookingButton_Click);
        }
        // When the Mark Loan Returned button is pressed
        private void MarkLoanReturnedButton_Click(object sender, EventArgs e)
        {
            hiredItemDAL.MoveLoanToHistory(equipmentLoanID); // Move the loan to history
            originalDisplayedResults = UpdateResultSet("[dbo].[EquipmentLoansTable] JOIN [dbo].[CustomerTable] ON EquipmentLoansTable.CustomerID = CustomerTable.CustomerID JOIN [dbo].[EquipmentTable] ON EquipmentLoansTable.EquipmentID = EquipmentTable.EquipmentID", "1=1", "EquipmentLoanID, EquipmentLoansTable.EquipmentID, EquipmentName, CustomerTable.CustomerID, CustomerName, StartDate, Duration, Quantity, RentalPrice, StockLevel");
            UpdateDisplayedResults(originalDisplayedResults); // Remove filtering from the displayed results
            CustomerNameSuggestingTextBox.textBox.Text = "";

            TaskCompletedMessage message = new TaskCompletedMessage(MarkLoanReturnedButton);
        }
        // When the confirm booking button is clicked
        private void ConfirmBookingButton_Click(object sender, EventArgs e)
        {
            Control.ControlCollection controls = ChildInputFlowLayoutPanel.Controls;
            for (int i = 0; i < controls.Count; i++) // Verify that each ChildLessonInput has a name
            {
                if ((controls[i] as ChildLessonInput).getChildName() == "")
                {
                    MessageBox.Show("Please give child number " + (i + 1) + " their name");
                    return;
                }
                for (int j = i + 1; j < controls.Count; j++) // Verify that none of the other ChildLessonInputs have a duplicate name
                {
                    if ((controls[i] as ChildLessonInput).getChildName().Equals((controls[j] as ChildLessonInput).getChildName()))
                    {
                        MessageBox.Show("Two children have the same name. Please correct this or provide a way to uniquely identify each child.");
                        return;
                    }
                }
            }

            if (TimeSlotComboBox.Text == "") // Verify that a time slot has been entered
            {
                MessageBox.Show("Please enter a time slot");
                return;
            }
            else if (CustomerNameSuggestingTextBox.textBox.Text == "") // Verify that a Customer Name has been entered
            {
                MessageBox.Show("Please enter a Customer Name");
                return;
            }

            // Add the booking to the database
            cyclingDAL.BookCyclingLesson(controls, Int32.Parse(CustomerIDComboBox.Text), DatePicker.Value, TimeSlotComboBox.Text, (int)NumChildrenNumeric.Value);
            NumberAttendingLabel.Text = "Number Attending: " + (cyclingDAL.GetNumberAttendingLesson(DatePicker.Value, TimeSlotComboBox.Text));

            TaskCompletedMessage message = new TaskCompletedMessage(ConfirmBookingButton);
            message.Disposed += new EventHandler(CancelBookingButton_Click);
        }
        // When the Confirm button is clicked
        private void ConfirmButton_Click(object sender, EventArgs e)
        {
            if (CustomerNameSuggetiveTextBox.textBox.Text == "") // Verify that a customer name has been entered
            {
                MessageBox.Show("Please enter a Customer Name");
                return;
            } else if(CustomerIDComboBox.Text == ""){ // Verify that a Customer ID has been chosen
                MessageBox.Show("Please enter a Customer ID using the Customer Name TextBox");
                return;
            }

            int customerID = Int32.Parse(CustomerIDComboBox.Text.Trim());
            List<HiredItemLoan> itemLoans = new List<HiredItemLoan>(); // List all of the details about the Hired Items

            foreach (Control control in ItemsFlowLayoutPanel.Controls)
            {
                HiredItemInput hiredItemInput = (control as HiredItemInput);
                if (hiredItemInput == null) // If the control found is not a HiredInputItem
                {
                    continue;
                }
                else
                {

                    if (hiredItemInput.getItemType() == "") // If no item name has been entered for this item
                    {
                        return;
                    }

                    // Create a new HiredItemLoan and add it to the list
                    HiredItemLoan loan = new HiredItemLoan();
                    loan.equipmentID = hiredItemInput.getEquipmentID();
                    loan.startDate = hiredItemInput.getStartDate();
                    loan.quantity = hiredItemInput.getQuantity();
                    loan.duration = hiredItemInput.getDuration();
                    loan.customerID = Int32.Parse(CustomerIDComboBox.Text);
                    itemLoans.Add(loan);
                }
            }

            //Store the new hired items in the database
            dal.AddNewItems(itemLoans);

            TaskCompletedMessage message = new TaskCompletedMessage(ConfirmButton);
            message.Disposed += new EventHandler(CancelBookingButton_Click_1);
        }