示例#1
0
        public int Insert(int siteId, int categoryId, int left, int right,
                          string name, string tag, string icon, string pagetitle,
                          string keywords, string description,
                          string location, int orderIndex
                          )
        {
            base.ExecuteNonQuery(
                SqlQueryHelper.Create(DbSql.CategoryInsert,
                                      new object[, ] {
                { "@categoryId", categoryId },
                { "@siteId", siteId },
                { "@lft", left },
                { "@rgt", right },
                { "@name", name },
                { "@tag", tag },
                { "@icon", icon },
                { "@pagetitle", pagetitle },
                { "@keywords", keywords },
                { "@description", description },
                { "@sortNumber", orderIndex },
                { "@location", location }
            })
                );

            return(int.Parse(base.ExecuteScalar(SqlQueryHelper.Create(
                                                    "SELECT MAX(id) FROM $PREFIX_category WHERE site_id=@siteId",
                                                    new object[, ] {
                { "@siteId", siteId }
            })).ToString()));
        }
示例#2
0
        public Error SaveCategory(CmsCategoryEntity category)
        {
            IDictionary <String, object> data = new Dictionary <string, object>();

            data.Add("@tag", category.Tag);
            data.Add("@site_id", category.SiteId);
            data.Add("@parent_id", category.ParentId);
            data.Add("@code", category.Code);
            data.Add("@path", category.Path);
            data.Add("@flag", category.Flag);
            data.Add("@module_id", category.ModuleId);
            data.Add("@name", category.Name);
            data.Add("@icon", category.Icon);
            data.Add("@page_title", category.Title);
            data.Add("@page_keywords", category.Keywords);
            data.Add("@page_description", category.Description);
            data.Add("@location", category.Location);
            data.Add("@sort_number", category.SortNumber);
            data.Add("@id", category.ID);
            if (category.ID <= 0)
            {
                base.ExecuteNonQuery(SqlQueryHelper.Create(DbSql.CategoryInsert, data));
                category.ID = this.GetMaxCategoryId(category.SiteId);
            }
            else
            {
                base.ExecuteNonQuery(base.CreateQuery(DbSql.CategoryUpdate, data));
            }
            return(null);
        }
示例#3
0
 /// <summary>
 /// 删除栏目包含子栏目
 /// </summary>
 /// <returns></returns>
 public bool DeleteSelfAndChildCategoy(int siteId, int lft, int rgt)
 {
     return(base.ExecuteNonQuery(
                SqlQueryHelper.Create(DbSql.Category_DeleteByLft,
                                      new object[, ]
     {
         { "@siteId", siteId },
         { "@lft", lft },
         { "@rgt", rgt }
     })) >= 1);
 }
示例#4
0
        public int GetMaxRight(int siteId)
        {
            object obj = base.ExecuteScalar(
                SqlQueryHelper.Create(DbSql.Category_GetMaxRight,
                                      new object[, ] {
                { "@siteId", siteId }
            }
                                      ));

            if (obj == null)
            {
                return(1);
            }
            return(int.Parse(obj.ToString()));
        }
示例#5
0
 /// <summary>
 /// 更新栏目
 /// </summary>
 public bool Update(int id, int siteId, string name,
                    string tag, string icon, string pagetitle, string keywords,
                    string description, string location, int orderIndex)
 {
     return(base.ExecuteNonQuery(
                SqlQueryHelper.Create(DbSql.CategoryUpdate,
                                      new object[, ] {
         { "@siteId", siteId },
         { "@name", name },
         { "@tag", tag },
         { "@icon", icon },
         { "@pagetitle", pagetitle },
         { "@keywords", keywords },
         { "@description", description },
         { "@location", location },
         { "@sortNumber", orderIndex },
         { "@id", id }
     })) == 1);
 }