public void MainTesting() { var selectedFlight = GetRandomFlight(GetSabreFlight()); var bkFlt = SabreServiceCall.BookFlightEnhancedAirBookResponse(selectedFlight, string.Empty); var tvrDtl = InitializeTestingModel.FlightTestingModel.TvrDtl(psgList, bkFlt.Output.OriginDestinationOptions.FirstOrDefault().FlightSegments.FirstOrDefault().DepartureDateTime); var test = SabreServiceCall.AddPassengerDetailsResponse(bkFlt, tvrDtl); }
private SearchFlightBargainFinderMaxResponse GetSabreFlight() { var SabreRs = SabreServiceCall.SearchFlightBargainFinderMaxResponse(flightSearch); return(SabreRs); }
private static void SabreFlightSearch(FlightSearchBatch f) { try { log.Debug("SabreFlightSearch Started."); DateTime fromPeriod = f.SeachPeriodFrom ?? DateTime.Today; DateTime toPeriod = f.SeachPeriodTo ?? DateTime.Today; int stayduration = f.SeachStayDuration ?? 0; int totalAdults = f.TotalAdult ?? 1; int totalChild = f.TotalChild ?? 0; int totalInfants = f.TotalInfant ?? 0; #region Validation if (f.SeachPeriodFrom == null || f.SeachPeriodTo == null || f.FROM == null || f.TO == null) { log.Debug("Fligh Search Batch not complete. BatchID = " + f.BatchID); SendErrorMail("Fligh Search Batch not complete. BatchID = " + f.BatchID); } if ((toPeriod - fromPeriod).TotalDays < 0 || (fromPeriod - DateTime.Now).TotalDays > 365 || DateTime.Now > fromPeriod) { log.Debug("Fligh Search Batch Seach Period not correct. BatchID = " + f.BatchID); SendErrorMail("Fligh Search Batch Seach Period not correct. BatchID = " + f.BatchID); } #endregion if (//(DateTime.Now - lastSeachDate).TotalDays > rerunday && (fromPeriod - DateTime.Now).TotalDays < 365 && DateTime.Now < fromPeriod) { while (fromPeriod <= toPeriod) { FlightBookingModel model = new FlightBookingModel() { SearchFlightResultViewModel = new SearchFlightResultViewModel() { DepartureStation = f.FROM, ArrivalStation = f.TO, BeginDate = fromPeriod, EndDate = fromPeriod.AddDays(stayduration), CabinClass = string.IsNullOrWhiteSpace(f.CabinClass) ? "Y" : f.CabinClass, PrefferedAirlineCode = string.IsNullOrWhiteSpace(f.PreferredAirlineCode) ? "-" : f.PreferredAirlineCode, TripType = "Return", DirectFlight = false, Adults = totalAdults, Childrens = totalChild, Infants = totalInfants } }; Alphareds.Module.SabreWebService.SWS.SearchFlightBargainFinderMaxResponse rs = SabreServiceCall.SearchFlightBargainFinderMaxResponse(model); if (rs.Output == null) { } else { SqlCommand command = new SqlCommand(); try { //model.FlightSearchResultViewModel.FullFlightSearchResult = rs.Output.ToList(); List <Alphareds.Module.SabreWebService.SWS.PricedItineryModel> result = rs.Output.ToList(); foreach (Alphareds.Module.SabreWebService.SWS.PricedItineryModel resultItem in result) { InsertFlightSearchResultService(command, resultItem, f.BatchID, fromPeriod, fromPeriod.AddDays(stayduration)); } command.Transaction.Commit(); } catch (Exception ex) { command.Transaction.Rollback(); throw ex; } } fromPeriod = fromPeriod.AddDays(1); int pauseDuration = 5000; int.TryParse(Core.GetAppSettingValueEnhanced("PauseDuration").ToString(), out pauseDuration); Thread.Sleep(pauseDuration); } } UpdateFlightSearchBatchService(f); GenerateReport(f); log.Debug("SabreFlightSearch Completed."); } catch (Exception ex) { log.Debug("Unable to complete SabreFlightSearch."); throw ex; } }