/// <summary> /// 修改下单完成页广告配置 /// </summary> /// <param name="conn"></param> /// <param name="model"></param> /// <returns></returns> public bool UpdatePaymentPageConfig(SqlConnection conn, PaymentPageConfigModel model) { #region SQL string sql = @" UPDATE [dbo].[PaymentPageConfig] WITH(ROWLOCK) SET [Title] = @Title ,[ProvinceID] = @ProvinceID ,[ProvinceName] = @ProvinceName ,[CityID] = @CityID ,[CityName] = @CityName ,[ProductLine] = @ProductLine ,[IsShowConsigneeInfo] = @IsShowConsigneeInfo ,[IsShowAddress] = @IsShowAddress ,[IsShowShop] = @IsShowShop ,[IsShowButton] = @IsShowButton ,[ButtonText] = ISNULL(@ButtonText,'') ,[ButtonUrl] = ISNULL(@ButtonUrl,'') ,[MiniProgramButtonUrl]=ISNULL(@MiniProgramButtonUrl,'') ,[IosButtonUrl]=ISNULL(@IosButtonUrl,'') ,[AndroidButtonUrl]=ISNULL(@AndroidButtonUrl,'') ,[WapButtonUrl]=ISNULL(@WapButtonUrl,'') ,[HuaweiButtonUrl]=ISNULL(@HuaweiButtonUrl,'') ,[Remark] = ISNULL(@Remark,'') ,[Status] = @STATUS ,[Creator] = @Creator ,[LastUpdateDateTime] = GETDATE() WHERE PKID=@PKID "; #endregion return(conn.Execute(sql, model) > 0); }
/// <summary> /// 修改下单完成页广告配置 /// </summary> /// <param name="model"></param> /// <returns></returns> public bool UpdatePaymentPageConfig(PaymentPageConfigModel model) { using (var conn = ProcessConnection.OpenConfiguration) { return(dal.UpdatePaymentPageConfig(conn, model)); } }
/// <summary> /// 新增下单完成页配置 /// </summary> /// <param name="conn"></param> /// <param name="model"></param> /// <returns></returns> public bool AddPaymentPageConfig(SqlConnection conn, PaymentPageConfigModel model) { #region SQL string sql = @" INSERT INTO [Configuration].[dbo].[PaymentPageConfig] WITH(ROWLOCK) ([Title] ,[ProvinceID] ,[ProvinceName] ,[CityID] ,[CityName] ,[ProductLine] ,[IsShowConsigneeInfo] ,[IsShowAddress] ,[IsShowShop] ,[IsShowButton] ,[ButtonText] ,[ButtonUrl] ,[MiniProgramButtonUrl] ,[IosButtonUrl] ,[AndroidButtonUrl] ,[WapButtonUrl] ,[HuaweiButtonUrl] ,[Remark] ,[Status] ,[Creator]) VALUES (@Title ,@ProvinceID ,@ProvinceName ,@CityID ,@CityName ,@ProductLine ,@IsShowConsigneeInfo ,@IsShowAddress ,@IsShowShop ,ISNULL(@IsShowButton,0) ,ISNULL(@ButtonText,'') ,ISNULL(@ButtonUrl,'') ,ISNULL(@MiniProgramButtonUrl,'') ,ISNULL(@IosButtonUrl,'') ,ISNULL(@AndroidButtonUrl,'') ,ISNULL(@WapButtonUrl,'') ,ISNULL(@HuaweiButtonUrl,'') ,ISNULL(@Remark,'') ,@STATUS ,@Creator); SELECT CAST(SCOPE_IDENTITY() as int);"; #endregion model.PKID = conn.Query <int>(sql, model).FirstOrDefault(); if (model.PKID > 0) { return(true); } else { return(false); } }
/// <summary> /// 新增/复制/编辑下单完成页配置 /// </summary> /// <param name="model"></param> /// <returns></returns> public ActionResult AddPaymentPageConfig(PaymentPageConfigModel model) { var manager = new PaymentPageConfigManager(); //根据区域信息和产品线判断配置是否存在 var exsitConfigInfo = manager.GetPaymentPageConfigInfo(model.ProvinceID, model.CityID, model.ProductLine); if (exsitConfigInfo != null && exsitConfigInfo.PKID != model.PKID) { exsitConfigInfo.Status = 0;//禁用 manager.UpdatePaymentPageConfig(exsitConfigInfo); #region 日志记录 using (var client = new ConfigLogClient()) { var response = client.InsertDefaultLogQueue("CommonConfigLog", JsonConvert.SerializeObject(new { ObjectId = exsitConfigInfo.PKID, ObjectType = "PaymentPageConfig", BeforeValue = "", AfterValue = JsonConvert.SerializeObject(exsitConfigInfo), Remark = "禁用下单完成页配置", Creator = User.Identity.Name, })); } #endregion } //新增 if (model.PKID == 0) { model.Status = 1; model.Creator = User.Identity.Name; manager.AddPaymentPageConfig(model); #region 日志记录 using (var client = new ConfigLogClient()) { var response = client.InsertDefaultLogQueue("CommonConfigLog", JsonConvert.SerializeObject(new { ObjectId = model.PKID, ObjectType = "PaymentPageConfig", BeforeValue = "", AfterValue = JsonConvert.SerializeObject(model), Remark = "新增下单完成页配置", Creator = User.Identity.Name, })); } #endregion } //编辑 else { var configInfo = manager.GetPaymentPageConfigInfo(model.PKID); model.Status = 1;//启用 model.Creator = configInfo.Creator; manager.UpdatePaymentPageConfig(model); #region 日志记录 using (var client = new ConfigLogClient()) { var response = client.InsertDefaultLogQueue("CommonConfigLog", JsonConvert.SerializeObject(new { ObjectId = model.PKID, ObjectType = "PaymentPageConfig", BeforeValue = JsonConvert.SerializeObject(configInfo), AfterValue = JsonConvert.SerializeObject(model), Remark = "修改下单完成页配置", Creator = User.Identity.Name, })); } #endregion } //等待1秒,写库同步到读库 Thread.Sleep(1000); return(Content(JsonConvert.SerializeObject(new { state = "success", message = "操作成功", data = "" }))); }