Esempio n. 1
0
        //[MultipleButton(Name = "action", Argument = "Tourico")]
        public List <string> GetHotels(FormCollection collection)
        {
            GeoLocation gloc = new GeoLocation();

            gloc.Latitude  = Convert.ToDecimal(collection["lat"]);
            gloc.Longitude = Convert.ToDecimal(collection["lan"]);

            HotelSearchRequestDto searchCriteria = new HotelSearchRequestDto();

            //holds list of hotel ids to search
            var hotelIds = new List <string>();

            //Retrieve from catalog the list of hotel ids, that will be passed to the provider, if the coordinates are specified in the request
            var catalogRequest = new HotelCatalogRequest
            {
                GeoLocation = gloc,
                MinRating   = HotelBedsConstants.MinRating,
                MaxRating   = HotelBedsConstants.MaxRating,
            };

            //HotelSearchManager call to get the provider and search
            //If "Skip Local Cache" is false, then call the catalog manager for local search -- (!request.SkipLocalCache)
            if (true)
            {
                var hotelCatalogManager = new HotelCatalogManager();
                hotelIds = hotelCatalogManager.RetrieveHotelsByLatLongCatalog(catalogRequest);
            }

            return(hotelIds);
        }
Esempio n. 2
0
        private HotelSearchResponseDto ConvertFromHotelSearchResp(HotelAvailabilityProviderRes response)
        {
            var results = new HotelSearchResponseDto();

            results.Hotels = new List <HotelSearchResultItem>();
            HotelCatalogManager manager = new HotelCatalogManager();

            foreach (var providerHotel in response.Hotels)
            {
                var staticData = manager.GetHotelPropertyInformation(providerHotel.HotelInfo.HotelCode);
                if (staticData != null)
                {
                    providerHotel.HotelInfo.HeroImageUrl = staticData.ImageUrl;
                    providerHotel.HotelInfo.HomepageUrl  = staticData.HomepageUrl;
                    providerHotel.HotelInfo.Email        = staticData.Email;
                }
                results.Hotels.Add(providerHotel);
            }
            return(results);
        }
Esempio n. 3
0
        public List<string> GetHotels(FormCollection collection)
        {
            //TempData["col"] = collection;
            // return RedirectToAction("SearchTourico", "BookTourico", collection); //musanka comment

            GeoLocation gloc = new GeoLocation();
            gloc.Latitude = Convert.ToDecimal(collection["lat"]);
            gloc.Longitude = Convert.ToDecimal(collection["lan"]);

            //HotelSearchRequestDto searchCriteria = new HotelSearchRequestDto();

            //// searchCriteria.Address = collection["add"];
            //searchCriteria.Location = gloc;
            //searchCriteria.CheckInDate = Convert.ToDateTime(collection["checkIn"]);
            //searchCriteria.CheckOutDate = Convert.ToDateTime(collection["checkOut"]);
            //searchCriteria.NumberOfAdults = Convert.ToInt16(collection["ddlTotalGuest"]);
            //searchCriteria.NumberOfRooms = Convert.ToInt16(collection["ddlNoOfRooms"]);

            ////Check in cache
            //var key = gloc.Latitude.ToString() + gloc.Longitude.ToString() + searchCriteria.CheckInDate.ToString() + searchCriteria.CheckInDate.ToString();
            //var result = GetFromCache(key);

            //holds list of hotel ids to search
            var hotelIds = new List<string>();

            //if (result == null)
            //{
            //check here which provider is selected in UI
            //ProviderType = "Tourico";

            //Retrieve from catalog the list of hotel ids, that will be passed to the provider, if the coordinates are specified in the request
            var catalogRequest = new HotelCatalogRequest
            {
                GeoLocation = gloc, //request.Location,
                MinRating = 1, //request.MinRating,
                MaxRating = 5 //request.MaxRating
            };

            //HotelSearhManager call to get the provider and search

            //If "Skip Local Cache" is false, then call the catalog manager for local search -- (!request.SkipLocalCache)
            if (true)
            {
                var hotelCatalogManager = new HotelCatalogManager();
                //TODO:
                //hotelIds = hotelCatalogManager.RrieveHotelsByLatLongCatalog(catalogRequest);
            }

            //    var provider = HotelProviderBroker.GetHotelSearchProvider(HotelSearchProviderTypes.Tourico);

            //    var providerRes = provider.Search(ConvertToHotelSearchReq(searchCriteria, hotelIds));

            //    result = providerRes; // ConvertFromHotelSearchResp(providerRes);

            //    AddToCache(result, key);
            //}
            //ViewBag.StartDate = searchCriteria.CheckInDate;
            //ViewBag.EndDate = searchCriteria.CheckOutDate;
            //ViewBag.TotalTravellers = searchCriteria.NumberOfAdults;
            //ViewBag.Lat = gloc.Latitude;
            //ViewBag.Lan = gloc.Longitude;
            //return View("SearchHotelTourico", result);
            return hotelIds;
        }
Esempio n. 4
0
        public List <string> GetHotels(FormCollection collection)
        {
            //TempData["col"] = collection;
            // return RedirectToAction("SearchTourico", "BookTourico", collection); //musanka comment

            GeoLocation gloc = new GeoLocation();

            gloc.Latitude  = Convert.ToDecimal(collection["lat"]);
            gloc.Longitude = Convert.ToDecimal(collection["lan"]);

            //HotelSearchRequestDto searchCriteria = new HotelSearchRequestDto();

            //// searchCriteria.Address = collection["add"];
            //searchCriteria.Location = gloc;
            //searchCriteria.CheckInDate = Convert.ToDateTime(collection["checkIn"]);
            //searchCriteria.CheckOutDate = Convert.ToDateTime(collection["checkOut"]);
            //searchCriteria.NumberOfAdults = Convert.ToInt16(collection["ddlTotalGuest"]);
            //searchCriteria.NumberOfRooms = Convert.ToInt16(collection["ddlNoOfRooms"]);

            ////Check in cache
            //var key = gloc.Latitude.ToString() + gloc.Longitude.ToString() + searchCriteria.CheckInDate.ToString() + searchCriteria.CheckInDate.ToString();
            //var result = GetFromCache(key);

            //holds list of hotel ids to search
            var hotelIds = new List <string>();

            //if (result == null)
            //{
            //check here which provider is selected in UI
            //ProviderType = "Tourico";

            //Retrieve from catalog the list of hotel ids, that will be passed to the provider, if the coordinates are specified in the request
            var catalogRequest = new HotelCatalogRequest
            {
                GeoLocation = gloc, //request.Location,
                MinRating   = 1,    //request.MinRating,
                MaxRating   = 5     //request.MaxRating
            };

            //HotelSearhManager call to get the provider and search

            //If "Skip Local Cache" is false, then call the catalog manager for local search -- (!request.SkipLocalCache)
            if (true)
            {
                var hotelCatalogManager = new HotelCatalogManager();
                //TODO:
                //hotelIds = hotelCatalogManager.RrieveHotelsByLatLongCatalog(catalogRequest);
            }

            //    var provider = HotelProviderBroker.GetHotelSearchProvider(HotelSearchProviderTypes.Tourico);

            //    var providerRes = provider.Search(ConvertToHotelSearchReq(searchCriteria, hotelIds));

            //    result = providerRes; // ConvertFromHotelSearchResp(providerRes);


            //    AddToCache(result, key);
            //}
            //ViewBag.StartDate = searchCriteria.CheckInDate;
            //ViewBag.EndDate = searchCriteria.CheckOutDate;
            //ViewBag.TotalTravellers = searchCriteria.NumberOfAdults;
            //ViewBag.Lat = gloc.Latitude;
            //ViewBag.Lan = gloc.Longitude;
            //return View("SearchHotelTourico", result);
            return(hotelIds);
        }