Int32 DisplayBooking(string BookingNameFilter)
    {
        //var to store the BookingName
        string BookingName;
        //create an instance of the Orderline collection class
        clsBookingCollection Booking = new clsBookingCollection();

        Booking.ReportByBookingName(BookingNameFilter);
        //var to store the count of records
        Int32 RecordCount;
        //var to store the index for the loop
        Int32 Index = 0;

        //get the count of records
        RecordCount = Booking.Count;
        //clear the list box
        lstBooking.Items.Clear();
        //while there are records
        while (Index < RecordCount)
        {
            //get the BookingName
            BookingName = Booking.BookingList[Index].BookingName;
            //create a new entry for the list box
            ListItem NewEntry = new ListItem(BookingName + " ".ToString());
            //add the staff to the list
            lstBooking.Items.Add(NewEntry);
            //move the index to the next record
            Index++;
        }
        //return to the count of records found
        return(RecordCount);
    }
Exemple #2
0
        public void ReportByBookingNameTestDataFound()
        {
            //create an instance of the filtered data
            clsBookingCollection FilteredBooking = new clsBookingCollection();
            //var to store outcome
            Boolean OK = true;

            //apply a name that does not exist
            FilteredBooking.ReportByBookingName("Gabriela");
            //check that the correct number of records are found
            if (FilteredBooking.Count == 2)
            {
                //Check that the first record is ID 23
                if (FilteredBooking.BookingList[0].BookingID != 23)
                {
                    OK = false;
                }
                //Check that the first record is ID 24
                if (FilteredBooking.BookingList[1].BookingID != 24)
                {
                    OK = false;
                }
            }
            else
            {
                OK = false;
            }
            //test to see that there are no record
            Assert.IsTrue(OK);
        }
Exemple #3
0
        public void ReportByBookingNameNoneFound()
        {
            //create an instance of the class containing unfiltered results
            clsBookingCollection FilteredBooking = new clsBookingCollection();

            //apply a booking that does not exist
            FilteredBooking.ReportByBookingName("XXXXX");
            //test to see that there are no records
            Assert.AreEqual(0, FilteredBooking.Count);
        }
Exemple #4
0
        public void ReportByBookingName()
        {
            //create an instance of the class containing unfiltered results
            clsBookingCollection AllBooking = new clsBookingCollection();
            //create an instance of the filtered data
            clsBookingCollection FilteredBooking = new clsBookingCollection();

            //apply a blank string (should return all records)
            FilteredBooking.ReportByBookingName("");
            //test to see that the two values are the same
            Assert.AreEqual(AllBooking.Count, FilteredBooking.Count);
        }