コード例 #1
0
 private void PrintCategoryFlatList(ECommerce.Ecl.Category category)
 {
     foreach (var subcategory in category.Categories)
     {
         Console.WriteLine(GetCategoryFlatTitle(subcategory));
         PrintCategoryFlatList(subcategory);
     }
 }
コード例 #2
0
 private void PrintCategoryList(ECommerce.Ecl.Category category, int level)
 {
     foreach (var subcategory in category.Categories)
     {
         for (int i = 0; i < level; i++)
         {
             Console.Write("-");
         }
         Console.WriteLine(subcategory.Title + "(" + subcategory.CategoryId + ")");
         PrintCategoryList(subcategory, level + 1);
     }
 }
コード例 #3
0
        private string GetCategoryFlatTitle(ECommerce.Ecl.Category category)
        {
            // Display the full path of the category as title
            //
            String categoryPath = "";

            ECommerce.Ecl.Category currentCategory = category;
            while (currentCategory != null)
            {
                if (currentCategory.Title != null)
                {
                    if (categoryPath.Length > 0l)
                    {
                        categoryPath = "->" + categoryPath;
                    }
                    categoryPath = currentCategory.Title + categoryPath;
                }
                currentCategory = currentCategory.Parent;
            }
            return(categoryPath);
        }