public ActionResult SaveThirdPartyCouponConfig(ThirdPartyCouponConfigModel model) { //try //{ if (model.PKID > 0) { if (new ThirdPartyCouponConfigManager().UpdateThirdPartyCouponConfig(model) > 0) { new OprLogManager().AddOprLog(new OprLog() { Author = HttpContext.User.Identity.Name, BeforeValue = JsonConvert.SerializeObject(model), AfterValue = "", ChangeDatetime = DateTime.Now, ObjectID = model.PKID, ObjectType = "Third", Operation = "修改第三方优惠券配置", HostName = Request.UserHostName }); return(Json(new { Status = 1 })); } else { return(Json(new { Status = -1 })); } } else { var result = new ThirdPartyCouponConfigManager().InsertThirdPartyCouponConfig(model); if (result > 0) { new OprLogManager().AddOprLog(new OprLog() { Author = HttpContext.User.Identity.Name, BeforeValue = JsonConvert.SerializeObject(model), AfterValue = "", ChangeDatetime = DateTime.Now, ObjectID = result, ObjectType = "Third", Operation = "新增第三方优惠券配置", HostName = Request.UserHostName }); return(Json(new { Status = 1 })); } else { return(Json(new { Status = -1 })); } } // } //catch (Exception e) //{ // throw new Exception(e.Message); //} }
public int InsertThirdPartyCouponConfig(ThirdPartyCouponConfigModel model) { try { return(handler.InsertThirdPartyCouponConfig(model)); } catch (Exception ex) { var exception = new ThirdPartyCouponConfigException(0, "新增第三方优惠券配置失败!", ex); Logger.Log(Level.Error, exception, "Error in InsertThirdPartyCouponConfig."); throw exception; } }
public static int InsertThirdPartyCouponConfig(SqlConnection connection, ThirdPartyCouponConfigModel model) { string sql = @"Insert Configuration.dbo.ThirdPartyCouponConfig values( N'{0}', N'{1}', N'{2}', N'{3}', N'{4}', N'{5}', N'{6}', N'{7}', N'{8}', GETDATE(), GETDATE());SELECT @@IDENTITY"; sql = string.Format(sql, model.ThirdPartyCouponPatch, model.PatchDescription, model.ThirdPartyChannel, model.CouponGetRuleId, model.CouponName, model.CouponDescription, model.CouponDiscount, model.CouponMinMoney, model.CouponEffectDuration); return(Convert.ToInt32(SqlHelper.ExecuteScalar(connection, CommandType.Text, sql))); //} }
public static int UpdateThirdPartyCouponConfig(SqlConnection connection, ThirdPartyCouponConfigModel model) { string sql = @"UPDATE Configuration.dbo.ThirdPartyCouponConfig SET ThirdPartyCouponPatch=N'{0}', PatchDescription=N'{1}', ThirdPartyChannel=N'{2}', CouponGetRuleId=N'{3}', CouponName=N'{4}', CouponDescription=N'{5}', CouponDiscount='{6}', CouponMinMoney= '{7}', CouponEffectDuration=N'{8}', UpdateTime=GETDATE() WHERE PKID={9} " ; sql = string.Format(sql, model.ThirdPartyCouponPatch, model.PatchDescription, model.ThirdPartyChannel, model.CouponGetRuleId, model.CouponName, model.CouponDescription, model.CouponDiscount, model.CouponMinMoney, model.CouponEffectDuration, model.PKID); return(SqlHelper.ExecuteNonQuery(connection, CommandType.Text, sql)); }
public int InsertThirdPartyCouponConfig(ThirdPartyCouponConfigModel model) { return(dbManager.Execute(connection => DalThirdPartyCouponConfig.InsertThirdPartyCouponConfig(connection, model))); }