Beispiel #1
0
        private static void InsertFlightSearchResultService(SqlCommand command, Alphareds.Module.SabreWebService.SWS.PricedItineryModel pricedItineraryModel, int batchID, DateTime start, DateTime end)
        {
            try
            {
                if (command.Connection == null)
                {
                    command = dbADO.OpenConnection(command);
                }

                List <string> RBD = new List <string>();
                foreach (var odo in pricedItineraryModel.OriginDestinationOptions)
                {
                    foreach (var fs in odo.FlightSegments)
                    {
                        RBD.Add(fs.ResBookDesigCode);
                    }
                }

                FlightSearchResult result = new FlightSearchResult()
                {
                    BatchID               = batchID,
                    AirlineCode           = pricedItineraryModel.PricingInfo.ValidatingCarrier,
                    TotalPrice            = pricedItineraryModel.PricingInfo.TotalAfterTax,
                    OutboundDepartureDate = start,
                    InboundDepartureDate  = end,
                    ResBookDesignCode     = RBD.Aggregate((x, y) => x + "/" + y)//.Distinct().OrderBy(x => x)
                };
                InsertFlightSearchResult(dbADO, result, command);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
 public void configureBeforeClass()
 {
     driver             = Browser.getBrowser("Chrome");
     loginPage          = new Login();
     air                = new AirFlow();
     flightSearchResult = new FlightSearchResult();
     quote              = new Quote();
     reprice            = new RepriceBook();
     tsp                = new TSP();
     addTravelers       = new AddTravelers();
     payment            = new Payment();
     logout             = new Logout();
 }
Beispiel #3
0
        public ActionResult Search(FlightSearchResult fg)
        {
            // return fg.FlightDate.ToShortDateString()+ " "+fg.Boarding+" "+fg.Landing+""+fg.NoOfPassangers;

            List <FlightChild> flights = new List <FlightChild>();
            FlightChild        flight  = null;
            String             s       = fg.FlightDate.ToString();

            TempData["start"] = fg.Boarding;
            TempData.Keep();
            TempData["end"] = fg.Landing;
            TempData.Keep();
            if ((fg.Boarding != null) && (fg.Landing != null))
            {
                try
                {
                    List <SearchFlight> modelFlights = bl.getDetails(fg.FlightDate.ToShortDateString(), fg.Boarding, fg.Landing);

                    if (String.Equals(fg.Boarding, fg.Landing))
                    {
                        ViewBag.Mesage = "Source And destination are same.Please try again ";
                    }
                    foreach (SearchFlight item in modelFlights)
                    {
                        flight               = new FlightChild();
                        flight.Flightid      = item.Flightid;
                        flight.Departuretime = item.Departuretime;
                        flight.Arrivaltime   = item.Arrivaltime;
                        flight.Duration      = item.Duration;
                        flight.Fare          = item.Fare;
                        flights.Add(flight);
                    }
                }
                catch (NoFlightInDatabaseException noflightException)
                {
                    ViewBag.Message = noflightException.Message;
                }
                catch (Exception exception)
                {
                    ViewBag.Message = exception.Message;
                }
            }
            else
            {
                ViewBag.Message = "Invalid source and destination.Try Again!!!!";
            }
            return(View("SearchFlightPage", flights));
        }
Beispiel #4
0
        public void BuyAirlineTicketTest()
        {
            var          startDate    = new DateTime(2021, 6, 1);
            var          finishDate   = new DateTime(2021, 6, 8);
            MainPage     mainPage     = new MainPage(_driver);
            AviaMainPage aviaMainPage = mainPage.AviaButtonClick();

            aviaMainPage.ChangeAirport();
            aviaMainPage.ChangeDates(startDate, finishDate);
            FlightSearchResult flightsPage = aviaMainPage.FlightsClick();

            flightsPage.ByTicket();
            bool actualTicket = flightsPage.CheckPurchase;

            Assert.That(actualTicket, "Check purchase error.");
        }
        public ActionResult Search()
        {
            FlightSearchResult places   = new FlightSearchResult();
            List <string>      s_myList = bl.FetchPlaceNames();
            List <string>      d_myList = bl.FetchPlaceNames();

            places.BoardingFrom = new SelectList(s_myList);
            places.LandingIn    = new SelectList(d_myList);
            if (ModelState.IsValid)
            {
                return(View(places));
            }
            else
            {
                return(View("Search"));
            }
        }
 public HttpResponseMessage FlightSearch(HttpRequestMessage request, FlightSearchRequest search)
 {
     if (IsValid(search) && IsDifferentAirport(search))
     {
         var result       = FlightStorage.GetFlights();
         var matchedItems = result.Where(f => f.From.Airport.ToLower().Contains(search.From.ToLower()) ||
                                         f.To.Airport.ToLower().Contains(search.To.ToLower()) ||
                                         f.DepartureTime.ToLower().Contains(search.To.ToLower())).ToList();
         var response = new FlightSearchResult
         {
             TotalItems = result.Length,
             Items      = matchedItems,
             Page       = matchedItems.Any() ? 1 : 0
         };
         return(request.CreateResponse(HttpStatusCode.OK, response));
     }
     return(request.CreateResponse(HttpStatusCode.BadRequest));
 }
        public async Task <IHttpActionResult> FlightSearch(FlightSearchRequest search)
        {
            if (!IsValid(search) || !NotSameAirport(search))
            {
                return(BadRequest());
            }
            var result = await _flightService.GetFlight();

            var matchedItems = result.Where(f => f.From.AirportCode.ToLower().Contains(search.From.ToLower()) ||
                                            f.To.AirportCode.ToLower().Contains(search.To.ToLower()) ||
                                            DateTime.Parse(f.DepartureTime) ==
                                            DateTime.Parse(search.DepartureDate)).DistinctBy(f => f.Carrier).ToList();
            var response = new FlightSearchResult
            {
                TotalItems = matchedItems.Count,
                Items      = matchedItems,
                Page       = matchedItems.Any() ? 1 : 0
            };

            return(Ok(response));
        }
Beispiel #8
0
        public FlightSearchResult StartSearch(FlightSearch flightSearch)
        {
            // Validate the search
            if (validateFlightSearch(flightSearch))
            {
                //alert user of the error
                return(null);
            }
            // save all to the database that is needed this included what the customer searched for so we can report on it later
            var searchId = searchRepository.SearchFlightStart(flightSearch);

            // create our object to return
            FlightSearchResult flightSearchResult = new FlightSearchResult
            {
                FlightSearchId = searchId,
                FlightSearch   = flightSearch
            };

            // return anything we need for the please wait page - currently unknown apart from the search id

            // return as we are done here
            return(flightSearchResult);
        }
Beispiel #9
0
        private static void InsertFlightSearchResult(DatabaseHandlerMain db, FlightSearchResult searchresult, SqlCommand command)
        {
            try
            {
                var searchResultInsertQuery = "Exec [Report].[usp_FlightSearchResultInsert]  @BatchID,@OutboundDepartureDate,@InboundDepartureDate,@AirlineCode,@TotalPrice,@ResBookDesignCode";

                command.CommandText = searchResultInsertQuery;

                command.Parameters.Clear();

                command.Parameters.Add(new SqlParameter("BatchID", searchresult.BatchID ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("OutboundDepartureDate", searchresult.OutboundDepartureDate ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("InboundDepartureDate", searchresult.InboundDepartureDate ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("AirlineCode", searchresult.AirlineCode ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("TotalPrice", searchresult.TotalPrice ?? (object)DBNull.Value));
                command.Parameters.Add(new SqlParameter("ResBookDesignCode", searchresult.ResBookDesignCode ?? (object)DBNull.Value));

                db.UpdateDataByStoredProcedure(command);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Beispiel #10
0
        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);
        }