Exemplo n.º 1
0
 public static System.Data.DataTable GetCategoryisChirldren(int categoryId)
 {
     System.Data.DataTable categories = CatalogHelper.GetCategories();
     System.Data.DataTable dataTable  = categories.Clone();
     if (categoryId > 0)
     {
         CategoryInfo          category = CatalogHelper.GetCategory(categoryId);
         System.Data.DataRow[] array    = categories.Select(string.Concat(new object[]
         {
             "CategoryId=",
             categoryId,
             " OR [Path] like '",
             category.Path,
             "|%'"
         }));
         dataTable.Rows.Clear();
         for (int i = 0; i < array.Length; i++)
         {
             dataTable.Rows.Add(array[i].ItemArray);
         }
     }
     return(dataTable);
 }
Exemplo n.º 2
0
        public static string GetFullCategory(int categoryId)
        {
            CategoryInfo category = CatalogHelper.GetCategory(categoryId);
            string       result;

            if (category == null)
            {
                result = null;
            }
            else
            {
                string text = category.Name;
                while (category != null && category.ParentCategoryId.HasValue)
                {
                    category = CatalogHelper.GetCategory(category.ParentCategoryId.Value);
                    if (category != null)
                    {
                        text = category.Name + " &raquo; " + text;
                    }
                }
                result = text;
            }
            return(result);
        }