public string UpdateStatus(int id, string status) { object result = null; string strReturn = string.Empty; try { ePromoCode obj = new ePromoCode(); obj = BL_PromoCode.GetSingleRecordById(id); obj.dtActionDate = DateTime.Now; obj.cStatus = status; obj.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; int i = BL_PromoCode.UpdateRecord(obj); if (i == 1) { result = new { st = 1, msg = clsUtils.ErrorMsg("Promo Code", 4, status) }; } else { result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) }; } } catch (Exception) { result = new { st = 0, msg = clsUtils.ErrorMsg("", 3) }; } strReturn = OneFineRateAppUtil.clsUtils.ConvertToJson(result); return(strReturn); }
public ActionResult AddPromoCode(ePromoCode eObj) { //string sPromoTitle, string sPromoDescription, string sPromoCode, string cPercentageValue, string dValue, string dtBookingFrom, string dtBookingTo, string dtStayFrom, string dtStayTo string strReturn = string.Empty; try { //ePromoCode eObj = new ePromoCode(); //eObj.sPromoCode = objPromo.sPromoCode; //eObj.sPromoTitle = objPromo.sPromoTitle; //eObj.sPromoDescription = objPromo.sPromoDescription; //eObj.cPercentageValue = objPromo.cPercentageValue; //eObj.dValue = Convert.ToDecimal(objPromo.dValue); if (ModelState.IsValid) { eObj.dtBookingFrom = clsUtils.ConvertddmmyyyytoDateTime(eObj.BookingFrom); eObj.dtBookingTo = clsUtils.ConvertddmmyyyytoDateTime(eObj.BookingTo); eObj.dtStayFrom = clsUtils.ConvertddmmyyyytoDateTime(eObj.StayFrom); eObj.dtStayTo = clsUtils.ConvertddmmyyyytoDateTime(eObj.StayTo); eObj.dtActionDate = DateTime.Now; eObj.cStatus = "A"; eObj.iActionBy = ((OneFineRateBLL.BL_Login.UserDetails)Session["UserDetails"]).iUserId; if (eObj.dtStayTo >= eObj.dtBookingTo) { if (eObj.iPromoCodeId > 0)//eObj.Mode == "E" && { int i = BL_PromoCode.UpdateRecord(eObj); if (i == 1) { eObj.msg = clsUtils.ErrorMsg("Promo Code", 2); eObj.st = "1"; } else { eObj.msg = clsUtils.ErrorMsg("Promo Code", 0); eObj.st = "0"; } } else { int i = BL_PromoCode.AddRecord(eObj); if (i == 1) { eObj.msg = clsUtils.ErrorMsg("Promo Code", 1); eObj.st = "1"; } else { eObj.msg = clsUtils.ErrorMsg("Promo Code", 0); eObj.st = "0"; } } } else { eObj.msg = clsUtils.ErrorMsg("", 8); eObj.st = "0"; } //return RedirectToAction("Index", "PromoCode"); } } catch (Exception) { eObj.msg = clsUtils.ErrorMsg("", 3); eObj.st = "0"; } return(PartialView("_PromoCode", eObj)); }