Esempio n. 1
0
        public bool addBooking(FlightManager flightMan, CustomerManager customerMan, int flId, int cusId, string date)
        {
            bookingFlight   = flightMan.getFlight(flId);
            bookingCustomer = customerMan.getCustomer(cusId);
            bookingFlight.addPassenger(bookingCustomer);
            if (flightMan.flightExist(flId) == false &&
                customerMan.customerExist(cusId) == false &&
                numBooking >= bookingFlight.getMassSeats())
            {
                return(false);
            }

            Booking b = new Booking(date, flId, cusId);
            string  hashNumb;

            do
            {
                hashNumb = generateCode();
            } while (bookingList.ContainsKey(hashNumb));

            bookingList[hashNumb] = b;
            numBooking++;
            return(true);
        }
 public AirlineCoordinator(int cSeed, int maxCust, int maxFl)
 {
     flightMan   = new FlightManager(maxFl);
     customerMan = new CustomerManager(cSeed, maxCust);
     bookingMan  = new BookingManager();
 }