public static IList <CategoryInfo> GetSubCategories(int parentCategoryId) { IList <CategoryInfo> list = new List <CategoryInfo>(); System.Data.DataTable categories = SubsiteCatalogHelper.GetCategories(); System.Data.DataRow[] array = categories.Select("ParentCategoryId = " + parentCategoryId.ToString()); for (int i = 0; i < array.Length; i++) { list.Add(DataMapper.ConvertDataRowToProductCategory(array[i])); } return(list); }
public static IList <CategoryInfo> GetMainCategories() { IList <CategoryInfo> list = new List <CategoryInfo>(); System.Data.DataTable categories = SubsiteCatalogHelper.GetCategories(); System.Data.DataRow[] array = categories.Select("Depth = 1"); for (int i = 0; i < array.Length; i++) { list.Add(DataMapper.ConvertDataRowToProductCategory(array[i])); } return(list); }
public static IList <CategoryInfo> GetSequenceCategories() { IList <CategoryInfo> list = new List <CategoryInfo>(); IList <CategoryInfo> mainCategories = SubsiteCatalogHelper.GetMainCategories(); foreach (CategoryInfo current in mainCategories) { list.Add(current); SubsiteCatalogHelper.LoadSubCategorys(current.CategoryId, list); } return(list); }
private static void LoadSubCategorys(int parentCategoryId, IList <CategoryInfo> categories) { IList <CategoryInfo> subCategories = SubsiteCatalogHelper.GetSubCategories(parentCategoryId); if (subCategories != null && subCategories.Count > 0) { foreach (CategoryInfo current in subCategories) { categories.Add(current); SubsiteCatalogHelper.LoadSubCategorys(current.CategoryId, categories); } } }
public static string GetFullCategory(int categoryId) { CategoryInfo category = SubsiteCatalogHelper.GetCategory(categoryId); string result; if (category == null) { result = null; } else { string text = category.Name; while (category != null && category.ParentCategoryId.HasValue) { category = SubsiteCatalogHelper.GetCategory(category.ParentCategoryId.Value); if (category != null) { text = category.Name + " >> " + text; } } result = text; } return(result); }
public static bool UpdateProductCategory(int productId, int newCategoryId) { bool result; if (newCategoryId != 0) { result = SubsiteProductProvider.Instance().UpdateProductCategory(productId, newCategoryId, SubsiteCatalogHelper.GetCategory(newCategoryId).Path + "|"); } else { result = SubsiteProductProvider.Instance().UpdateProductCategory(productId, newCategoryId, null); } return(result); }