Example #1
0
        //gets the number from the last booking made
        //used when the application starts and the data is retrieved from files
        public void UpdateNumbers(string type)
        {
            //needs the data holder class to get the lists
            DataHolderFacadeSingleton inst = DataHolderFacadeSingleton.Instance;

            switch (type)
            {
            //gets the customer number
            case "customer":
            {
                List <Customer> temp = inst.Customers;
                //if the list wasn't empty, get the last customer's number
                if (temp.Count != 0)
                {
                    Customer tempCu = temp.Last();
                    customerNo = tempCu.CustomerNo;
                    //increases the number count, as it's already been used by the last customer
                    customerNo++;
                }
                break;
            }

            //gets the booking number
            case "booking":
            {
                List <Booking> temp = inst.Bookings;
                //if the list wasn't empty, get the last booking's number
                if (temp.Count != 0)
                {
                    Booking tempBk = temp.Last();
                    bookingRef = tempBk.BookingRefference;
                    //increases the count
                    bookingRef++;
                }
                break;
            }
            }
        }