public FlightSearchResult PerformSearch(FlightSearch flightSearch, int searchId) { FlightSearchResult flightSearchResult = new FlightSearchResult(); AirServiceSoapClient airServiceSoapClient = new AirServiceSoapClient(); var authenticateResponse = gatewayService.GetToken(); if (!authenticateResponse.Success) { flightSearchResult.Success = false; flightSearchResult.ErrorMessage = "Could not get token"; return(flightSearchResult); } // now lets try a search var JourneyDetails = new JourneyDetail[] { new JourneyDetail { DepartureDateTime = DateTime.Now.Date.AddDays(30).AddHours(9), DeparturePoint = "LON", DeparturePointIsCity = true, DestinationPoint = "DXB", DestinationPointIsCity = false }, new JourneyDetail { DepartureDateTime = DateTime.Now.Date.AddDays(37).AddHours(9), DeparturePoint = "DXB", DeparturePointIsCity = false, DestinationPoint = "LON", DestinationPointIsCity = true } }; var airSearchResult = airServiceSoapClient.Search(new AirService.AuthHeader { Token = authenticateResponse.Token.Value }, new AirSearch { CabinClass = CabinClasses.All, FareType = FareTypes.All, FlexiDays = 0, SelectedAirlines = null, SessionID = "FlightSearch" + searchId, MultipleCabinClasses = new CabinClasses[] { CabinClasses.All }, // change this if we want business etc... AdultPaxCount = 2, ChildPaxCount = 0, ChildAges = null, InfantPaxCount = 0, JourneyDetails = JourneyDetails, SearchType = SearchTypes.Availability, SortOrder = SortOrders.Price, DirectFlightsOnly = false }); // check if we have results // process them into our object // apply markup to the flights flightSearchResult.Success = true; flightSearchResult.ErrorMessage = "There was " + airSearchResult.Results.Result.Length + " results starting at £" + airSearchResult.Results.Result[0].AdultTotal; return(flightSearchResult); }
public FlightSearchResult PerformSearch(FlightSearch flightSearch, int searchId) { FlightSearchResult flightSearchResult = new FlightSearchResult(); AirServiceSoapClient airServiceSoapClient = new AirServiceSoapClient(); var authenticateResponse = gatewayService.GetToken(); if (!authenticateResponse.Success) { flightSearchResult.Success = false; flightSearchResult.ErrorMessage = "Could not get token"; return flightSearchResult; } // now lets try a search var JourneyDetails = new JourneyDetail[] { new JourneyDetail { DepartureDateTime = DateTime.Now.Date.AddDays(30).AddHours(9), DeparturePoint = "LON", DeparturePointIsCity = true, DestinationPoint = "DXB", DestinationPointIsCity = false }, new JourneyDetail { DepartureDateTime = DateTime.Now.Date.AddDays(37).AddHours(9), DeparturePoint = "DXB", DeparturePointIsCity = false, DestinationPoint = "LON", DestinationPointIsCity = true } }; var airSearchResult = airServiceSoapClient.Search(new AirService.AuthHeader { Token = authenticateResponse.Token.Value }, new AirSearch { CabinClass = CabinClasses.All, FareType = FareTypes.All, FlexiDays = 0, SelectedAirlines = null, SessionID = "FlightSearch" + searchId, MultipleCabinClasses = new CabinClasses[] { CabinClasses.All }, // change this if we want business etc... AdultPaxCount = 2, ChildPaxCount = 0, ChildAges = null, InfantPaxCount = 0, JourneyDetails = JourneyDetails, SearchType = SearchTypes.Availability, SortOrder = SortOrders.Price, DirectFlightsOnly = false }); // check if we have results // process them into our object // apply markup to the flights flightSearchResult.Success = true; flightSearchResult.ErrorMessage = "There was " + airSearchResult.Results.Result.Length + " results starting at £" + airSearchResult.Results.Result[0].AdultTotal; return flightSearchResult; }