public void GetCategory2CS() { GetCategory2CSCall api = new GetCategory2CSCall(this.apiContext); // Return version only DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll }; api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels); api.CategoryID = "279"; //Children's Book //api.CategoryID = "64355"; //Cell Phones api.Timeout = 300000; string message=string.Empty; // Make API call. CategoryTypeCollection cats = api.GetCategory2CS(); Assert.IsNotNull(cats); Assert.IsNotNull(api.AttributeSystemVersionResponse); int ver = Int32.Parse(api.AttributeSystemVersionResponse); Assert.IsTrue(ver > 0); Assert.IsNotNull(api.SiteWideCharacteristicList); TestData.Category2CS = cats; IAttributesMaster attrMaster = new AttributesMaster(); ICategoryCSProvider catCSDownLoader = new CategoryCSDownloader(apiContext); attrMaster.CategoryCSProvider = catCSDownLoader; int[] catIds = catCSDownLoader.GetSiteWideCharSetsAttrIds("48514"); Assert.IsNotNull(catIds); }
public void init() { catCsDownloader = new CategoryCSDownloader(apiContext); }
/// <summary> /// get an AttributeMaster instance object and set default value to that object /// </summary> /// <returns></returns> private void InitailAttributesMaster() { AttributesMaster amst = new AttributesMaster(); AttributesXmlDownloader axd = new AttributesXmlDownloader(apiContext); amst.XmlProvider = axd; AttributesXslDownloader asd = new AttributesXslDownloader(apiContext); amst.XslProvider = asd; CategoryCSDownloader ctd = new CategoryCSDownloader(apiContext); amst.CategoryCSProvider = ctd; this.attrMaster = amst; }
/** * Get categories using GetCategory2CS and GetCategories calls, * and merge the categories * */ public CategoryTypeCollection GetAllMergedCategories() { if (!siteMergedCategoriesTable.ContainsKey(apiContext.Site)) { //Get all categories that are mapped to characteristics sets CategoryCSDownloader categoryCSDownloader = new CategoryCSDownloader(apiContext); CategoryTypeCollection cats = categoryCSDownloader.GetCategoriesCS(); Hashtable csCatsTable = new Hashtable(); foreach (CategoryType cat in cats) { if (csCatsTable.ContainsKey(cat.CategoryID)) continue; csCatsTable.Add(cat.CategoryID, cat); } //get all categories Hashtable allCatsTable = GetAllCategoriesTable(); foreach (CategoryType cat in allCatsTable.Values) { CategoryType csCat = csCatsTable[cat.CategoryID] as CategoryType; if (csCat != null) { //copy category name and leaf category fields, since these //fields are not set when using GetCategoryCS call. csCat.CategoryName = cat.CategoryName; csCat.LeafCategory = cat.LeafCategory; } else { //some category has no characteristics sets, //but it may has custom item specifics csCatsTable.Add(cat.CategoryID, cat); } } CategoryTypeCollection catCol = new CategoryTypeCollection(); foreach (CategoryType cat in csCatsTable.Values) { catCol.Add(cat); } siteMergedCategoriesTable.Add(apiContext.Site, catCol); return catCol; } else { return siteMergedCategoriesTable[apiContext.Site] as CategoryTypeCollection; } }
/// <summary> /// get an AttributeMaster instance object and set default value to that object /// </summary> /// <returns></returns> private AttributesMaster initailAttributesMaster(ApiContext context) { AttributesMaster amst = new AttributesMaster(); // Set common site for all calls. context.Site = (SiteCodeType)Session[Global.SITE]; //asn.ApiCallCommon.SiteId = (SiteCodeType)Session[Global.SITE]; AttributesXmlDownloader axd = new AttributesXmlDownloader(context); amst.XmlProvider = axd; AttributesXslDownloader asd = new AttributesXslDownloader(context); amst.XslProvider = asd; CategoryCSDownloader ctd = new CategoryCSDownloader(context); amst.CategoryCSProvider = ctd; Session[Global.ATTRIBUTES_MASTER] = amst; return amst; }