//get all categories
		public static CategoryTypeCollection GetAllCategories(ApiContext apiContext) 
		{
			CategoriesDownloader downloader = new CategoriesDownloader(apiContext);
			CategoryTypeCollection catsCol = downloader.GetAllCategories();
			
			//cache the categories in hashtable
			foreach(CategoryType cat in catsCol)
			{
				catsTable.Add(cat.CategoryID, cat);
			}
			
			return catsCol;
		}
Esempio n. 2
0
        //get all categories table
        public Hashtable GetAllCategoriesTable()
        {
            if (!siteCategoriesTable.ContainsKey(apiContext.Site))
            {
                Hashtable catsTable = new Hashtable(TABLE_SIZE);
                CategoriesDownloader downloader = new CategoriesDownloader(apiContext);
                CategoryTypeCollection catsCol = downloader.GetAllCategories();

                foreach (CategoryType cat in catsCol)
                {
                    catsTable.Add(cat.CategoryID, cat);
                }
                siteCategoriesTable.Add(apiContext.Site, catsTable);
                return catsTable;
            }
            else
            {
                return siteCategoriesTable[apiContext.Site] as Hashtable;
            }
        }