Esempio n. 1
1
        private NameRecommendationTypeCollection getCategorySpecific()
        {
            ApiContext asn = (ApiContext)Session[Global.APISESSION];
            GetCategorySpecificsCall api = new GetCategorySpecificsCall(asn);
            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {DetailLevelCodeType.ReturnAll};
            api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
            eBay.Service.Core.Soap.StringCollection strCol=new eBay.Service.Core.Soap.StringCollection();
            strCol.Add(Session["CategoryId"].ToString());
            api.CategoryIDList=strCol;
            api.Execute();

            NameRecommendationTypeCollection nameRecommendationTypes=null;
            if ((api.ApiResponse.Ack==AckCodeType.Success || api.ApiResponse.Ack==AckCodeType.Warning)
                    &&	api.ApiResponse.Recommendations!=null
                    &&	api.ApiResponse.Recommendations.Count>0)
            {
                nameRecommendationTypes = api.ApiResponse.Recommendations[0].NameRecommendation;
            }

            return nameRecommendationTypes;
        }
        public void GetCategorySpecifics()
        {
            GetCategorySpecificsCall api = new GetCategorySpecificsCall(this.apiContext);
            StringCollection catList = new StringCollection();
            int number;
            CategoryTypeCollection categories;
            RecommendationsTypeCollection recommendations;

            number=1;
            getCatList(number,ref catList,out categories);
            // Make API call.
            api.GetCategorySpecifics(catList);
            //check whether the call is success.
            Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!");
            recommendations = api.RecommendationList;
            Assert.IsNotNull(recommendations);
            Assert.IsTrue(recommendations.Count >= 0);

            number=3;
            getCatList(number,ref catList,out categories);
            // Make API call.
            api.GetCategorySpecifics(catList);
            //check whether the call is success.
            Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!");
            recommendations = api.RecommendationList;
            Assert.IsNotNull(recommendations);
            Assert.IsTrue(recommendations.Count >= 0);

            api.Name="Product Type";
            // Make API call.
            api.GetCategorySpecifics(catList);
            //check whether the call is success.
            Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!");
            recommendations = api.RecommendationList;
            Assert.IsNotNull(recommendations);
            Assert.IsTrue(recommendations.Count >= 0);

            DateTime dateTime=new DateTime(2005,1,1);
            api.LastUpdateTime=dateTime;
            // Make API call.
            api.GetCategorySpecifics(catList);
            //check whether the call is success.
            Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!");
            recommendations = api.RecommendationList;
            Assert.IsNotNull(recommendations);
        }
        private void SyncNameRecommendationTypes()
        {
            GetCategorySpecificsCall api = new GetCategorySpecificsCall(this.apiContext);
            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll };
            api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
            eBay.Service.Core.Soap.StringCollection strCol = new eBay.Service.Core.Soap.StringCollection();
            strCol.Add(this.CategoryID);
            api.CategoryIDList = strCol;
            api.Execute();

            NameRecommendationTypeCollection nameRecommendationTypes = null;
            if ((api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning)
                    && api.ApiResponse.Recommendations != null
                    && api.ApiResponse.Recommendations.Count > 0)
            {
                nameRecommendationTypes = api.ApiResponse.Recommendations[0].NameRecommendation;
            }

            this.nameRecommendationTypes = nameRecommendationTypes;
        }