コード例 #1
0
        public void AddScheduledFlightMethod(DateTime d, int flightnum)
        {
            ScheduledFlight flight1 = new ScheduledFlight(d, flightnum);

            TravelAgency.scheduledflights.Add(flight1);
            //foreach (ScheduledFlight flight in TravelAgency.scheduledflights)
            //{
            //    if (flight.FlightID == flightnum && flight.DepartureDate == d)
            //    {
            //        TravelAgency.scheduledflights.Add(flight1);
            //    }
            //    else
            //    {
            //        TravelAgency.FindFlight(flightnum, d);
            //    }
            //}
        }
コード例 #2
0
        public List <string> ViewPlaneLayout(ScheduledFlight flight)
        {
            try
            {
                List <string> es = new List <string>();

                foreach (Seat seat in seats)
                {
                    if (seat.Available)
                    {
                        es.Add("Seat " + seat.SeatNumber + ": " + seat.SeatType + "- Available");
                    }
                    else
                    {
                        es.Add("Seat " + seat.SeatNumber + " Is Occupied by: " + seat.Pass1.FirstName + " " + seat.Pass1.LastName);
                    }
                }
                return(es);
            }
            catch (FormatException)
            {
                throw new FormatException("not valid");
            }
        }