示例#1
0
        public List <FlightRequest> CreateFlightRequest(String filePath)
        {
            flightList    = new List <Flight>();
            flightFactory = new FlightFactory();
            flightList    = flightFactory.Deserialize(filePath);

            flightRequestList = new List <FlightRequest>();
            Random random = new Random();

            int counter = 0;

            while (counter < 20)
            {
                int    ranIndex = random.Next(0, flightList.Count);
                Flight fl       = flightList[ranIndex];

                FlightRequest flightRequest = new FlightRequest(fl.DateAndTime, fl.OrigAirport, fl.DestAirport);

                if (!flightRequestList.Any(fr => (fr.DateAndTime.Date == flightRequest.DateAndTime.Date) && (fr.OrigAirport == flightRequest.OrigAirport) && (fr.DestAirport == flightRequest.DestAirport)))
                {
                    ;
                }
                {
                    flightRequestList.Add(flightRequest);
                    counter += 1;
                }
            }

            return(flightRequestList);
        }
示例#2
0
 public List <Flight> GetList(String filepath)
 {
     FlightFactory = new FlightFactory();
     flightList    = FlightFactory.Deserialize(filepath);
     return(flightList);
 }