public AwardCertificationForm()
        {
            InitializeComponent();

            customerResults = new ResultSet(cyclingDAL.GetDataReader("[CustomerTable]"));

            // Set the suggestions of the SuggestingTextBox to the Customer Names and add a Suggestion clicked listener to call SuggestionChosen
            CustomerNameSuggestingTextBox.SetSuggestions(customerResults.GetColumnData(1));
            CustomerNameSuggestingTextBox.SuggestionClickedEvent += new SuggestingTextBox.SuggestionClickedEventArgs(SuggestionChosen);
            CustomerNameSuggestingTextBox.textBox.TextChanged += new EventHandler(CustomerNameSuggestingTextBox_TextChanged);

            // Read and store the displayedResultSet data
            displayedResults = UpdateResultSet("CertificationBookingsTable JOIN ChildTable ON CertificationBookingsTable.ChildID = ChildTable.ChildID JOIN CustomerTable ON ChildTable.CustomerID = CustomerTable.CustomerID ", "1=1", "[CustomerTable].CustomerID, CustomerName, [ChildTable].ChildID, ChildName, CertificationBookingID, Level, Price");

            if (displayedResults.GetSize() > 0)
            {
                ShowRecord(0); // Shows the first record of this ResultSet.
            }
        }
        bool settingSuggestedText = false; // Used to prevent the built in WinForms event call of TextChanged changing the Displayed Results

        #endregion Fields

        #region Constructors

        public CancelBookingForm()
        {
            InitializeComponent();

            bookingResults = UpdateResultSet("[dbo].[BookingTable]"); // Extract data from different tables and save them as ResultSets
            customerResults = UpdateResultSet("[dbo].[CustomerTable]");
            campingResults = UpdateResultSet("[dbo].[CampingBookingsTable]");
            pitchResults = UpdateResultSet("[dbo].[PitchBookingsTable]");

            displayedResultSet = UpdateResultSet("BookingTable JOIN CustomerTable ON BookingTable.CustomerID = CustomerTable.CustomerID", "1=1", "BookingID, BookingTable.CustomerID, CustomerName, StartDate, NightsStayed, PricePerNight, TotalPrice"); // Display all of the booking results as we are not yet filtering them

            CustomerNameSuggestingTextBox.SetSuggestions(customerResults.GetColumnData(1)); // Set the customer names as the suggestions for the SuggestingTextBox
            CustomerNameSuggestingTextBox.SuggestionClickedEvent += new SuggestingTextBox.SuggestionClickedEventArgs(CustomerNameSuggestingTextBox_SuggestionChosen); // When a suggestion is chosen run the CustomerNameSuggestingTextBox_SuggestionChosen method
            CustomerNameSuggestingTextBox.textBox.TextChanged += new EventHandler(CustomerNameSuggestingTextBox_TextChanged);

            if (customerResults.GetSize() > 0)
            {
                ShowRecord(0); // Shows the first record of this ResultSet. Does not depend on a bookingID
            }
        }
        public ReturnEquipmentForm()
        {
            InitializeComponent();

            equipmentLoansResults = UpdateResultSet("[dbo].[EquipmentLoansTable]"); // Read and store the data from the EquipmentLoansTable

            // Read and store the displayedResultSet data
            displayedResultSet = 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");

            originalDisplayedResults = displayedResultSet;

            // Set the suggestions of the SuggestingTextBox to the Customer Names and add a Suggestion clicked listener to call CustomerNameSuggestingTextBox_SuggestionChosen
            CustomerNameSuggestingTextBox.SetSuggestions(displayedResultSet.GetColumnData(4));
            CustomerNameSuggestingTextBox.SuggestionClickedEvent += new SuggestingTextBox.SuggestionClickedEventArgs(CustomerNameSuggestingTextBox_SuggestionChosen);
            CustomerNameSuggestingTextBox.textBox.TextChanged += new EventHandler(CustomerNameSuggestingTextBox_TextChanged);

            if (equipmentLoansResults.GetSize() > 0)
            {
                ShowRecord(0); // Shows the first record of this ResultSet.
            }
        }
        private void SetupBookSightseeingBusForm()
        {
            DateTime currentTime = DateTime.Now;
            DatePicker.MinDate = currentTime; // Set the range in which a customer can book a bus
            DatePicker.MaxDate = currentTime.AddMonths(6);

            DatePicker.Value = currentTime;
            timetableDetails = busDal.GetTimetableDetails(startTime.Date); // Saves the timetableDetails for the specified date

            customerResults = new ResultSet(busDal.GetDataReader("CustomerTable"));

            // Sets the suggestions of the CustomerNameSuggestingTextBox to the customer's names and adds a listener to when a customer name suggestion is chosen
            CustomerSuggestingTextBox.SetSuggestions(customerResults.GetColumnData(1));
            CustomerSuggestingTextBox.SuggestionClickedEvent += new SuggestingTextBox.SuggestionClickedEventArgs(CustomerSuggestionChosen);
        }
        private void SetupBookCyclingCertificationForm()
        {
            // Store data about the customers
            customerResults = new ResultSet(cyclingDAL.GetDataReader("[CustomerTable]"));

            // Set the suggestions of the CustomerNameSuggestingTextBox to the customer names, and add a listener so that when a suggestion is chosen SuggestionChosen is called
            CustomerNameSuggestingTextBox.SetSuggestions(customerResults.GetColumnData(1));
            CustomerNameSuggestingTextBox.SuggestionClickedEvent += new SuggestingTextBox.SuggestionClickedEventArgs(SuggestionChosen);
        }
 // When the CustomerID is changed get the list of corresponding child names for this user
 private void CustomerIDComboBox_SelectedIndexChanged(object sender, EventArgs e)
 {
     string query = "CustomerID = " + CustomerIDComboBox.Text;
     ResultSet childResults = new ResultSet(cyclingDAL.GetDataReader("[ChildTable]", query, "ChildName"));
     ChildNameSuggestingTextBox.SetSuggestions(childResults.GetColumnData(0));
 }
        private void SetupBookCyclingTourForm()
        {
            currentDate = DateTime.Today;
            DatePicker.MinDate = currentDate; // Sets the range in which a customer can make a booking
            DatePicker.MaxDate = currentDate.AddMonths(6);
            DetermineTimeSlots(currentDate.Date); // Determines the available time slots that the user can choose from

            customerResults = new ResultSet(cyclingDAL.GetDataReader("CustomerTable"));

            // Sets the suggestions to the customer names and adds a listener for when a Customer Name suggestion is chosen
            CustomerSuggestingTextBox.SetSuggestions(customerResults.GetColumnData(1));
            CustomerSuggestingTextBox.SuggestionClickedEvent += new SuggestingTextBox.SuggestionClickedEventArgs(CustomerSuggestionChosen);
        }
        private void SetupBookCyclingLessonForm()
        {
            // Add a Listener to update the price when the details of the default ChildLessonInput are changed
            childLessonInput1.DetailsUpdated += new ChildLessonInput.DetailsUpdatedDelegate(UpdatePrice);

            customerResults = new ResultSet(cyclingDAL.GetDataReader("CustomerTable"));

            // Set suggestions to customer names and add a listener for when a suggestion is chosen
            CustomerNameSuggestingTextBox.SetSuggestions(customerResults.GetColumnData(1));
            CustomerNameSuggestingTextBox.SuggestionClickedEvent += new SuggestingTextBox.SuggestionClickedEventArgs(CustomerSuggestionChosen);
        }
        private void SetupHireEquipmentForm()
        {
            hiredItemInput1.DetailsChanged += new HiredItemInput.DetailsChangedDelegate(UpdatePrice); // When the details of the default HiredItemInput are changed Update the price label

            customerResults = new ResultSet(dal.GetDataReader("[dbo].[CustomerTable]"));
            //dal.CloseConnection();

            //Set the suggestion of the SuggestingTextBox to the Customer names and add the event for choosing a customer name suggestion
            CustomerNameSuggetiveTextBox.SetSuggestions(customerResults.GetColumnData(1));
            CustomerNameSuggetiveTextBox.SuggestionClickedEvent += new SuggestingTextBox.SuggestionClickedEventArgs(NameSuggestionChosen);
        }
 // Used to Change the results that are displayed to the contents of a ResultSet
 private void UpdateDisplayedResults(ResultSet rs)
 {
     displayedResultSet = rs;
     CustomerNameSuggestingTextBox.SetSuggestions(rs.GetColumnData(2));
     PreviousBookingButton.Enabled = false;
     if (rs.GetSize() == 1) // If there is only one result don't allow the user to move to the next result
     {
         NextBookingButton.Enabled = false;
     }
     else
     {
         NextBookingButton.Enabled = true;
     }
     ShowRecord(0); // Show the first available record
 }