private HotelPropertyProviderReq ConvertToProviderRequest(HotelSearchDto hotelDto) { HotelPropertyProviderReq providerReq = new HotelPropertyProviderReq(); if (hotelDto != null) { providerReq.CheckInDate = Convert.ToDateTime(hotelDto.StartDate); providerReq.CheckOutDate = Convert.ToDateTime(hotelDto.EndDate); providerReq.HotelCode = selectedHotelCode; providerReq.NoOfGuest = Convert.ToInt16(hotelDto.TotalGuest); } return providerReq; }
// // GET: /BBHotelDetails/ public ActionResult Index(FormCollection collection) { HotelBedsDetailsHandler hotelInfo = new HotelBedsDetailsHandler(); HotelAvailabilityProviderReq providerReq = new HotelAvailabilityProviderReq(); HotelSearchDto searchCriteria = new HotelSearchDto(); searchCriteria.HotelCodes = collection["hotelCode"]; searchCriteria.StartDate = collection["checkIn"]; searchCriteria.EndDate = collection["checkOut"]; Hotel hotelfiltered = new Hotel(); providerReq.CheckInDate = Convert.ToDateTime(collection["checkIn"]); providerReq.CheckOutDate = Convert.ToDateTime(collection["checkOut"]); providerReq.TotalAdults = Convert.ToInt32(collection["totalTravellers"]); providerReq.TotalRooms = Convert.ToInt32(collection["totalRooms"]); if (searchCriteria.HotelCodes.Length > 0) { providerReq.HotelCodes = searchCriteria.HotelCodes.Split(' ').ToList<string>(); } var hotelinfoRS = hotelInfo.Execute(providerReq).Hotels.FirstOrDefault(); return View(hotelinfoRS); }
private HotelAvailabilityProviderReq ConvertToProviderReqeust(HotelSearchDto hotelDto) { HotelBedsSearchProvider provider = new HotelBedsSearchProvider(); HotelAvailabilityProviderReq providerReq = new HotelAvailabilityProviderReq(); if (hotelDto != null) { providerReq.CheckInDate = Convert.ToDateTime(hotelDto.StartDate); providerReq.CheckOutDate = Convert.ToDateTime(hotelDto.EndDate); providerReq.MaxRating = hotelDto.MaxRating; providerReq.MinRating = hotelDto.MinRating; //Hotel code should come from search manager class if (hotelDto.HotelCodes != null) { providerReq.HotelCodes = hotelDto.HotelCodes; } else if (hotelDto.Latitude.ToString().Length > 0) { providerReq.GeoLocation = new GeoLocation() { Latitude = Convert.ToDecimal(hotelDto.Latitude), Longitude = Convert.ToDecimal(hotelDto.Longitude) }; } //TODO:RoomDto //providerReq.TotalAdults = Convert.ToInt16(hotelDto.TotalGuest); } return providerReq; }
public ActionResult SearchHotel(FormCollection collection) { HotelSearchDto searchCriteria = new HotelSearchDto(); searchCriteria.Address = collection["add"]; searchCriteria.Latitude = double.Parse(collection["lat"]); searchCriteria.Longitude = double.Parse(collection["lan"]); searchCriteria.StartDate = collection["checkIn"]; searchCriteria.EndDate = collection["checkOut"]; searchCriteria.TotalGuest = collection["ddlTotalGuest"]; searchCriteria.TotalRoom = collection["ddlNoOfRooms"]; searchCriteria.Provider = collection["ddlProvider"]; //Check in cache var key = searchCriteria.Latitude.ToString() + searchCriteria.Longitude.ToString() + searchCriteria.StartDate.ToString() + searchCriteria.EndDate.ToString(); var result = GetFromCache(key); if (result == null) { SearchHotel mgr = new SearchHotel(); result = mgr.Search(searchCriteria); AddToCache(result, key); } ViewBag.StartDate = searchCriteria.StartDate; ViewBag.EndDate = searchCriteria.EndDate; ViewBag.TotalTravellers = searchCriteria.TotalGuest; ViewBag.Lat = searchCriteria.Latitude; ViewBag.Lan = searchCriteria.Longitude; return View("SearchHotel", result); }
public ActionResult searchBedbank(FormCollection collection) { HotelSearchDto searchCriteria = new HotelSearchDto(); searchCriteria.Provider = collection["ddlProvider"]; searchCriteria.Address = collection["add"]; if (collection["lat"] != "") searchCriteria.Latitude = double.Parse(collection["lat"]); if (collection["lan"] != "") searchCriteria.Longitude = double.Parse(collection["lan"]); searchCriteria.StartDate = collection["checkIn"]; searchCriteria.EndDate = collection["checkOut"]; searchCriteria.TotalGuest = collection["ddlTotalGuest"]; searchCriteria.TotalRoom = collection["ddlNoOfRooms"]; searchCriteria.Provider = collection["ddlProvider"]; //if (collection["hotelcodes"] != "") searchCriteria.HotelCodes = GetHotels(collection); TempData["HotelSearchDto"] = searchCriteria; //Call manager class and there make a call to provider based on selected ddl value(Provider) ViewBag.StartDate = searchCriteria.StartDate; ViewBag.EndDate = searchCriteria.EndDate; ViewBag.TotalTravellers = searchCriteria.TotalGuest; ViewBag.Lat = searchCriteria.Latitude; ViewBag.Lan = searchCriteria.Longitude; var provider = HotelProviderBroker.GetHotelSearchProvider((HotelSearchProviderTypes)int.Parse(searchCriteria.Provider)); var searchResponse = provider.Search(ConvertToProviderReqeust(searchCriteria)); return View("SearchHotelTourico", searchResponse); }
public OTA_HotelAvailRS Search(HotelSearchDto searchCriteria) { var session = SabreSessionManager.Create(); OTA_HotelAvailRQ availability = new OTA_HotelAvailRQ(); OTA_HotelAvailRQAvailRequestSegment req = new OTA_HotelAvailRQAvailRequestSegment(); OTA_HotelAvailRQAvailRequestSegmentHotelSearchCriteria crt = new OTA_HotelAvailRQAvailRequestSegmentHotelSearchCriteria(); OTA_HotelAvailRQAvailRequestSegmentHotelSearchCriteriaCriterion cirterian = new OTA_HotelAvailRQAvailRequestSegmentHotelSearchCriteriaCriterion(); OTA_HotelAvailRQAvailRequestSegmentHotelSearchCriteriaCriterionHotelRef[] refrs = new OTA_HotelAvailRQAvailRequestSegmentHotelSearchCriteriaCriterionHotelRef[1]; OTA_HotelAvailRQAvailRequestSegmentHotelSearchCriteriaCriterionHotelRef ref1 = new OTA_HotelAvailRQAvailRequestSegmentHotelSearchCriteriaCriterionHotelRef(); OTA_HotelAvailRQAvailRequestSegmentTimeSpan journeyDate = new OTA_HotelAvailRQAvailRequestSegmentTimeSpan(); OTA_HotelAvailRQAvailRequestSegmentGuestCounts guest = new OTA_HotelAvailRQAvailRequestSegmentGuestCounts(); Security1 sec = new Security1(); OTA_HotelAvailRQAvailRequestSegmentPOS pos = new OTA_HotelAvailRQAvailRequestSegmentPOS(); OTA_HotelAvailRQAvailRequestSegmentPOSSource source = new OTA_HotelAvailRQAvailRequestSegmentPOSSource(); OTA_HotelAvailRQAvailRequestSegmentRatePlanCandidates ratePlan = new OTA_HotelAvailRQAvailRequestSegmentRatePlanCandidates(); ratePlan.RateRange = new OTA_HotelAvailRQAvailRequestSegmentRatePlanCandidatesRateRange() { Min = "1" }; if (searchCriteria.Address != null && searchCriteria.Address != string.Empty) ref1.HotelCityCode = searchCriteria.Address; #pragma warning disable CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' if (searchCriteria.Latitude != null && searchCriteria.Longitude != null) #pragma warning restore CS0472 // The result of the expression is always the same since a value of this type is never equal to 'null' { ref1.Latitude = searchCriteria.Latitude.ToString("N2"); ref1.Longitude = searchCriteria.Longitude.ToString("N2"); } refrs[0] = ref1; cirterian.HotelRef = refrs; crt.Criterion = cirterian; req.HotelSearchCriteria = crt; guest.Count = searchCriteria.TotalGuest; req.GuestCounts = guest; crt.NumProperties = "30"; //req.po var startDate = Convert.ToDateTime(searchCriteria.StartDate); var endDate = Convert.ToDateTime(searchCriteria.EndDate); journeyDate.Start = startDate.ToString("MM-dd");// .Month.ToString() + "-" + startDate.Day.ToString(); journeyDate.End = endDate.ToString("MM-dd"); //.Month.ToString() + "-" + endDate.Day.ToString(); req.TimeSpan = journeyDate; availability.AvailRequestSegment = req; OTA_HotelAvailService ss = new OTA_HotelAvailService(); sec.BinarySecurityToken = session.SecurityValue.BinarySecurityToken; ss.Security = sec; ss.MessageHeaderValue = Get("OTA_HotelAvailLLSRQ", ""); var XMLRequest = Common.Utility.Serialize(availability); var result = ss.OTA_HotelAvailRQ(availability); SessionClose close = new SessionClose(); close.Close(session.SecurityValue.BinarySecurityToken); var XML = Common.Utility.Serialize(result); return result; }