Ejemplo n.º 1
0
        //public static List<CategoryNode> GetCategoryNodeTree()
        //{
        //    List<CategoryNode> cats = new List<CategoryNode>();
        //    cats.AddRange(GetTopLevelCategories().ConvertAll(c => new CategoryNode() { Category = c }));

        //    foreach (CategoryNode parentInfo in cats)
        //    {
        //        AddChildCategoryNodesRecursive(parentInfo);
        //    }

        //    return cats;
        //}

        //private static void AddChildCategoryNodesRecursive(CategoryNode parentInfo)
        //{
        //    parentInfo.SubCategories = ((List<Category>)parentInfo.Category.GetChildCategoriesInSortedOrder()).ConvertAll(c => new CategoryNode() { Category = c });

        //    foreach (CategoryNode child in parentInfo.SubCategories)
        //    {
        //        AddChildCategoryNodesRecursive(child);
        //    }
        //}

        internal static void UpdateAllNestingLevels()
        {
            CategoryCollection allCategories = new CategoryCollection();

            allCategories.LoadAll();

            foreach (Category cat in allCategories)
            {
                cat.NestingLevel = cat.GetNestingLevel();
            }
            allCategories.Save();
        }