//creates the entries for the stopoverflight private void createEntries(RouteTimeTableEntry mainEntry) { List <Route> routes = mainEntry.TimeTable.Route.Stopovers.SelectMany(s => s.Legs).ToList(); TimeSpan time = mainEntry.Time; Boolean isInbound = mainEntry.DepartureAirport == mainEntry.TimeTable.Route.Destination2; if (isInbound) { routes.Reverse(); } foreach (Route route in routes) { RouteTimeTable timetable = new RouteTimeTable(route); RouteTimeTableEntry entry; //inbound if (isInbound) { entry = new RouteTimeTableEntry(timetable, mainEntry.Day, time, new RouteEntryDestination(route.Destination1, mainEntry.Destination.FlightCode)); time = time.Add(entry.TimeTable.Route.getFlightTime(mainEntry.Airliner.Airliner.Type)).Add(FleetAirlinerHelpers.GetMinTimeBetweenFlights(mainEntry.Airliner)); entry.Airliner = mainEntry.Airliner; entry.MainEntry = mainEntry; } //outbound else { entry = new RouteTimeTableEntry(timetable, mainEntry.Day, time, new RouteEntryDestination(route.Destination2, mainEntry.Destination.FlightCode)); entry.Airliner = mainEntry.Airliner; entry.MainEntry = mainEntry; time = time.Add(entry.TimeTable.Route.getFlightTime(mainEntry.Airliner.Airliner.Type)).Add(FleetAirlinerHelpers.GetMinTimeBetweenFlights(mainEntry.Airliner)); } if (route.Type == Route.RouteType.Passenger || route.Type == Route.RouteType.Mixed) { List <FlightAirlinerClass> classes = new List <FlightAirlinerClass>(); foreach (AirlinerClass aClass in this.Airliner.Airliner.Classes) { FlightAirlinerClass faClass; if (isInbound) { faClass = new FlightAirlinerClass(((PassengerRoute)route).getRouteAirlinerClass(aClass.Type), PassengerHelpers.GetStopoverFlightPassengers(this.Airliner, aClass.Type, route.Destination2, route.Destination1, routes, isInbound)); } else { faClass = new FlightAirlinerClass(((PassengerRoute)route).getRouteAirlinerClass(aClass.Type), PassengerHelpers.GetStopoverFlightPassengers(this.Airliner, aClass.Type, route.Destination1, route.Destination2, routes, isInbound)); } classes.Add(faClass); } this.AllClasses.Add(entry, classes); } if (route.Type == Route.RouteType.Cargo || route.Type == Route.RouteType.Mixed) { if (isInbound) { this.AllCargo.Add(entry, PassengerHelpers.GetStopoverFlightCargo(this.Airliner, route.Destination2, route.Destination1, routes, isInbound)); } else { this.AllCargo.Add(entry, PassengerHelpers.GetStopoverFlightCargo(this.Airliner, route.Destination1, route.Destination2, routes, isInbound)); } } } }
//creates the entries for the stopoverflight private void createEntries(RouteTimeTableEntry mainEntry) { List<Route> routes = mainEntry.TimeTable.Route.Stopovers.SelectMany(s => s.Legs).ToList(); TimeSpan time = mainEntry.Time; Boolean isInbound = mainEntry.DepartureAirport == mainEntry.TimeTable.Route.Destination2; if (isInbound) routes.Reverse(); foreach (Route route in routes) { RouteTimeTable timetable = new RouteTimeTable(route); RouteTimeTableEntry entry; //inbound if (isInbound) { entry = new RouteTimeTableEntry(timetable, mainEntry.Day, time, new RouteEntryDestination(route.Destination1, mainEntry.Destination.FlightCode)); time = time.Add(entry.TimeTable.Route.getFlightTime(mainEntry.Airliner.Airliner.Type)).Add(FleetAirlinerHelpers.GetMinTimeBetweenFlights(mainEntry.Airliner)); entry.Airliner = mainEntry.Airliner; entry.MainEntry = mainEntry; } //outbound else { entry = new RouteTimeTableEntry(timetable, mainEntry.Day, time, new RouteEntryDestination(route.Destination2, mainEntry.Destination.FlightCode)); entry.Airliner = mainEntry.Airliner; entry.MainEntry = mainEntry; time = time.Add(entry.TimeTable.Route.getFlightTime(mainEntry.Airliner.Airliner.Type)).Add(FleetAirlinerHelpers.GetMinTimeBetweenFlights(mainEntry.Airliner)); } if (route.Type == Route.RouteType.Passenger || route.Type == Route.RouteType.Mixed) { List<FlightAirlinerClass> classes = new List<FlightAirlinerClass>(); foreach (AirlinerClass aClass in this.Airliner.Airliner.Classes) { FlightAirlinerClass faClass; if (isInbound) faClass = new FlightAirlinerClass(((PassengerRoute)route).getRouteAirlinerClass(aClass.Type), PassengerHelpers.GetStopoverFlightPassengers(this.Airliner, aClass.Type, route.Destination2, route.Destination1, routes, isInbound)); else faClass = new FlightAirlinerClass(((PassengerRoute)route).getRouteAirlinerClass(aClass.Type), PassengerHelpers.GetStopoverFlightPassengers(this.Airliner, aClass.Type, route.Destination1, route.Destination2, routes, isInbound)); classes.Add(faClass); } this.AllClasses.Add(entry, classes); } if (route.Type == Route.RouteType.Cargo || route.Type == Route.RouteType.Mixed) { if (isInbound) this.AllCargo.Add(entry, PassengerHelpers.GetStopoverFlightCargo(this.Airliner, route.Destination2, route.Destination1, routes, isInbound)); else this.AllCargo.Add(entry, PassengerHelpers.GetStopoverFlightCargo(this.Airliner, route.Destination1, route.Destination2, routes,isInbound)); } } }