/// <summary> /// 更换弹窗中的优惠券 /// </summary> /// <param name="sqlconnection"></param> /// <param name="model"></param> /// <returns></returns> public static int UpdateCouponInPopup(SqlConnection sqlconnection, CouponsInPopup model) { string sql = @"UPDATE Configuration..[CouponInPopupConfig] SET CouponId=@CouponId, UpdateDateTime=GETDATE() WHERE PKId = @pkid"; var sqlpara = new SqlParameter[] { new SqlParameter("@CouponId", model.CouponId ?? string.Empty), new SqlParameter("@pkid", model.PKId) }; return(SqlHelper.ExecuteNonQuery(sqlconnection, CommandType.Text, sql, sqlpara)); }
/// <summary> /// 插入弹窗中的优惠券 /// </summary> /// <param name="sqlconnection"></param> /// <param name="model"></param> /// <returns></returns> public static int InsertCouponInPopup(SqlConnection sqlconnection, CouponsInPopup model) { string sql = @"INSERT INTO Configuration..[CouponInPopupConfig](CouponId,PopupAnimationId,CreateDateTime,UpdateDateTime,Creator) values(@CouponId,@PopupAnimationId,GETDATE(),GETDATE(), @Creator);Select SCOPE_IDENTITY();"; var sqlpara = new SqlParameter[] { new SqlParameter("@CouponId", model.CouponId), new SqlParameter("@PopupAnimationId", model.PopupAnimationId), new SqlParameter("@Creator", model.Creator) }; int result = int.Parse(SqlHelper.ExecuteScalar(sqlconnection, CommandType.Text, sql, sqlpara).ToString()); return(result); }
public JsonResult AddOrUpdateCoupon(CouponsInPopup model) { HomePageConfigManager config = new HomePageConfigManager(); if (model.PKId < 0) { var result = config.InsertCouponInPopup(model); if (result > 0) { var oprLog = new OprLog { ObjectID = result, ObjectType = "CouponsInPopup", AfterValue = "对应的弹窗动画Id: " + model.PopupAnimationId + ", 优惠券ID或GUID:" + model.CouponId, Author = HttpContext.User.Identity.Name, Operation = "新建弹窗中可领优惠券" }; new OprLogManager().AddOprLog(oprLog); } return(Json(result)); } else { var result = config.UpdateCouponInPopup(model); if (result > 0) { var oprLog = new OprLog { ObjectID = model.PKId, ObjectType = "CouponsInPopup", AfterValue = "对应的弹窗动画Id: " + model.PopupAnimationId + ", 优惠券ID或GUID:" + model.CouponId, Author = HttpContext.User.Identity.Name, Operation = "更新弹窗中可领优惠券" }; new OprLogManager().AddOprLog(oprLog); } return(Json(result)); } }
public int UpdateCouponInPopup(CouponsInPopup model) { return(handler.UpdateCouponInPopup(model)); }
public int InsertCouponInPopup(CouponsInPopup model) { return(handler.InsertCouponInPopup(model)); }
/// <summary> /// 更新优惠券 /// </summary> /// <param name="model"></param> /// <returns></returns> public int UpdateCouponInPopup(CouponsInPopup model) { Func <SqlConnection, int> action = (connection) => DalHomePageConfig.UpdateCouponInPopup(connection, model); return(dbManager.Execute(action)); }