示例#1
0
        private void getCategoryFeatures()
        {
            GetCategoryFeaturesCall       api          = new GetCategoryFeaturesCall(_apiContext);
            DetailLevelCodeTypeCollection detailLevels = new DetailLevelCodeTypeCollection(new DetailLevelCodeType[] { DetailLevelCodeType.ReturnAll });

            api.DetailLevelList = detailLevels;

            // Make API call.
            api.GetCategoryFeatures(_categoryID, _levelLimit, _viewAllNodes, _featureIDs, _allFeaturesForCategory);
            _categoryFeatures = api.CategoryList;
            _categoryVersion  = api.CategoryVersion;
            _siteDefaults     = api.SiteDefaults;
            _siteFeatures     = api.FeatureDefinitions;
        }
		public static void GetAllCategoriesFeatures(ApiContext context)
		{
			FeaturesDownloader downloader = new FeaturesDownloader(context);
			GetCategoryFeaturesResponseType resp = downloader.GetCategoryFeatures();
			CategoryFeatureTypeCollection cfCol = resp.Category;
				
			//cache the features in hashtable	
			foreach(CategoryFeatureType cf in cfCol)
			{
				cfsTable.Add(cf.CategoryID, cf);
			}
			
			//cache site defaults
			siteDefaults = resp.SiteDefaults;
			//cahce feature definitions
			featureDefinition = resp.FeatureDefinitions;
		}
        public static void GetAllCategoriesFeatures(ApiContext context)
        {
            FeaturesDownloader downloader         = new FeaturesDownloader(context);
            GetCategoryFeaturesResponseType resp  = downloader.GetCategoryFeatures();
            CategoryFeatureTypeCollection   cfCol = resp.Category;

            //cache the features in hashtable
            foreach (CategoryFeatureType cf in cfCol)
            {
                cfsTable.Add(cf.CategoryID, cf);
            }

            //cache site defaults
            siteDefaults = resp.SiteDefaults;
            //cahce feature definitions
            featureDefinition = resp.FeatureDefinitions;
        }
示例#4
0
        public void GetCategoryFeatures()
        {
            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext);

            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
                DetailLevelCodeType.ReturnAll
            };
            api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
            api.LevelLimit      = 1;
            api.ViewAllNodes    = true;
            // Make API call.
            CategoryFeatureTypeCollection features = api.GetCategoryFeatures();

            //check whether the call is success.
            Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success, "the call is failure!");
            Assert.IsNotNull(features);
            Assert.IsTrue(features.Count > 0);
            Assert.IsNotNull(api.ApiResponse.CategoryVersion);

            // Testing GetCategoryFeaturesHelper
            this.apiContext.Site = SiteCodeType.Austria;
            GetCategoryFeaturesHelper helper = new GetCategoryFeaturesHelper(this.apiContext);

            Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.Austria));
            this.apiContext.Site = SiteCodeType.China;
            helper.loadCategoryFeatures(this.apiContext);
            Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.Austria));
            Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.China));
            this.apiContext.Site = SiteCodeType.US;
            helper.loadCategoryFeatures(this.apiContext);
            Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.Austria));
            Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.China));
            Assert.IsTrue(helper.hasCategoryFeatures(SiteCodeType.US));
            //
            FeatureDefinitionsType USFeatures = helper.getSiteFeatures(SiteCodeType.US);

            Assert.IsNotNull(USFeatures);
            System.Console.WriteLine(USFeatures.ToString());
        }
	 private void getCategoryFeatures() {
		 GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(_apiContext);
		 DetailLevelCodeTypeCollection detailLevels = new DetailLevelCodeTypeCollection( new DetailLevelCodeType[] {DetailLevelCodeType.ReturnAll});
		 api.DetailLevelList = detailLevels;

		 // Make API call.
         api.GetCategoryFeatures(_categoryID, _levelLimit, _viewAllNodes, _featureIDs, _allFeaturesForCategory);
		 _categoryFeatures = api.CategoryList;
		 _categoryVersion = api.CategoryVersion;
		 _siteDefaults = api.SiteDefaults;
		 _siteFeatures = api.FeatureDefinitions;
	 }
示例#6
0
        //
        //sync category features
        //
        private void SyncCategoryFeatures()
        {
            Hashtable catsTable = this.siteFacade.GetAllCategoriesTable();

            Hashtable              cfsTable          = this.siteFacade.SiteCategoriesFeaturesTable[this.apiContext.Site] as Hashtable;
            SiteDefaultsType       siteDefaults      = this.siteFacade.SiteFeatureDefaultTable[this.apiContext.Site] as SiteDefaultsType;
            FeatureDefinitionsType featureDefinition = this.siteFacade.SiteFeatureDefinitionsTable[this.apiContext.Site] as FeatureDefinitionsType;


            CategoryFeatureType cf = cfsTable[this.CategoryID] as CategoryFeatureType;

            //get item SpecificsEnabled feature
            //workaround, if no CategoryFeature found, just use site defaults
            this.ItemSpecificEnabled = (cf == null) ? siteDefaults.ItemSpecificsEnabled : cf.ItemSpecificsEnabled;

            //get item ConditionEnabled feature
            //workaround, if Disabled, just check parent
            CategoryFeatureType conditionEnabledCategoryFeature = this.getConditionEnabledCategoryFeature(this.CategoryID, catsTable, cfsTable);

            if (conditionEnabledCategoryFeature != null)
            {
                this.conditionEnabled = conditionEnabledCategoryFeature.ConditionEnabled;
                this.conditionValues  = conditionEnabledCategoryFeature.ConditionValues;
            }
            else
            {
                this.conditionEnabled = siteDefaults.ConditionEnabled;
                this.conditionValues  = siteDefaults.ConditionValues;
            }
            if (cf != null && cf.ConditionValues != null)
            {
                this.conditionValues = cf.ConditionValues;
            }
            //this.conditionValues = (cf == null || cf.ConditionValues == null) ? siteDefaults.ConditionValues : cf.ConditionValues;

            //get returnPolicyEnabled feature
            //workaround, just use siteDefaults now
            //bool retPolicyEnabled = (cf == null)?siteDefaults.ReturnPolicyEnabled:cf.ReturnPolicyEnabled;
            this.ReturnPolicyEnabled = siteDefaults.ReturnPolicyEnabled;

            //listing types, recursively search
            ListingDurationReferenceTypeCollection listingTypes = getListingTypes(this.CategoryID, catsTable, cfsTable);

            if (listingTypes == null || listingTypes.Count == 0)//get site defaults
            {
                listingTypes = siteDefaults.ListingDuration;
            }
            //listing duration definitions
            ListingDurationDefinitionsType listingDurations = featureDefinition.ListingDurations;

            //get a mapping from listing type to duration
            this.ListingType2DurationMap = constructListingTypeDurationMapping(listingTypes, listingDurations);

            //payment methods
            BuyerPaymentMethodCodeTypeCollection paymentMethods = getPaymentMethods(this.CategoryID, catsTable, cfsTable);

            if (paymentMethods == null || paymentMethods.Count == 0)//get site defautls
            {
                paymentMethods = siteDefaults.PaymentMethod;
            }
            this.PaymentMethod = paymentMethods;
        }