public ActionResult SearchHotel(int page = 1, int pageSize = 6) { //Display Active Hotel ViewBag.isActive = UtilContants.HOTELS_NAV; double price = double.Parse(Request.Params["txtPrice"]); ViewBag.Prices = price; int toPlace = int.Parse(Request.Params["txtToPlace"]); ViewBag.toPlaces = toPlace; // declare SearchHotelModel to get method listSearchHotel var searchHotel = new SearchHotelModel(); var result = searchHotel.listSearchHotel(toPlace, price).ToPagedList(page, pageSize); //declare TourModel to get listComboBoxToPlace method TourModel home = new TourModel(); var listComboBoxToPlace = home.listComboBoxToPlace(); // call ListContainerHotel TO contain all list ListContainerHotel listContainer = new ListContainerHotel(); listContainer.Hotel = result; listContainer.listComboBoxToPlace = listComboBoxToPlace; return(View(listContainer)); }
public SearchRoomModel GetRoomModelWithResult(out SearchHotelModel hotelModel, out string hotelIdPicked) { hotelModel = InitializeTestingModel.SearchHotelModel("Ipoh, Malaysia", 2, 4, 0, new List <int> { }); hotelModel.SupplierIncluded = new Alphareds.Module.ESBHotelComparisonWebService.ESBHotel.SearchSupplier { EANRapid = true, }; hotelModel.ArrivalDate = new DateTime(2018, 12, 10); hotelModel.DepartureDate = new DateTime(2018, 12, 15); hotelModel.Result = Alphareds.Module.ServiceCall.ESBHotelServiceCall.GetHotelList(hotelModel); var hotelPicked = hotelModel.Result?.HotelList?.OrderBy(x => Guid.NewGuid()).FirstOrDefault(x => x.hotelId == "9626874"); Assert.IsNotNull(hotelPicked); hotelIdPicked = hotelPicked.hotelId; var roomModel = InitializeTestingModel.SearchRoomHotel(hotelModel, hotelPicked.hotelId); roomModel.Result = Alphareds.Module.ServiceCall.ESBHotelServiceCall.GetRoomAvailability(roomModel, hotelModel); var roomTokenList = roomModel.Result.HotelRoomInformationList[0].roomAvailabilityDetailsList.SelectMany(s => s.BetTypes).Select(s => s.id); var tokenGrpList = roomTokenList.GroupBy(s => s).Select(s => new { c = s.Count(), s.Key }).Where(s => s.c > 2); return(roomModel); }
// GET: Agent/Hotel public async Task <ActionResult> Index() { SearchHotelModel searchModel = (SearchHotelModel)Core.GetSession(Enumeration.SessionName.SearchRequest, tripid); ESBHotelServiceCall.Search b2BSearch = new ESBHotelServiceCall.Search(searchModel); var resp = await b2BSearch.GetB2BHotelListAsync(); return(View()); }
public static SearchRoomModel SearchRoomHotel(SearchHotelModel hotelListReq, string hotelID) { return(new SearchRoomModel { ArrivalDate = hotelListReq.ArrivalDate, DepartureDate = hotelListReq.DepartureDate, CurrencyCode = hotelListReq.CurrencyCode, CustomerIpAddress = hotelListReq.CustomerIpAddress, CustomerSessionId = hotelListReq.CustomerSessionId, CustomerUserAgent = hotelListReq.CustomerUserAgent, HotelID = hotelID, }); }
//[TestMethod] public void GetHotelList() { // Initialize Value here for testing SearchHotelModel searchHotelModel = new SearchHotelModel { ArrivalDate = DateTime.Now.AddDays(5), DepartureDate = DateTime.Now.AddDays(10), CurrencyCode = "MYR", CustomerIpAddress = "1", CustomerUserAgent = "1", CustomerSessionId = new Guid().ToString(), Destination = "Ipoh", NoOfAdult = 1, NoOfInfant = 1, NoOfRoom = 1, Star = 10, SupplierIncluded = new Alphareds.Module.ESBHotelComparisonWebService.ESBHotel.SearchSupplier { Expedia = true //Tourplan = true //JacTravel = true //HotelBeds = true }, //totalDays = "3" }; searchHotelModel.ArrivalDate = new DateTime(2017, DateTime.Now.Month + 1, 23); searchHotelModel.DepartureDate = new DateTime(2017, DateTime.Now.Month + 1, 27); List <int> hotelId = new List <int>() { 133263, 66527, 134811 }; List <string> hotelIdString = hotelId.ConvertAll(x => x.ToString()); // Tourplan Hotel ID hotelIdString.Add("KULACASCKULTEST01"); var ESBresult = ESBHotelServiceCall.GetHotelList(searchHotelModel); var ESB_Id_Result = ESBHotelServiceCall.GetHotelList(searchHotelModel, hotelIdString); //throw new Exception("Total Hotel " + ESBresult.HotelList.Length.ToString()); }
private void InsertSelectedSearchSupplier(SearchHotelModel _searchModel, System.Reflection.PropertyInfo[] supplierReflect, SearchProgress.Progress searchProgress) { foreach (var item in supplierReflect) { if (item.PropertyType.Name == "Boolean") { if ((bool)item.GetValue(_searchModel.SupplierIncluded)) { var supp = (Suppliers) Enum.Parse(typeof(Suppliers), item.Name); _searchModel.SetSearchProgress(supp, searchProgress); } } } }
public void SetCache(SearchHotelModel _SearchModel) { /* * 1) Check Destination * 2) If not exist cache any ignore date pax * 3) Display dump result first * 4) Perform search * 6) Await search complete * 7) Replace result at frontend */ var _dumpCacheList = _GetCacheFromMem(DumpListCacheKey); if (_dumpCacheList == null) { List <SearchHotelModel> _cacheList = new List <SearchHotelModel>(); _cacheList.Add(_SearchModel); System.Web.HttpContext.Current.Cache.Add(DumpListCacheKey, _cacheList, null, System.Web.Caching.Cache.NoAbsoluteExpiration, TimeSpan.FromMinutes(1), System.Web.Caching.CacheItemPriority.Default, null); } else { var _converted = (List <SearchHotelModel>)_dumpCacheList; var _output = _converted.FirstOrDefault(x => x.Destination.ToLower() == _SearchModel.Destination.ToLower()); if (_output == null) { _converted.Add(_SearchModel); } else { // Any null then dump result inside first if (_output.Result == null) { _output.Result = _SearchModel.Result; } if (_output.B2BResult == null) { _output.B2BResult = _SearchModel.B2BResult; } } } }
//[TestMethod] public void GetHotelListById() { // Initialize Value here for testing SearchHotelModel searchHotelModel = InitializeTestingModel.SearchHotelModel(); List <int> hotelId = new List <int> { 455291 }; var result = Alphareds.Module.ServiceCall.ExpediaHotelsServiceCall.GetHotelList(searchHotelModel, hotelId); if (result.Errors != null) { Exception ex = new Exception(); throw new Exception("An error occur while getting hotel from service: " + System.Environment.NewLine + result.Errors.ErrorMessage); } }
public bool GetCache(SearchHotelModel _SearchModel) { var _dumpCacheList = _GetCacheFromMem(DumpListCacheKey); if (_dumpCacheList != null) { var _converted = (List <SearchHotelModel>)_dumpCacheList; var _output = _converted.FirstOrDefault(x => x.Destination.ToLower() == _SearchModel.Destination.ToLower()); if (_output != null) { _SearchModel.Result = _output.Result; _SearchModel.B2BResult = _output.B2BResult; return(true); } } return(false); }
public SessionSetterController() { logger = LogManager.GetCurrentClassLogger(); var request = new UrlHelper(System.Web.HttpContext.Current.Request.RequestContext); var routeValue = request.RequestContext.RouteData.Values["tripid"]; string routeString = routeValue != null?routeValue.ToString() : null; tripid = System.Web.HttpContext.Current.Request.QueryString["tripid"] ?? (routeString ?? System.Web.HttpContext.Current.Request.Form["tripid"]); if (!string.IsNullOrWhiteSpace(tripid)) { tripid = tripid.Split(',')[0]; } var _session = Core.GetSession(Enumeration.SessionName.SearchRequest, tripid); searchModel = _session != null ? (SearchHotelModel)_session : new SearchHotelModel { }; }
//[TestMethod] public void GetHotelList() { // Initialize Value here for testing SearchHotelModel searchHotelModel = InitializeTestingModel.SearchHotelModel("Kuala Lumpur"); var result = Alphareds.Module.ServiceCall.ExpediaHotelsServiceCall.GetHotelList(searchHotelModel); if (result.Errors != null) { Exception ex = new Exception(); throw new Exception("An error occur while getting hotel from service: " + System.Environment.NewLine + result.Errors.ErrorMessage); } SearchRoomModel searchRoomModel = InitializeTestingModel.SearchRoomHotel(searchHotelModel, result.HotelList.First().hotelId); var roomAvail = Alphareds.Module.ServiceCall.ExpediaHotelsServiceCall.GetRoomAvailability(searchRoomModel, searchHotelModel); if (roomAvail.Errors != null) { Exception ex = new Exception(); throw new Exception("An error occur while getting room from service: " + System.Environment.NewLine + roomAvail.Errors.ErrorMessage); } }