/// <summary> /// 编辑三方商城记录 /// </summary> /// <param name="thirdMall"></param> /// <returns></returns> public static int EditThirdMall(ThirdPartyMallModel thirdMall) { const string sql = @"UPDATE Configuration.dbo.ThirdPartyMallConfig SET IsEnabled = @IsEnabled , Sort = @Sort , ImageUrl = @ImageUrl , Description = @Description , StartDateTime = @StartDateTime , EndDateTime = @EndDateTime , UpdateDateTime = GETDATE() WHERE PKID = @PKID;"; var sqlParameter = new[] { new SqlParameter("@PKID", thirdMall.PKID), new SqlParameter("@Description", thirdMall.Description), new SqlParameter("@IsEnabled", thirdMall.IsEnabled), new SqlParameter("@Sort", thirdMall.Sort), new SqlParameter("@ImageUrl", thirdMall.ImageUrl), new SqlParameter("@StartDateTime", thirdMall.StartDateTime), new SqlParameter("@EndDateTime", thirdMall.EndDateTime) }; return(SqlHelper.ExecuteNonQuery(Connfig, CommandType.Text, sql, sqlParameter)); }
/// <summary> /// 增加三方商城记录 /// </summary> /// <param name="thirdMall"></param> /// <returns></returns> public static int InserThirdMall(ThirdPartyMallModel thirdMall) { const string sql = @"INSERT INTO Configuration.dbo.ThirdPartyMallConfig ( BatchGuid , BatchName , IsEnabled , Sort , ImageUrl , Description , StartDateTime , EndDateTime , CreateDateTime , UpdateDateTime ) VALUES ( @BatchGuid , -- BatchGuid - uniqueidentifier @BatchName , -- BatchName - nvarchar(100) @IsEnabled , -- IsEnabled - bit @Sort , -- Sort - int @ImageUrl , -- ImageUrl - nvarchar(1000) @Description , -- Description - nvarchar(1000) @StartDateTime , -- StartDateTime - datetime @EndDateTime , -- EndDateTime - datetime GETDATE() , -- CreateDateTime - datetime GETDATE() -- UpdateDateTime - datetime ) SELECT @@IDENTITY "; var sqlParameter = new[] { new SqlParameter("@BatchGuid", thirdMall.BatchGuid), new SqlParameter("@BatchName", thirdMall.BatchName), new SqlParameter("@IsEnabled", thirdMall.IsEnabled), new SqlParameter("@Sort", thirdMall.Sort), new SqlParameter("@ImageUrl", thirdMall.ImageUrl), new SqlParameter("@StartDateTime", thirdMall.StartDateTime), new SqlParameter("@EndDateTime", thirdMall.EndDateTime), new SqlParameter("@Description", thirdMall.Description) }; var result = SqlHelper.ExecuteScalar(Connfig, CommandType.Text, sql, sqlParameter); return(Convert.ToInt32(result)); }
/// <summary> /// 编辑三方商城记录 /// </summary> /// <param name="codeBatch"></param> /// <returns></returns> public static int EditThirdMall(ThirdPartyMallModel thirdMall) { try { return(DalThirdPartyMall.EditThirdMall(thirdMall)); } catch (TuhuBizException) { throw; } catch (Exception ex) { var exception = new ThirdPartyMallConfigException(1, "EditThirdMall", ex); Logger.Log(Level.Error, exception, "EditThirdMall"); throw ex; } }
public JsonResult Operate(string type, string branchId, string branchName, bool?isEnabled, int?sort, int?limitQty, int?batchQty, DateTime?startDateTime, DateTime?endDateTime, string description, string ImageUrl, int pkid) { int result = -1; if (ControllerContext.HttpContext.User == null) { return(Json(new { result = "请重新登录!" })); } ThirdPartyMallModel thirdMall = new ThirdPartyMallModel() { PKID = pkid, BatchName = branchName, BatchQty = batchQty, IsEnabled = isEnabled, Sort = sort, LimitQty = limitQty, Description = description, StartDateTime = startDateTime, EndDateTime = endDateTime, ImageUrl = ImageUrl, CreateDateTime = DateTime.Now, UpdateDateTime = DateTime.Now, operater = ControllerContext.HttpContext.User.Identity.Name, BatchGuid = new Guid(branchId) }; switch (type) { case "insert": result = ThirdPartyMallConfigManage.InserThirdMall(thirdMall); if (result > 0) { new OprLogManager().AddOprLog(new OprLog() { Author = HttpContext.User.Identity.Name, AfterValue = JsonConvert.SerializeObject(thirdMall), ChangeDatetime = DateTime.Now, ObjectID = result, ObjectType = "ThirdMall", Operation = "新增三方商城记录", HostName = Request.UserHostName }); } break; case "update": result = ThirdPartyMallConfigManage.EditThirdMall(thirdMall); new OprLogManager().AddOprLog(new OprLog() { Author = HttpContext.User.Identity.Name, AfterValue = JsonConvert.SerializeObject(thirdMall), ChangeDatetime = DateTime.Now, ObjectID = thirdMall.PKID, ObjectType = "ThirdMall", Operation = "编辑三方商城记录", HostName = Request.UserHostName }); break; } return(Json(new { msg = result })); }