Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        //constructor
        public CategoryFacade(string catId, ApiContext apiContext, AttributesMaster attrMaster, SiteFacade siteFacade)
        {
            this.catId = catId;
            this.apiContext = apiContext;
            this.attrMaster = attrMaster;
            this.siteFacade = siteFacade;

            this.SyncCategoryMetaData();
        }
Exemplo n.º 3
0
        /// <summary>
        /// get all attributes from the charactersic with which the specific category is mapping
        /// </summary>
        /// <param name="categoryId"></param>
        /// <param name="apiContext"></param>
        /// <returns></returns>
        private static AttributeSetTypeCollection GetAttributeSetCol(int categoryId,ApiContext apiContext)
        {
            IAttributesMaster attributesMaster=new AttributesMaster();
            AttributeSetTypeCollection attributeSTC=new AttributeSetTypeCollection();

            attributesMaster.CategoryCSProvider=new CategoryCSDownloader(apiContext);
            attributesMaster.XmlProvider=new AttributesXmlDownloader(apiContext);
            //get the characteristic set id of the specified category
            IAttributeSetCollection attributeSetCol=attributesMaster.GetItemSpecificAttributeSetsForCategories(new Int32Collection(new int[]{categoryId}));

            Assert.IsNotNull(attributeSetCol);

            IAttributesXmlProvider iaxp=attributesMaster.XmlProvider;
            //download all attributes from ebay
            XmlDocument document=iaxp.DownloadXml();
            //write the memory xml to disk
            WriteXMLToDisk(document);
            AttributeSetTypeCollection attributeSetTypeCol=new AttributeSetTypeCollection();
            //get Required Item specifics by call getAttributesCS
            foreach(AttributeSet attributeSet in attributeSetCol)
            {
                AttributeSetType attributeST=new AttributeSetType();
                attributeST.attributeSetID=attributeSet.attributeSetID;
                String xpath="//Characteristics/CharacteristicsSet[@id='"+attributeSet.attributeSetID.ToString()+"']//CharacteristicsList//Initial//Attribute";
                XmlNodeList nodeList;
                XmlNode root = document.DocumentElement;
                nodeList=root.SelectNodes(xpath);
                AttributeTypeCollection attributeTypeCol=new AttributeTypeCollection();
                foreach (XmlNode node in nodeList)
                {
                    AttributeType attributeT=new AttributeType();
                    XmlAttributeCollection attributes=node.Attributes;
                    Assert.IsNotNull(attributes);
                 	XmlNode idNode = attributes.GetNamedItem("id");
                    attributeT.attributeID=int.Parse(idNode.Value);
                    ValTypeCollection valTypeCol=getValue(node);
                    if(valTypeCol==null)
                    {
                        System.Console.WriteLine("can not find any specific value!");
                    }
                    attributeT.Value=valTypeCol;
                    attributeTypeCol.Add(attributeT);
                }

                attributeST.Attribute=attributeTypeCol;
                attributeSTC.Add(attributeST);
            }
            return attributeSTC;
        }
 public void init()
 {
     master = new AttributesMaster();
     catCsDownloader = new CategoryCSDownloader(apiContext);
     master.CategoryCSProvider = catCsDownloader;
     xmlDownLoader = new AttributesXmlDownloader(apiContext);
     master.XmlProvider = xmlDownLoader;
     xslDownLoader = new AttributesXslDownloader(apiContext);
     master.XslProvider = xslDownLoader;
 }
Exemplo n.º 5
0
        /// <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;
        }
Exemplo n.º 6
0
        /// <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;
        }