public static bool Insert(SqlConnection connection, OperationCategoryModel model) { var sql = @" INSERT INTO [Configuration].[dbo].[tbl_OperationCategory] ([ParentId] ,[CategoryCode] ,[DisplayName] ,[Icon] ,[Description] ,[AppKeyForIOS] ,[AppValueForIOS] ,[AppKeyForAndroid] ,[AppValueForAndroid] ,[H5Url] ,[Sort] ,[IsShow] ,[Type] ,[CreateTime] ,WebsiteImage ,IsNeedVehicle ,IsNeedAdpter) VALUES (@ParentId ,@CategoryCode ,@DisplayName ,@Icon ,@Description ,@AppKeyForIOS ,@AppValueForIOS ,@AppKeyForAndroid ,@AppValueForAndroid ,@H5Url ,@Sort ,@IsShow ,@Type ,@CreateTime ,@WebsiteImage ,@IsNeedVehicle ,0)"; var sqlparams = new[] { new SqlParameter("@ParentId", model.ParentId), new SqlParameter("@CategoryCode", model.CategoryCode), new SqlParameter("@DisplayName", model.DisplayName), new SqlParameter("@Icon", model.Icon), new SqlParameter("@Description", model.Description), new SqlParameter("@AppKeyForIOS", model.AppKeyForIOS), new SqlParameter("@AppValueForIOS", model.AppValueForIOS), new SqlParameter("@AppKeyForAndroid", model.AppKeyForAndroid), new SqlParameter("@AppValueForAndroid", model.AppValueForAndroid), new SqlParameter("@H5Url", model.H5Url), new SqlParameter("@Sort", model.Sort), new SqlParameter("@IsShow", model.IsShow), new SqlParameter("@Type", model.Type), new SqlParameter("@CreateTime", model.CreateTime), new SqlParameter("@WebsiteImage", model.WebsiteImage), new SqlParameter("@IsNeedVehicle", model.IsNeedVehicle) }; return(SqlHelper.ExecuteNonQuery(connection, CommandType.Text, sql, sqlparams) > 0); }
public ActionResult SaveCategory(OperationCategoryModel model, int id = 0) { bool result = false; if (id == 0) { model.CreateTime = DateTime.Now; model.Id = id; result = GetManager.Insert(model); if (result) { LoggerManager.InsertOplog(User.Identity.Name, ObjectType, model.Id, "添加车品类目" + model.DisplayName); } } else { model.CreateTime = DateTime.Now; model.Id = id; result = GetManager.Update(model); if (result) { LoggerManager.InsertOplog(User.Identity.Name, ObjectType, model.Id, "修改车品类目" + model.DisplayName); } } return(RedirectToAction("Index")); }
public bool Update(OperationCategoryModel model) { try { return(handler.Update(model)); } catch (Exception ex) { logger.Log(Level.Error, string.Format("方法:{0},错误:{1}", "OperationCategoryManager.Update", ex.Message), model); return(false); } }
public bool Insert(OperationCategoryModel model) { try { return(handler.Insert(model)); } catch (Exception ex) { Logger.Log(Level.Error, string.Format("方法:{0},错误:{1}", "GroupBuyCategoryConfigManager.Insert", ex.Message), model); return(false); } }
public static bool Update(SqlConnection connection, OperationCategoryModel model) { var sql = @" UPDATE [Configuration].[dbo].[tbl_OperationCategory] SET [ParentId] = @ParentId ,[CategoryCode] = @CategoryCode ,[DisplayName] = @DisplayName ,[Icon] = @Icon ,[Description] = @Description ,[AppKeyForIOS] = @AppKeyForIOS ,[AppValueForIOS] = @AppValueForIOS ,[AppKeyForAndroid] = @AppKeyForAndroid ,[AppValueForAndroid] = @AppValueForAndroid ,[H5Url] = @H5Url ,[Sort] = @Sort ,[IsShow] = @IsShow ,[Type] = @Type ,[CreateTime] = @CreateTime ,WebsiteImage = @WebsiteImage ,IsNeedVehicle = @IsNeedVehicle WHERE Id = @Id"; var sqlparams = new[] { new SqlParameter("@ParentId", model.ParentId), new SqlParameter("@CategoryCode", model.CategoryCode), new SqlParameter("@DisplayName", model.DisplayName), new SqlParameter("@Icon", model.Icon), new SqlParameter("@Description", model.Description), new SqlParameter("@AppKeyForIOS", model.AppKeyForIOS), new SqlParameter("@AppValueForIOS", model.AppValueForIOS), new SqlParameter("@AppKeyForAndroid", model.AppKeyForAndroid), new SqlParameter("@AppValueForAndroid", model.AppValueForAndroid), new SqlParameter("@H5Url", model.H5Url), new SqlParameter("@Sort", model.Sort), new SqlParameter("@IsShow", model.IsShow), new SqlParameter("@Type", model.Type), new SqlParameter("@CreateTime", model.CreateTime), new SqlParameter("@Id", model.Id), new SqlParameter("@WebsiteImage", model.WebsiteImage), new SqlParameter("@IsNeedVehicle", model.IsNeedVehicle) }; return(SqlHelper.ExecuteNonQuery(connection, CommandType.Text, sql, sqlparams) > 0); }
/// <summary> /// 添加&编辑类目 /// </summary> /// <param name="id"></param> /// <param name="parentId"></param> /// <param name="type"></param> /// <returns></returns> public ActionResult AddOrEditCategory(int id = 0, int parentId = 0, int type = 0) { OperationCategoryModel ocModel = new OperationCategoryModel(); if (id != 0) { ViewBag.Title = "修改"; ocModel = GetManager.Select(id).FirstOrDefault(); ocModel.Type = type; return(View(ocModel)); } else { ViewBag.Title = "新增"; ocModel.Id = 0; ocModel.ParentId = parentId; ocModel.Type = type; return(View(ocModel)); } }
public bool Update(OperationCategoryModel model) { Func <SqlConnection, bool> action = (connection) => DalGroupBuyCategoryConfig.Update(connection, model); return(dbManager.Execute(action)); }
public bool Update(OperationCategoryModel model) { Func <SqlConnection, bool> action = (connection) => OperationCategoryDAL.Update(connection, model); return(dbManager.Execute(action)); }