public static void GetFlightsEnrouteToAirport(FlightXML2SoapClient client) { Console.WriteLine("What Airport ID would you like to search? Example: KIAD, KSFO, KJFK"); string airportID = Console.ReadLine(); int resultsReturned = 10; //Max number of results returned string aircraftFilter = "airline"; //Limit results to airline traffic only int offest = 0; //Soonest results first EnrouteStruct flightsEnroute = client.Enroute(airportID, resultsReturned, aircraftFilter, offest); foreach (EnrouteFlightStruct e in flightsEnroute.enroute) { DateTime departureTimestamp = UnixTimeStampToDateTime(Double.Parse(e.actualdeparturetime.ToString())); DateTime arrivalTimestamp = UnixTimeStampToDateTime(Double.Parse(e.estimatedarrivaltime.ToString())); Console.WriteLine("Identifier: " + e.ident); Console.WriteLine("Origin: " + e.originCity + " (" + e.origin + ")"); Console.WriteLine("Departure Time: " + departureTimestamp.ToString()); Console.WriteLine("Destination: " + e.destinationCity + " (" + e.destination + ")"); Console.WriteLine("Estimated Arrival Time: " + arrivalTimestamp.ToString()); Console.WriteLine("Press Enter to Continue..."); Console.ReadLine(); } MainMenu(); }
public List <Flight> getFlightFromAirport(string Airportname, int noOfFlights, string filter, int offset) { EnrouteStruct enrouteStruct = flightXML_.Enroute(Airportname, noOfFlights, filter, offset); List <Flight> FlightObjects = new List <Flight>(); if (enrouteStruct.enroute != null) { int num = enrouteStruct.enroute.Length; for (int i = 0; i < num; i++) { EnrouteFlightStruct enrouteflight = enrouteStruct.enroute[i]; List <Flight> flightList = getFlightInformation(enrouteflight.ident); foreach (Flight f in flightList) { FlightObjects.Add(f); } } return(FlightObjects); } return(FlightObjects); }
public void init() { if (TURN_OFF_CERTIFICATE_VALIDATION) { System.Net.ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; } endpoints.Add(new OMFEndpoint { url = "https://example.com", producerToken = "YOUR_PRODUCER_TOKEN_HERE" }); createTypes(endpoints); // set up the source FlightXML2SoapClient client = new FlightXML2SoapClient(); client.ClientCredentials.UserName.UserName = "******"; client.ClientCredentials.UserName.Password = "******"; AirportInfoStruct airport = client.AirportInfo(airportCode); sendAirport(endpoints, airportCode, airport); link(endpoints, new LinkRef { typeid = "airport", index = "_ROOT" }, new LinkRef { typeid = "airport", index = airportCode }); EnrouteStruct r = client.Enroute(airportCode, 15, "", 0); foreach (EnrouteFlightStruct e in r.enroute) { if (isEnroute(e)) { trackedFlights.Add(e.ident, client.InFlightInfo(e.ident)); sendFlight(endpoints, e); link(endpoints, new LinkRef { index = airportCode, typeid = "airport" }, new LinkRef { index = e.ident, typeid = "flight" }); link(endpoints, new LinkRef { index = e.ident, typeid = "flight" }, new LinkRef { containerid = e.ident }); } } while (!Console.KeyAvailable) { foreach (KeyValuePair <string, InFlightAircraftStruct> entry in trackedFlights) { InFlightData flightData = new InFlightData(entry.Value); sendFlightData(endpoints, new Data <InFlightData>(entry.Key, true).Add(flightData)); } Thread.Sleep(600000); } }