예제 #1
0
        public static bool Insert(SqlConnection sqlconnection, CategoryTagModel model)
        {
            const string sql = @"INSERT  INTO Marketing.dbo.HD_CategoryTag
                                    ( parentId ,
                                      isParent ,
                                      name ,
                                      code ,
                                      describe ,
                                      image ,
                                      disable ,
                                      sort ,
                                      type ,
                                      topicsId ,
                                      isHomePage ,
                                      createTime ,
                                      nickName ,
                                      showNum ,
                                      isShowList
                                    )
                            VALUES  ( @parentId ,
                                      @isParent ,
                                      @name ,
                                      @code ,
                                      @describe ,
                                      @image ,
                                      @disable ,
                                      @sort ,
                                      @type ,
                                      @topicsId ,
                                      @isHomePage ,
                                      @createTime ,
                                      @nickName ,
                                      @showNum ,
                                      @isShowList
                                    )";

            var sqlpara = new SqlParameter[] {
                new SqlParameter("@parentId", model.parentId),
                new SqlParameter("@isParent", model.isParent),
                new SqlParameter("@name", model.name),
                new SqlParameter("@code", model.code),
                new SqlParameter("@describe", model.describe),
                new SqlParameter("@image", model.image),
                new SqlParameter("@disable", model.disable),
                new SqlParameter("@sort", model.sort),
                new SqlParameter("@type", model.type),
                new SqlParameter("@topicsId", model.topicsId),
                new SqlParameter("@isHomePage", model.isHomePage),
                new SqlParameter("@createTime", model.createTime),
                new SqlParameter("@nickName", model.nickName ?? string.Empty),
                new SqlParameter("@showNum", model.showNum),
                new SqlParameter("@isShowList", model.isShowList)
            };

            return(SqlHelper.ExecuteNonQuery(sqlconnection, CommandType.Text, sql, sqlpara) > 0 ? true : false);
        }
        public ActionResult SaveBigModule(CategoryTagModel model, int id = 0, int parentId = 0)
        {
            bool result = false;

            if (id == 0)
            {
                result = GetManager.Insert(model);
            }
            else
            {
                model.updateTime = DateTime.Now;
                model.parentId   = (parentId == 0 ? 0 : parentId);
                result           = GetManager.UpdateById(model);
            }
            return(RedirectToAction("Index"));
        }
예제 #3
0
        public static bool UpdateById(SqlConnection sqlconnection, CategoryTagModel model)
        {
            string sql = @"update Marketing.dbo.HD_CategoryTag
                        set parentId=@parentId,
                        isParent=@isParent,
                        name=@name,
                        code=@code,
                        describe=@describe,
                        image=@image,
                        disable=@disable,
                        sort=@sort,
                        type=@type,
                        topicsId=@topicsId,
                        isHomePage=@isHomePage,
                        createTime=@createTime,
                        nickName=@nickName,
                        showNum=@showNum,
                        isShowList=@isShowList
                        WHERE id = @id";

            var sqlpara = new SqlParameter[] {
                new SqlParameter("@parentId", model.parentId),
                new SqlParameter("@isParent", model.isParent),
                new SqlParameter("@name", model.name),
                new SqlParameter("@code", model.code),
                new SqlParameter("@describe", model.describe),
                new SqlParameter("@image", model.image),
                new SqlParameter("@disable", model.disable),
                new SqlParameter("@sort", model.sort),
                new SqlParameter("@type", model.type),
                new SqlParameter("@topicsId", model.topicsId),
                new SqlParameter("@isHomePage", model.isHomePage),
                new SqlParameter("@createTime", model.createTime),
                new SqlParameter("@id", model.id),
                new SqlParameter("@nickName", model.nickName ?? string.Empty),
                new SqlParameter("@showNum", model.showNum),
                new SqlParameter("@isShowList", model.isShowList)
            };

            return(SqlHelper.ExecuteNonQuery(sqlconnection, CommandType.Text, sql, sqlpara) > 0 ? true : false);
        }
        public ActionResult BigModule(int id = 0, int parentId = 0, int isAddParent = 0, int isAddChild = 0)
        {
            if (id != 0 && isAddChild == 0 && isAddParent == 0)
            {
                ViewBag.Title = "修改";

                if (GetManager.IsVehicle(id))
                {
                    ViewBag.VehicleList = GetManager.SelectByPID(2, 0, "name");
                }

                CategoryTagModel ctag = GetManager.SelectById(id).FirstOrDefault();
                ctag.updateTime = DateTime.Now;
                ctag.parentId   = parentId;
                return(View(ctag));
            }
            else if (id == 0 && parentId == 0 && isAddParent == 1 && isAddChild == 0)
            {
                ViewBag.Title = "新增父标签";
                CategoryTagModel ctag = new CategoryTagModel()
                {
                    isParent   = true,
                    parentId   = 0,
                    createTime = DateTime.Now,
                    updateTime = DateTime.Now
                };
                return(View(ctag));
            }
            else
            {
                ViewBag.Title = "新增子标签";
                CategoryTagModel ctag = new CategoryTagModel()
                {
                    isParent   = false,
                    parentId   = parentId,
                    createTime = DateTime.Now,
                    updateTime = DateTime.Now
                };
                return(View(ctag));
            }
        }
예제 #5
0
 public bool UpdateById(CategoryTagModel model)
 {
     return(handler.UpdateById(model));
 }
예제 #6
0
 public bool Insert(CategoryTagModel model)
 {
     return(handler.Insert(model));
 }
        public bool UpdateById(CategoryTagModel model)
        {
            Func <SqlConnection, bool> action = (connection) => DALCategoryTag.UpdateById(connection, model);

            return(dbManager.Execute(action));
        }