public JsonResult BindCancellationPolicy() { List <CheckBoxList> results = new List <CheckBoxList>(); int PropId = Convert.ToInt32(Session["PropId"].ToString()); if (PropId != 0) { results = BL_tblPromotionManagement.GetCancellationPolicy(PropId); } else { results = null; } return(Json(new { suggestions = results }, JsonRequestBehavior.AllowGet)); }
public ActionResult OFR() { int id = 0; if (Session["PropId"] != null) { id = Convert.ToInt32(Session["PropId"].ToString()); } etblPropertyPromotionMap obj = new etblPropertyPromotionMap(); obj.iPropId = id; Session["Entrytype"] = "N"; Session["PromoID"] = BL_tblPromotionManagement.GetPromoID("OFR Freebies"); obj.RoomTypeItems = BL_tblPromotionManagement.GetRoomTypeCheckBox(id); obj.Amenties = BL_tblPromotionManagement.GetAmentiesCheckBox(); obj.CancellationPolicy = BL_tblPromotionManagement.GetCancellationPolicy(id); obj.iCancelationChkBox = obj.CancellationPolicy.Count(); return(View(obj)); }
public ActionResult SetData(etblPropertyPromotionMap Modelprop, bool IsError) { try { if (IsError == true && Modelprop != null) { Session["IsError"] = "True"; if (Session["PromoID"] != null) { Modelprop.iPromoId = Convert.ToInt32(Session["PromoID"]); } Modelprop.iIsPlus = Modelprop.bIsPlus == true ? 1 : 0; Modelprop.iIsPercent = Modelprop.bIsPercent == true ? 1 : 0; if (Modelprop.iPromoId == Convert.ToInt32(Promotions.OFRFreebies)) { Modelprop.RoomTypeItems = BL_tblPromotionManagement.GetRoomTypeCheckBox(Convert.ToInt32(Session["PropId"].ToString())); Modelprop.Amenties = BL_tblPromotionManagement.GetAmentiesCheckBox(); } else { if (Modelprop.SelectedRoomType != null) { Modelprop.sRoomTypeId = Modelprop.SelectedRoomType.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); } if (Modelprop.SelectedAmenityID != null) { Modelprop.sAmenityId = Modelprop.SelectedAmenityID.Select(i => i.ToString(CultureInfo.InvariantCulture)).Aggregate((s1, s2) => s1 + "," + s2); } Modelprop.RoomTypeItems = BL_tblPromotionManagement.GetRoomTypeCheckBox(Modelprop.iPropId, Modelprop.iID, Modelprop.iRPId); Modelprop.Amenties = BL_tblPromotionManagement.GetAmentiesCheckBox(Modelprop.sAmenityId); Modelprop.CancellationPolicy = BL_tblPromotionManagement.GetCancellationPolicy(Modelprop.iPropId, Modelprop.sCancellationPolicy); Modelprop.iCancelationChkBox = Modelprop.CancellationPolicy.Count(); } ViewData["ValiditFrom"] = Modelprop.dtRPValidFrom; ViewData["ValiditTo"] = Modelprop.dtRPValidTo; var jsonSerialiser = new JavaScriptSerializer(); var json = Modelprop.CancellationPolicyJSonData; ViewData["cancellationJSON"] = json; if (Modelprop.iPromoId == Convert.ToInt32(Promotions.BasicDeal)) { return(View("BasicPromotions", Modelprop)); } if (Modelprop.iPromoId == Convert.ToInt32(Promotions.MinimumStay)) { return(View("MinimumLengthPromotion", Modelprop)); } if (Modelprop.iPromoId == Convert.ToInt32(Promotions.EarlyBooker)) { return(View("EarlyBookerPromotion", Modelprop)); } if (Modelprop.iPromoId == Convert.ToInt32(Promotions.LastMinutes)) { return(View("LastMinutePromotion", Modelprop)); } if (Modelprop.iPromoId == Convert.ToInt32(Promotions.HrsPromotion)) { return(View("HrsPromotions", Modelprop)); } if (Modelprop.iPromoId == Convert.ToInt32(Promotions.OFRFreebies)) { return(View("OFR", Modelprop)); } else { return(View("../PromotionManagement")); } } else { List <etblPropertyPromotionMap> prop = new List <etblPropertyPromotionMap>(); if (HttpContext.Request.Params["Entrytype"] != null) { Session["Entrytype"] = HttpContext.Request.Params["Entrytype"]; } if (HttpContext.Request.Params["promo"] != null) { Session["PromoID"] = Convert.ToInt32(HttpContext.Request.Params["promo"]); } if (HttpContext.Request.Params["id"] != null) { Session["id"] = Convert.ToInt32(HttpContext.Request.Params["id"]); } int a = Convert.ToInt32(Session["id"]) == null ? 0 : Convert.ToInt32(Session["id"]); if (a > 0) { prop = BL_tblPromotionManagement.getPropertyPromoDataByID(a); prop[0].iIsPlus = prop[0].bIsPlus == true ? 1 : 0; prop[0].iIsPercent = prop[0].bIsPercent == true ? 1 : 0; prop[0].dtBValidFrom = prop[0].dtBookingDateFrom.ToString("dd/MM/yyyy"); prop[0].dtBValidTo = prop[0].dtBookingDateTo.ToString("dd/MM/yyyy"); prop[0].dtSValidFrom = prop[0].dtStayDateFrom.ToString("dd/MM/yyyy"); prop[0].dtSValidTo = prop[0].dtStayDateTo.ToString("dd/MM/yyyy"); if (Convert.ToInt32(Session["PromoID"].ToString()) == Convert.ToInt32(Promotions.OFRFreebies)) { prop[0].RoomTypeItems = BL_tblPromotionManagement.GetRoomTypeCheckBox(prop[0].iPropId, prop[0].iID); prop[0].Amenties = BL_tblPromotionManagement.GetAmentiesCheckBox(prop[0].sAmenityId); } else { prop[0].RoomTypeItems = BL_tblPromotionManagement.GetRoomTypeCheckBox(prop[0].iPropId, prop[0].iID, prop[0].iRPId); prop[0].Amenties = BL_tblPromotionManagement.GetAmentiesCheckBox(prop[0].sAmenityId); prop[0].CancellationPolicy = BL_tblPromotionManagement.GetCancellationPolicy(prop[0].iPropId, prop[0].sCancellationPolicy); prop[0].iCancelationChkBox = prop[0].CancellationPolicy.Count(); } ViewData["ValiditFrom"] = prop[0].dtRPValidFrom; ViewData["ValiditTo"] = prop[0].dtRPValidTo; var jsonSerialiser = new JavaScriptSerializer(); var json = jsonSerialiser.Serialize(prop[0].CancellationPolicyGrid); ViewData["cancellationJSON"] = json; if (Session["Entrytype"].ToString() == "D") { Delete(prop[0]); return(RedirectToAction("Index")); } else { if (prop[0].iPromoId == Convert.ToInt32(Promotions.BasicDeal)) { return(View("BasicPromotions", prop[0])); } if (prop[0].iPromoId == Convert.ToInt32(Promotions.MinimumStay)) { return(View("MinimumLengthPromotion", prop[0])); } if (prop[0].iPromoId == Convert.ToInt32(Promotions.EarlyBooker)) { return(View("EarlyBookerPromotion", prop[0])); } if (prop[0].iPromoId == Convert.ToInt32(Promotions.LastMinutes)) { return(View("LastMinutePromotion", prop[0])); } if (prop[0].iPromoId == Convert.ToInt32(Promotions.HrsPromotion)) { return(View("HrsPromotions", prop[0])); } if (prop[0].iPromoId == Convert.ToInt32(Promotions.OFRFreebies)) { return(View("OFR", prop[0])); } else { return(View("../PromotionManagement")); } } } else { if (Convert.ToInt32(Session["PromoID"]) == Convert.ToInt32(Promotions.BasicDeal)) { return(RedirectToAction("BasicPromotions")); } if (Convert.ToInt32(Session["PromoID"]) == Convert.ToInt32(Promotions.MinimumStay)) { return(RedirectToAction("MinimumLengthPromotion")); } if (Convert.ToInt32(Session["PromoID"]) == Convert.ToInt32(Promotions.EarlyBooker)) { return(RedirectToAction("EarlyBookerPromotion")); } if (Convert.ToInt32(Session["PromoID"]) == Convert.ToInt32(Promotions.LastMinutes)) { return(RedirectToAction("LastMinutePromotion")); } if (Convert.ToInt32(Session["PromoID"]) == Convert.ToInt32(Promotions.HrsPromotion)) { return(RedirectToAction("HrsPromotions")); } if (Convert.ToInt32(Session["PromoID"]) == Convert.ToInt32(Promotions.OFRFreebies)) { return(RedirectToAction("OFR")); } else { return(View("../PromotionManagement")); } } } } catch (Exception) { throw; } }