Ejemplo n.º 1
0
 public void DelayFlight(Flight <int> flight, int min)
 {
     flight.MinDelayed = min;
 }
Ejemplo n.º 2
0
        public bool IsSeatAvailable(Flight <int> flight, int seat)
        {
            IList <int> avail = SeatsAvailable(flight);

            return(avail.Contains(seat));
        }
Ejemplo n.º 3
0
        public Ticket <int> GetNewTicket(Passenger <int> passenger, int adults, int children, IList <int> seats, Flight <int> flight, IDaoFactory <int> db)
        {
            IFlightService <int> flightService = new FlightService(db);
            int avail;
            int adultAddPrice = 50, childrenAddPrice = 20;

            if (seats.Count != adults || children > adults || DateTime.Today > flight.StopBooking)
            {
                return(null);
            }
            avail = flightService.SeatsAvailableCount(flight);
            foreach (int i in seats)
            {
                if (!flightService.IsSeatAvailable(flight, i))
                {
                    return(null);
                }
            }
            return(new Ticket <int> {
                Flight = flight, SeatsOccupiedList = seats, Adults = adults, Children = children, Passenger = passenger, SeatsOccupied = seats.Count, Price = flight.Route.Airplane.DefaultPrice + (adults - 1) * adultAddPrice + children * childrenAddPrice
            });
        }