// GET: OfferReview /// <summary> /// Load the Hoteal page for public view /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult Index(PropSearchRequestModel model) { //Fetch OFR service charge // Session["BidMaster"] = BL_Bidding.GetBidMaster(CurrencyCode); PropDetailsM objlist = new PropDetailsM(); string Slocation = ""; string CIn = ""; string COut = ""; string Modify = ""; string sRoomData = ""; if (HttpContext.Request.Params["Slocation"] != null) { Slocation = HttpContext.Request.Params["Slocation"]; } if (HttpContext.Request.Params["CIn"] != null) { CIn = HttpContext.Request.Params["CIn"].ToString(); } if (HttpContext.Request.Params["COut"] != null) { COut = HttpContext.Request.Params["COut"].ToString(); } if (HttpContext.Request.Params["M"] != null) { Modify = HttpContext.Request.Params["M"]; } if (HttpContext.Request.Params["Id"] != null) { HotelId = Convert.ToInt32(OneFineRateAppUtil.clsUtils.Decode(HttpContext.Request.Params["Id"].ToString())); } if (HttpContext.Request.Params["sRoomData"] != null) { sRoomData = HttpContext.Request.Params["sRoomData"].ToString(); } //To make a count to update in the database Task.Run(() => BL_PropDetails.UpdateRecentViewAsync(HotelId, User.Identity.GetUserId <long>())); if (Modify == "1") //In this modify user can only chnage the check in check out date with in the hotel { if (Session[model.PropDetailsTempData] != null) //Take the data form the View only { objlist = Session[model.PropDetailsTempData] as PropDetailsM; ViewData["dOFRServiceCharge"] = (objlist.TaxCharges.dOFRServiceCharge + objlist.TaxCharges.TaxOnServiceCharge); // TempData.Keep(); } objlist.sRequestType = model.sRequestType; objlist.bOccuData = true; return(View(objlist)); } if (CIn != "" && COut != "" && sRoomData != "") { #region FetchRoomData and bind in datatables var roomDataResult = new List <RoomData>(); if (model.sRoomData != null) { roomDataResult = new JavaScriptSerializer().Deserialize <List <RoomData> >(model.sRoomData); } DataTable dtTblRoomOccupancySearch = new DataTable(); dtTblRoomOccupancySearch.Columns.AddRange(new DataColumn[3] { new DataColumn("ID", typeof(int)), new DataColumn("iAdults", typeof(short)), new DataColumn("children", typeof(short)) }); DataTable dtTblChildrenAgeSearch = new DataTable(); dtTblChildrenAgeSearch.Columns.AddRange(new DataColumn[2] { new DataColumn("ID", typeof(int)), new DataColumn("Age", typeof(short)) }); foreach (var room in roomDataResult) { DataRow roomOccupancy = dtTblRoomOccupancySearch.NewRow(); roomOccupancy["ID"] = room.room; roomOccupancy["iAdults"] = room.adult; roomOccupancy["children"] = room.child; dtTblRoomOccupancySearch.Rows.Add(roomOccupancy); foreach (var child in room.ChildAge) { DataRow dtChildrenAge = dtTblChildrenAgeSearch.NewRow(); dtChildrenAge["ID"] = room.room; dtChildrenAge["Age"] = child.Age; dtTblChildrenAgeSearch.Rows.Add(dtChildrenAge); } } #endregion #region OfferReviewTracker //To Track the request form which ip on which date and the same get saved into DB also var tracker = new etblOfferReviewTrackerTx(); tracker.iPropId = HotelId; tracker.dtActionDate = DateTime.Now; tracker.sIPAddress = OneFineRateAppUtil.clsUtils.getIpAddress(); //Get IP Address using "HTTP_X_FORWARDED_FOR" Server Variables //Call to Business logic to add record BL_tblOfferReviewTrackerTx.AddRecord(tracker); #endregion // To get all room of the selected hotel which is full fill the occupancy and the other criteria objlist.iPropId = HotelId; objlist.dtCheckIn = DateTime.Parse(CIn); objlist.dtCheckOut = DateTime.Parse(COut); objlist.bLogin = User.Identity.IsAuthenticated; objlist.Currency = CurrencyCode; objlist.bIsAirConditioning = false; objlist.bIsBathtub = false; objlist.bIsFlatScreenTV = false; objlist.bIsSoundproof = false; objlist.bIsView = false; objlist.bIsInternetFacilities = false; objlist.bIsPrivatePool = false; objlist.bIsRoomService = false; objlist.dMinPrice = 0; objlist.dMaxPrice = 0; objlist.SpecialDeal = true; //Bussiness logic call to search tha available room objlist = BL_PropDetails.GetPropertyDetails(objlist.iPropId, objlist, dtTblRoomOccupancySearch, dtTblChildrenAgeSearch); //When no room available if (objlist.lstetblRooms.Count == 0) { objlist.bRoomAvailable = false; } objlist.sCheckInDate = CIn; objlist.sCheckOutDate = COut; objlist.dtCheckIn = DateTime.Parse(CIn); objlist.dtCheckOut = DateTime.Parse(COut); objlist.iTotalDays = (objlist.dtCheckOut - objlist.dtCheckIn).TotalDays.ToString(); objlist.Currency = CurrencyCode; objlist.hdnJsonData = sRoomData; objlist.sRequestType = model.sRequestType; if (objlist.TaxCharges != null) { ViewData["dOFRServiceCharge"] = (objlist.TaxCharges.dOFRServiceCharge + objlist.TaxCharges.TaxOnServiceCharge); } string propDetailsName = "propDetails" + Guid.NewGuid().ToString(); objlist.TempDataPropDetails = propDetailsName; Session[propDetailsName] = objlist; //s.Keep(propDetailsName); return(View(objlist)); } if (HotelId != 0) { PropDetailsM objSearch = new PropDetailsM(); objSearch.iPropId = HotelId; objSearch.dtCheckIn = DateTime.Now.Date.AddDays(5); objSearch.dtCheckOut = DateTime.Now.Date.AddDays(6); objSearch.bLogin = User.Identity.IsAuthenticated; objSearch.Currency = CurrencyCode; objSearch.bIsAirConditioning = false; objSearch.bIsBathtub = false; objSearch.bIsFlatScreenTV = false; objSearch.bIsSoundproof = false; objSearch.bIsView = false; objSearch.bIsInternetFacilities = false; objSearch.bIsPrivatePool = false; objSearch.bIsRoomService = false; objSearch.dMinPrice = 0; objSearch.dMaxPrice = 0; objSearch.SpecialDeal = true; #region RoomOccupancySearch DataTable dtRoomOccupancySearch = new DataTable(); dtRoomOccupancySearch.Columns.AddRange(new DataColumn[3] { new DataColumn("ID", typeof(int)), new DataColumn("iAdults", typeof(short)), new DataColumn("children", typeof(short)) }); DataTable dtChildrenAgeSearch = new DataTable(); dtChildrenAgeSearch.Columns.AddRange(new DataColumn[2] { new DataColumn("ID", typeof(int)), new DataColumn("Age", typeof(short)) }); #endregion #region RoomOccupancySearch DataTable dtTblRoomOccupancySearch = new DataTable(); dtTblRoomOccupancySearch.Columns.AddRange(new DataColumn[3] { new DataColumn("ID", typeof(int)), new DataColumn("iAdults", typeof(short)), new DataColumn("children", typeof(short)) }); DataTable dtTblChildrenAgeSearch = new DataTable(); dtTblChildrenAgeSearch.Columns.AddRange(new DataColumn[2] { new DataColumn("ID", typeof(int)), new DataColumn("Age", typeof(short)) }); var roomDataResult = new List <RoomData>(); if (!string.IsNullOrEmpty(sRoomData)) { roomDataResult = new JavaScriptSerializer().Deserialize <List <RoomData> >(sRoomData); } else { roomDataResult = new List <RoomData> { new RoomData { adult = 2, room = 1, child = 0, ChildAge = new List <ChildAge>() } }; } foreach (var room in roomDataResult) { DataRow roomOccupancy = dtTblRoomOccupancySearch.NewRow(); roomOccupancy["ID"] = room.room; roomOccupancy["iAdults"] = room.adult; roomOccupancy["children"] = room.child; dtTblRoomOccupancySearch.Rows.Add(roomOccupancy); foreach (var child in room.ChildAge) { DataRow dtChildrenAge = dtTblChildrenAgeSearch.NewRow(); dtChildrenAge["ID"] = room.room; dtChildrenAge["Age"] = child.Age; dtTblChildrenAgeSearch.Rows.Add(dtChildrenAge); } } #endregion #region OfferReviewTracker var tracker = new etblOfferReviewTrackerTx(); tracker.iPropId = HotelId; tracker.dtActionDate = DateTime.Now; tracker.sIPAddress = OneFineRateAppUtil.clsUtils.getIpAddress(); BL_tblOfferReviewTrackerTx.AddRecord(tracker); #endregion objlist = BL_PropDetails.GetPropertyDetails(HotelId, objSearch, dtRoomOccupancySearch, dtChildrenAgeSearch); objlist.sRequestType = model.sRequestType; objlist.bRoomAvailable = true; objlist.sRequestType = model.sRequestType; if (objlist.TaxCharges != null) { ViewData["dOFRServiceCharge"] = (objlist.TaxCharges.dOFRServiceCharge + objlist.TaxCharges.TaxOnServiceCharge); } string propDetailsName = "propDetails" + Guid.NewGuid().ToString(); objlist.TempDataPropDetails = propDetailsName; TempData[propDetailsName] = objlist; TempData.Keep(propDetailsName); } return(View(objlist)); }
public ActionResult Index(string propId, string checkIn, string checkOut, string sRoomData) { PropDetailsM propDetailRequestModel = new PropDetailsM(); PropDetailsM propDetails = new PropDetailsM(); if (!string.IsNullOrEmpty(propId)) { if (!string.IsNullOrEmpty(checkIn) && !string.IsNullOrEmpty(checkOut)) { propDetailRequestModel.dtCheckIn = DateTime.Parse(checkIn); propDetailRequestModel.dtCheckOut = DateTime.Parse(checkOut); } else { propDetailRequestModel.dtCheckIn = DateTime.Now.Date.AddDays(1); propDetailRequestModel.dtCheckOut = DateTime.Now.Date.AddDays(2); checkIn = DateTime.Today.ToString("dd/MM/yyyy"); checkOut = DateTime.Today.AddDays(1).ToString("dd/MM/yyyy"); } var decodedPropId = Convert.ToInt32(clsUtils.Decode(propId)); propDetailRequestModel.iPropId = decodedPropId; propDetailRequestModel.iUserId = User.Identity.GetUserId <int>(); propDetailRequestModel.Currency = CurrencyCode; #region RoomOccupancySearch DataTable dtRoomOccupancySearch = new DataTable(); dtRoomOccupancySearch.Columns.AddRange(new DataColumn[3] { new DataColumn("ID", typeof(int)), new DataColumn("iAdults", typeof(short)), new DataColumn("children", typeof(short)) }); DataTable dtChildrenAgeSearch = new DataTable(); dtChildrenAgeSearch.Columns.AddRange(new DataColumn[2] { new DataColumn("ID", typeof(int)), new DataColumn("Age", typeof(short)) }); var roomDataResult = new List <RoomData>(); if (!string.IsNullOrEmpty(sRoomData)) { roomDataResult = new JavaScriptSerializer().Deserialize <List <RoomData> >(sRoomData); } else { roomDataResult = new List <RoomData> { new RoomData { adult = 2, room = 1, child = 0, ChildAge = new List <ChildAge>() } }; } foreach (var room in roomDataResult) { DataRow roomOccupancy = dtRoomOccupancySearch.NewRow(); roomOccupancy["ID"] = room.room; roomOccupancy["iAdults"] = room.adult; roomOccupancy["children"] = room.child; dtRoomOccupancySearch.Rows.Add(roomOccupancy); foreach (var child in room.ChildAge) { DataRow dtChildrenAge = dtChildrenAgeSearch.NewRow(); dtChildrenAge["ID"] = room.room; dtChildrenAge["Age"] = child.Age; dtChildrenAgeSearch.Rows.Add(dtChildrenAge); } } #endregion #region OfferReviewTracker var tracker = new etblOfferReviewTrackerTx(); tracker.iPropId = decodedPropId; tracker.dtActionDate = DateTime.Now; tracker.sIPAddress = OneFineRateAppUtil.clsUtils.getIpAddress(); BL_tblOfferReviewTrackerTx.AddRecord(tracker); #endregion propDetails = BL_PropDetails.GetPropertyDetailsToRedeemPoints(decodedPropId, propDetailRequestModel, dtRoomOccupancySearch, dtChildrenAgeSearch); propDetails.bRoomAvailable = true; propDetails.cStatus = "A"; propDetails.dtCheckIn = propDetailRequestModel.dtCheckIn; propDetails.dtCheckOut = propDetailRequestModel.dtCheckOut; propDetails.sCheckInDate = checkIn; propDetails.sCheckOutDate = checkOut; propDetails.sRoomData = sRoomData; propDetails.hdnJsonData = sRoomData; ViewBag.GuestDetailString = roomDataResult.FirstOrDefault().adult + roomDataResult.FirstOrDefault().child + " Guests in 1 Room"; var uniqueSessionId = Guid.NewGuid().ToString(); propDetails.TempDataPropDetails = uniqueSessionId; } return(View(propDetails)); }