Пример #1
0
        private static int ResolveArticleCategoryCollection(List<ArticleCategory> dbArticleCategorys, ArticleCategory parentArticleCategory, int level)
        {
            int count = 0;
            foreach (var articlecategory in dbArticleCategorys.Where(a => a.Parent == parentArticleCategory))
            {
                count++;

                _articlecategorys.Add(articlecategory);
                articlecategory.TreeLevel = level;
                articlecategory.IsTreeLeaf = true;
                articlecategory.Enabled = true;

                level++;
                // 如果这个节点下没有子节点,则这是个终结节点
                int childCount = ResolveArticleCategoryCollection(dbArticleCategorys, articlecategory, level);
                if (childCount != 0)
                {
                    articlecategory.IsTreeLeaf = false;
                }
                level--;

            }

            return count;
        }
Пример #2
0
 public object Clone()
 {
     ArticleCategory articlecategory = new ArticleCategory
     {
         ID = ID,
         Name = Name,
         sort = sort,
         TreeLevel = TreeLevel,
         Enabled = Enabled,
         IsTreeLeaf = IsTreeLeaf
     };
     return articlecategory;
 }