Exemplo n.º 1
0
        private static void FetchCategoriesRecursively(bool recursing, List <ProductCategory> list, int categoryId, string levelPrefix)
        {
            List <ProductCategory> categoriesByParentID = ProductCategories.GetCategoriesByParentID(categoryId);

            if (categoriesByParentID != null)
            {
                categoryId.ToString();
                foreach (ProductCategory category in categoriesByParentID)
                {
                    list.Add(new ProductCategory
                    {
                        CategoryHtmlName    = category.CategoryName,
                        CategoryID          = category.CategoryID,
                        NumActiveProducts   = category.NumActiveProducts,
                        NameWithActiveCount = string.Format("{0} ({1})", category.CategoryName, category.NumActiveProducts),
                        LevelIndentedName   = levelPrefix + " " + category.CategoryName
                    });

                    if (recursing)
                    {
                        FetchCategoriesRecursively(recursing, list, category.CategoryID, levelPrefix + "--");
                    }
                }
            }
        }
Exemplo n.º 2
0
 private static void ClearSueetieProductListTreeCache()
 {
     foreach (ProductCategory category in ProductCategories.GetProductCategoryList())
     {
         SueetieCache.Current.Remove(string.Format("SueetieProductList-{0}", category.CategoryID));
     }
 }
Exemplo n.º 3
0
 protected override void OnPreInit(EventArgs e)
 {
     if (DataHelper.GetIntFromQueryString("c", -1) > 0)
     {
         this.CurrentProductCategory = ProductCategories.GetProductCategory(int.Parse(base.Request.QueryString["c"].ToString()));
     }
     if (DataHelper.GetIntFromQueryString("id", -1) > 0)
     {
         this.CurrentSueetieProduct  = Products.GetSueetieProduct(int.Parse(base.Request.QueryString["id"].ToString()));
         this.CurrentProductCategory = ProductCategories.GetProductCategory(this.CurrentSueetieProduct.CategoryID);
     }
     base.OnPreInit(e);
 }
Exemplo n.º 4
0
        protected override void OnPreInit(EventArgs e)
        {
            if (DataHelper.GetIntFromQueryString("c", -1) > 0)
            {
                this.CurrentProductCategory = ProductCategories.GetProductCategory(int.Parse(base.Request.QueryString["c"].ToString()));
            }
            if (DataHelper.GetIntFromQueryString("id", -1) > 0)
            {
                this.CurrentSueetieProduct  = Products.GetSueetieProduct(int.Parse(base.Request.QueryString["id"].ToString()));
                this.CurrentProductCategory = ProductCategories.GetProductCategory(this.CurrentSueetieProduct.CategoryID);
            }
            string str = this.SueetieMasterPage ?? "marketplace.master";

            this.MasterPageFile = "~/themes/" + SueetieContext.Current.SiteSettings.Theme + "/masters/" + str;
            base.OnPreInit(e);
        }
Exemplo n.º 5
0
        private static List <ProductCategory> FetchParentCategoriesById(int categoryID)
        {
            List <ProductCategory> list = new List <ProductCategory>();

            foreach (ParentCategory category in ProductCategories.GetParentCategoriesByID(categoryID))
            {
                int             num  = 0;
                ProductCategory item = new ProductCategory
                {
                    CategoryID          = category.CategoryID,
                    ParentCategoryID    = num,
                    CategoryHtmlName    = category.ParentCategoryName,
                    NumActiveProducts   = category.NumActiveProducts,
                    NameWithActiveCount = string.Format("{0} ({1})", category.ParentCategoryName, category.NumActiveProducts),
                    LevelIndentedName   = string.Empty
                };
                list.Add(item);
            }
            return(list);
        }
Exemplo n.º 6
0
 public static void ClearCategoryCache()
 {
     SueetieCache.Current.Remove("CategoryCache_AllCategoriesKey");
     ProductCategories.ClearProductCategoryListCache();
 }