public CategoryCollection GetCategoryTreeByProjectId(int projectId) { _SortedCats = new CategoryCollection(); _UnSortedCats = Category.GetCategoryByProjectId(projectId); foreach (Category parentCat in GetTopLevelCategories()) { _SortedCats.Add(parentCat); BindSubCategories(parentCat.Id); } return(_SortedCats); }
CategoryCollection GetChildCategories(int parentId) { CategoryCollection colCats = new CategoryCollection(); foreach (Category cat in _UnSortedCats) { if (cat.ParentCategoryId == parentId) { colCats.Add(cat); } } return(colCats); }
CategoryCollection GetTopLevelCategories() { CategoryCollection colCats = new CategoryCollection(); foreach (Category cat in _UnSortedCats) { if (cat.ParentCategoryId == 0) { colCats.Add(cat); } } return(colCats); }