//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); }
//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); } siteMergedCategoriesTable.Add(apiContext.Site, catsCol); siteCategoriesTable.Add(apiContext.Site, catsTable); return(catsTable); } else { return(siteCategoriesTable[apiContext.Site] as Hashtable); } }