Exemple #1
0
        /// <summary>
        /// get some items which supports the ad format category, you can specify the number
        /// </summary>
        /// <param name="apiContext"></param>
        /// <param name="num"></param>
        /// <param name="categoryTypeCollection"></param>
        /// <param name="message"></param>
        /// <returns></returns>
        public static bool GetAdFormatCategory(ApiContext apiContext, int num, out CategoryTypeCollection categoryTypeCollection, out string message)
        {
            message = string.Empty;
            CategoryTypeCollection tmpCategories;

            categoryTypeCollection = null;
            num = (num <= 0)?1:num;

            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(apiContext);

            setBasicInfo(ref api);
            //spcify category id
            if (!getAllCategories(apiContext, out tmpCategories, out message))
            {
                message = message + ",203";
                return(false);
            }

            FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
            FeatureIDCodeType           type     = FeatureIDCodeType.AdFormatEnabled;

            features.Add(type);

            string categoryID = string.Empty;

            foreach (CategoryType category in tmpCategories)
            {
                if (category.LeafCategory == true)
                {
                    categoryID = category.CategoryID;
                    try
                    {
                        //call
                        CategoryFeatureTypeCollection featureTypes = api.GetCategoryFeatures(categoryID, 10, true, features, true);

                        if (featureTypes != null && featureTypes.Count > 0)
                        {
                            if (featureTypes[0].AdFormatEnabled == AdFormatEnabledCodeType.Enabled)
                            {
                                categoryTypeCollection.Add(category);
                            }

                            if (categoryTypeCollection.Count >= num)
                            {
                                break;
                            }
                        }
                    }
                    catch (Exception e)
                    {
                        message = e.Message + ",204";
                        return(false);
                    }
                }
            }

            return(true);
        }
Exemple #2
0
 /// <summary>
 ///
 /// </summary>
 public GetCategoryFeaturesHelper(ApiContext ApiContext, string CategoryID, int LevelLimit, bool ViewAllNodes, FeatureIDCodeTypeCollection FeatureIDList, bool AllFeaturesForCategory)
 {
     _apiContext             = ApiContext;
     _site                   = _apiContext.Site;
     _categoryID             = CategoryID;
     _levelLimit             = LevelLimit;
     _viewAllNodes           = ViewAllNodes;
     _featureIDs             = FeatureIDList;
     _allFeaturesForCategory = AllFeaturesForCategory;
     loadCategoryFeatures(_site);
 }
		/// <summary>
		/// 
		/// </summary>
        public GetCategoryFeaturesHelper(ApiContext ApiContext, string CategoryID, int LevelLimit, bool ViewAllNodes, FeatureIDCodeTypeCollection FeatureIDList, bool AllFeaturesForCategory) 
		{
			_apiContext = ApiContext;
			_site = _apiContext.Site;
			_categoryID = CategoryID;
			_levelLimit = LevelLimit;
			_viewAllNodes = ViewAllNodes;
			_featureIDs = FeatureIDList;
            _allFeaturesForCategory = AllFeaturesForCategory;
			loadCategoryFeatures(_site);
		}
Exemple #4
0
        /// <summary>
        /// call GetCategories to get all categories for a given site
        /// </summary>
        /// <returns>generic object</returns>
        protected override object callApi()
        {
            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(context);
            //set detail level
            api.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            FeatureIDCodeTypeCollection featureCol = new FeatureIDCodeTypeCollection();
            featureCol.Add(FeatureIDCodeType.ListingDurations);
            featureCol.Add(FeatureIDCodeType.ItemSpecificsEnabled);
            featureCol.Add(FeatureIDCodeType.ReturnPolicyEnabled);
            featureCol.Add(FeatureIDCodeType.PaymentMethods);
            //execute call
            api.FeatureIDList = featureCol;
            api.GetCategoryFeatures();

            return api.ApiResponse;
        }
        public void AddItemFull()
        {
            if (TestData.NewItem2 != null)
            {
                (new T_120_EndItemLibrary()).EndItemFull();
                TestData.NewItem2 = null;
            }

            bool     isSucess, isSupport = true;
            string   message;
            ItemType item = ItemHelper.BuildItem();

            item.PrimaryCategory.CategoryID = CATEGORYID.ToString();
            //add Item AttributeSetArray
            //AttributeSetTypeCollection attributeSAT=GetAttributeSetCol(CATEGORYID,apiContext);
            //item.AttributeSetArray=attributeSAT;

            //check this category is custom specifics support
            FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
            FeatureIDCodeType           feature  = FeatureIDCodeType.ItemSpecificsEnabled;

            features.Add(feature);
            isSucess = UnitTests.Helper.CategoryHelper.IsSupportFeature(CATEGORYID, features, apiContext, out isSupport, out message);
            System.Console.WriteLine(message);
            Assert.IsTrue(isSucess, "there are some errors during checkging the CategoryFeatures");
            Assert.IsTrue(isSupport, "this category 104970 do not support the custom item specified any more!");
            //add CIS
            item.ItemSpecifics = getCIS();

            FeeTypeCollection fees;

            VerifyAddItemCall vi = new VerifyAddItemCall(apiContext);

            fees = vi.VerifyAddItem(item);
            Assert.IsNotNull(fees);

            AddItemCall addItemCall = new AddItemCall(apiContext);;

            fees = addItemCall.AddItem(item);
            //check whether the call is success.
            Assert.IsTrue(addItemCall.AbstractResponse.Ack == AckCodeType.Success || addItemCall.AbstractResponse.Ack == AckCodeType.Warning, "do not success!");
            Assert.IsNotNull(fees);
            // Save the result.
            TestData.NewItem2 = item;
        }
Exemple #6
0
        public static bool GetCISSupportLeafCategory(int number, out CategoryTypeCollection categories, ApiContext apiContext, out string message)
        {
            CategoryTypeCollection categoryTypeCollection;

            categories = new CategoryTypeCollection();
            bool isSuccess, isSupport;

            if (number <= 0)
            {
                number = 1;
            }

            if (getAllCategories(apiContext, out categoryTypeCollection, out message))
            {
                foreach (CategoryType category in categoryTypeCollection)
                {
                    if (category.LeafCategory == true)
                    {
                        //check whether the category support the ItemSpecificsEnabled;
                        FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
                        FeatureIDCodeType           type     = FeatureIDCodeType.ItemSpecificsEnabled;
                        features.Add(type);
                        isSuccess = isSupportFeature(int.Parse(category.CategoryID), features, apiContext, out isSupport, out message);
                        if (!isSuccess)
                        {
                            return(false);
                        }

                        if (isSupport)
                        {
                            categories.Add(category);

                            if (categories.Count == number)
                            {
                                break;
                            }
                        }
                    }            //end if
                }                //end foreach

                return(true);
            }

            return(false);
        }
Exemple #7
0
        public void GetCategoryFeaturesFull2()
        {
            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext);

            DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
                DetailLevelCodeType.ReturnAll
            };
            api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
            FeatureIDCodeTypeCollection features = new FeatureIDCodeTypeCollection();
            FeatureIDCodeType           feature  = FeatureIDCodeType.BestOfferEnabled;

            features.Add(feature);
            api.FeatureIDList = features;
            api.CategoryID    = COOKBOOKSCATEGORYID;
            api.Execute();
            //check whether the call is success.
            Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning, "the call is failure!");
            Assert.IsNotNull(api.ApiResponse.FeatureDefinitions);
            Assert.AreEqual(api.ApiResponse.Category[0].CategoryID, COOKBOOKSCATEGORYID);
        }
        /// <summary>
        /// call GetCategories to get all categories for a given site
        /// </summary>
        /// <returns>generic object</returns>
        protected override object callApi()
        {
            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(context);

            //set detail level
            api.DetailLevelList.Add(DetailLevelCodeType.ReturnAll);
            api.ViewAllNodes = true;
            FeatureIDCodeTypeCollection featureCol = new FeatureIDCodeTypeCollection();

            featureCol.Add(FeatureIDCodeType.ListingDurations);
            featureCol.Add(FeatureIDCodeType.ItemSpecificsEnabled);
            featureCol.Add(FeatureIDCodeType.ReturnPolicyEnabled);
            featureCol.Add(FeatureIDCodeType.PaymentMethods);
            featureCol.Add(FeatureIDCodeType.ConditionEnabled);
            featureCol.Add(FeatureIDCodeType.ConditionValues);
            //execute call
            api.FeatureIDList = featureCol;
            api.GetCategoryFeatures();

            return(api.ApiResponse);
        }
Exemple #9
0
        public void AddItemFull()
        {
            if( TestData.NewItem2 != null )
            {
                (new T_120_EndItemLibrary()).EndItemFull();
                TestData.NewItem2 = null;
            }

            bool isSucess,isSupport;
            string message;
            ItemType item= ItemHelper.BuildItem();
            item.PrimaryCategory.CategoryID=CATEGORYID.ToString();
            //add Item AttributeSetArray
            AttributeSetTypeCollection attributeSAT=GetAttributeSetCol(CATEGORYID,apiContext);
            item.AttributeSetArray=attributeSAT;

            //check this category is custom specifics support
            FeatureIDCodeTypeCollection features=new FeatureIDCodeTypeCollection();
            FeatureIDCodeType feature=FeatureIDCodeType.ItemSpecificsEnabled;
            features.Add(feature);
            isSucess=UnitTests.Helper.CategoryHelper.IsSupportFeature(CATEGORYID,features,apiContext,out isSupport,out message);
            Assert.IsTrue(isSucess,"there are some errors during checkging the CategoryFeatures");
            Assert.IsTrue(isSupport,"this category 50253 do not support the custom item specified any more!");
            //add CIS
            item.ItemSpecifics = getCIS();

            FeeTypeCollection fees;

            VerifyAddItemCall vi = new VerifyAddItemCall(apiContext);
            fees = vi.VerifyAddItem(item);
            Assert.IsNotNull(fees);

            AddItemCall addItemCall = new AddItemCall(apiContext);;
            fees = addItemCall.AddItem(item);
            //check whether the call is success.
            Assert.IsTrue(addItemCall.AbstractResponse.Ack==AckCodeType.Success || addItemCall.AbstractResponse.Ack==AckCodeType.Warning,"do not success!");
            Assert.IsNotNull(fees);
            // Save the result.
            TestData.NewItem2 = item;
        }
Exemple #10
0
        /// <summary>
        /// Returns information about the features that are applicable to different categories,
        /// such as listing durations, shipping term requirements, and Best Offer support.
        /// </summary>
        ///
        /// <param name="CategoryID">
        /// Specifies the category for which you want to retrieve the feature settings.
        ///
        /// Specify a CategoryID, set DetailLevel to ReturnAll, and set
        /// ViewAllNodes to true to return the default site settings, the
        /// overrides for the specified category, plus all the child
        /// categories that have overrides on the features they inherit.
        ///
        /// If you also set AllFeaturesForCategory to true, eBay returns the site
        /// defaults, plus all the settings for the specified category. Child
        /// category information is not returned in this case.
        ///
        /// If CategoryID is not specified, eBay returns the feature settings for
        /// the site. To return details on all categories that have overrides on
        /// the properties they inherit, set DetailLevel to ReturnAll, and set
        /// ViewAllNodes to true. If you also set AllFeaturesForCategory to true,
        /// eBay returns only the site defaults with no child category information.
        /// </param>
        ///
        /// <param name="LevelLimit">
        /// A level of depth in the category hierarchy. Retrieves all category
        /// nodes with a CategoryLevel less than or equal to the LevelLimit
        /// value.
        /// </param>
        ///
        /// <param name="ViewAllNodes">
        /// You must set DetailLevel to ReturnAll in order to correctly populate the
        /// response when you set ViewAllNodes to true. In this case, eBay returns the
        /// site defaults along with all the categories that override the feature
        /// settings they inherit. Here, each Category container shows only the
        /// features that it has overridden from its parent node.
        ///
        /// If you also specify a CategoryID, eBay returns the details for that category,
        /// along with containers for each of its child categories that have feature
        /// overrides.
        ///
        /// Note that if ViewAllNodes is set to false (the default) and DetailLevel is
        /// set to ReturnAll, eBay returns only the leaf categories that have features
        /// that override the settings they inherit. In this case, the call will not
        /// return leaf categories that do not have overrides.
        /// </param>
        ///
        /// <param name="FeatureIDList">
        /// Use this field if you want to know if specific features are enabled at the site
        /// or root category level. Multiple <b>FeatureID</b> elements can be
        /// used in the request. If no <b>FeatureID</b> elements are used, the
        /// call retrieves data for all features, as applicable to the other request
        /// parameters.
        /// </param>
        ///
        /// <param name="AllFeaturesForCategory">
        /// Use this switch to view all of the feature settings for a specific category.
        /// All feature settings are returned, regardless of the site default settings.
        /// This element works in conjunction with CategoryID--refer to the notes for
        /// that element for more details.
        ///
        /// If you also set FeatureID, eBay returns the status of the specified
        /// features only, for the specified category.
        /// </param>
        ///
        public CategoryFeatureTypeCollection GetCategoryFeatures(string CategoryID, int LevelLimit, bool ViewAllNodes, FeatureIDCodeTypeCollection FeatureIDList, bool AllFeaturesForCategory)
        {
            this.CategoryID             = CategoryID;
            this.LevelLimit             = LevelLimit;
            this.ViewAllNodes           = ViewAllNodes;
            this.FeatureIDList          = FeatureIDList;
            this.AllFeaturesForCategory = AllFeaturesForCategory;

            Execute();
            return(ApiResponse.Category);
        }
        /// <summary>
        /// Returns information about the features that are applicable to different categories,
        /// such as listing durations, shipping term requirements, and Best Offer support.
        /// </summary>
        /// 
        /// <param name="CategoryID">
        /// Specifies the category for which you want to retrieve the feature settings.
        /// 
        /// Specify a CategoryID, set DetailLevel to ReturnAll, and set
        /// ViewAllNodes to true to return the default site settings, the
        /// overrides for the specified category, plus all the child
        /// categories that have overrides on the features they inherit.
        /// 
        /// If you also set AllFeaturesForCategory to true, eBay returns the site
        /// defaults, plus all the settings for the specified category. Child
        /// category information is not returned in this case.
        /// 
        /// If CategoryID is not specified, eBay returns the feature settings for
        /// the site. To return details on all categories that have overrides on
        /// the properties they inherit, set DetailLevel to ReturnAll, and set
        /// ViewAllNodes to true. If you also set AllFeaturesForCategory to true,
        /// eBay returns only the site defaults with no child category information.
        /// </param>
        ///
        /// <param name="LevelLimit">
        /// A level of depth in the category hierarchy. Retrieves all category
        /// nodes with a CategoryLevel less than or equal to the LevelLimit
        /// value.
        /// </param>
        ///
        /// <param name="ViewAllNodes">
        /// You must set DetailLevel to ReturnAll in order to correctly populate the
        /// response when you set ViewAllNodes to true. In this case, eBay returns the
        /// site defaults along with all the categories that override the feature
        /// settings they inherit. Here, each Category container shows only the
        /// features that it has overridden from its parent node.
        /// 
        /// If you also specify a CategoryID, eBay returns the details for that category,
        /// along with containers for each of its child categories that have feature
        /// overrides.
        /// 
        /// Note that if ViewAllNodes is set to false (the default) and DetailLevel is
        /// set to ReturnAll, eBay returns only the leaf categories that have features
        /// that override the settings they inherit. In this case, the call will not
        /// return leaf categories that do not have overrides.
        /// </param>
        ///
        /// <param name="FeatureIDList">
        /// Retrieves data related to the specified feature setting only.
        /// If no feature IDs are specified, the call retrieves data for all
        /// features, as applicable to the other call settings.
        /// </param>
        ///
        /// <param name="AllFeaturesForCategory">
        /// Use this switch to view all of the feature settings for a specific category.
        /// All feature settings are returned, regardless of the site default settings.
        /// This element works in conjunction with CategoryID--refer to the notes for
        /// that element for more details.
        /// 
        /// If you also set FeatureID, eBay returns the status of the specified
        /// features only, for the specified category.
        /// </param>
        ///
        public CategoryFeatureTypeCollection GetCategoryFeatures(string CategoryID, int LevelLimit, bool ViewAllNodes, FeatureIDCodeTypeCollection FeatureIDList, bool AllFeaturesForCategory)
        {
            this.CategoryID = CategoryID;
            this.LevelLimit = LevelLimit;
            this.ViewAllNodes = ViewAllNodes;
            this.FeatureIDList = FeatureIDList;
            this.AllFeaturesForCategory = AllFeaturesForCategory;

            Execute();
            return ApiResponse.Category;
        }
		/// <summary>
		/// get some items which supports the ad format category, you can specify the number
		/// </summary>
		/// <param name="apiContext"></param>
		/// <param name="num"></param>
		/// <param name="categoryTypeCollection"></param>
		/// <param name="message"></param>
		/// <returns></returns>
		public static  bool GetAdFormatCategory(ApiContext apiContext,int num,out CategoryTypeCollection categoryTypeCollection,out string message)
		{
			message=string.Empty;
			CategoryTypeCollection tmpCategories;
			categoryTypeCollection = null;
			num=(num<=0)?1:num;

			GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(apiContext);
			setBasicInfo(ref api);
			//spcify category id
			if(!getAllCategories(apiContext,out tmpCategories, out message))
			{
				message=message+",203";
				return false;
			}
			
			FeatureIDCodeTypeCollection features=new FeatureIDCodeTypeCollection();
			FeatureIDCodeType type=FeatureIDCodeType.AdFormatEnabled;
			features.Add(type);

			string categoryID=string.Empty;

			foreach(CategoryType category in tmpCategories)
			{
				if(category.LeafCategory == true)
				{
					categoryID=category.CategoryID;
					try
					{
						//call
						CategoryFeatureTypeCollection featureTypes = api.GetCategoryFeatures(categoryID,10,true,features,true);
					
						if(featureTypes!=null&&featureTypes.Count>0)
						{
							if(featureTypes[0].AdFormatEnabled==AdFormatEnabledCodeType.Enabled)
							{
								categoryTypeCollection.Add(category);
							}

							if(categoryTypeCollection.Count>=num)
							{
								break;
							}
						}

					}
					catch(Exception e)
					{
						message=e.Message+",204";
						return false;
					}
				}	
			}
			
			return true;
		}
Exemple #13
0
        /// <summary>
        /// just support custom item specific. it would be enchance later.
        /// </summary>
        /// <param name="categoryID"></param>
        /// <param name="ids"></param>
        /// <returns></returns>
        private static bool isSupportFeature(int categoryID, FeatureIDCodeTypeCollection features, ApiContext apiContext, out bool isSupport, out string message)
        {
            isSupport = true;
            message   = string.Empty;

            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(apiContext);

            setBasicInfo(ref api);
            //spcify category id
            api.CategoryID    = categoryID.ToString();
            api.FeatureIDList = features;
            try
            {
                //call
                CategoryFeatureTypeCollection featureTypes = api.GetCategoryFeatures();

                SiteDefaultsType siteDefaultsType = api.SiteDefaults;

                if (featureTypes != null && featureTypes.Count > 0)
                {
                    foreach (FeatureIDCodeType feature in features)
                    {
                        if (feature.ToString() == "ItemSpecificsEnabled")
                        {
                            // Check if the specified category is ItemspecificEnabled,
                            // Check for ItemspecificEnabled element in the features level
                            // If the tag does not occur then fetch it from site defaults
                            if (!featureTypes[0].ItemSpecificsEnabledSpecified)
                            {
                                if (siteDefaultsType.ItemSpecificsEnabledSpecified)
                                {
                                    if (siteDefaultsType.ItemSpecificsEnabled != ItemSpecificsEnabledCodeType.Enabled)
                                    {
                                        isSupport = false;
                                        message   = "ItemSpecificsEnabled is not supported!";
                                        break;
                                    }
                                }
                            }
                            else if (featureTypes[0].ItemSpecificsEnabled != ItemSpecificsEnabledCodeType.Enabled)
                            {
                                isSupport = false;
                                message   = "ItemSpecificsEnabled is not supported!";
                                break;
                            }
                        }

                        if (feature.ToString() == "AdFormatEnabled")
                        {
                            if (featureTypes[0].AdFormatEnabled != AdFormatEnabledCodeType.Enabled)
                            {
                                isSupport = false;
                                message   = "AdFormatEnabled is not supported!";
                                break;
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                message = e.Message;
                return(false);
            }

            return(true);
        }
Exemple #14
0
 /// <summary>
 /// whether support the specific features
 /// </summary>
 /// <param name="categoryID"></param>
 /// <param name="features"></param>
 /// <param name="apiContext"></param>
 /// <returns></returns>
 public static bool IsSupportFeature(int categoryID, FeatureIDCodeTypeCollection features, ApiContext apiContext, out bool isSupport, out string message)
 {
     return(isSupportFeature(categoryID, features, apiContext, out isSupport, out message));
 }
		public static bool GetCISSupportLeafCategory(int number,out CategoryTypeCollection categories,ApiContext apiContext,out string message)
		{
			CategoryTypeCollection categoryTypeCollection;
			categories=new CategoryTypeCollection();
			bool isSuccess,isSupport;
			if(number<=0)
			{
				number=1;
			}

			if(getAllCategories(apiContext,out categoryTypeCollection,out message))
			{
				foreach(CategoryType category in categoryTypeCollection)
				{
					if(category.LeafCategory==true)
					{
						//check whether the category support the ItemSpecificsEnabled;
						FeatureIDCodeTypeCollection features=new FeatureIDCodeTypeCollection();
						FeatureIDCodeType type=FeatureIDCodeType.ItemSpecificsEnabled;
						features.Add(type);
						isSuccess=isSupportFeature(int.Parse(category.CategoryID),features,apiContext,out isSupport,out message);
						if(!isSuccess)
						{
							return false;
						}
						
						if(isSupport)
						{
							categories.Add(category);

							if(categories.Count==number)
							{
								break;
							}
						}
					}//end if
				}//end foreach

				return true;
			}

			return false;
		}
		/// <summary>
		/// whether support the specific features
		/// </summary>
		/// <param name="categoryID"></param>
		/// <param name="features"></param>
		/// <param name="apiContext"></param>
		/// <returns></returns>
		public static bool IsSupportFeature(int categoryID,FeatureIDCodeTypeCollection features,ApiContext apiContext,out bool isSupport,out string message)
		{
			return isSupportFeature(categoryID,features,apiContext,out isSupport,out message);
		}
 public void GetCategoryFeaturesFull2()
 {
     GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(this.apiContext);
     DetailLevelCodeType[] detailLevels = new DetailLevelCodeType[] {
     DetailLevelCodeType.ReturnAll
     };
     api.DetailLevelList = new DetailLevelCodeTypeCollection(detailLevels);
     FeatureIDCodeTypeCollection features=new FeatureIDCodeTypeCollection();
     FeatureIDCodeType feature=FeatureIDCodeType.BestOfferEnabled;
     features.Add(feature);
     api.FeatureIDList=features;
     api.CategoryID=COOKBOOKSCATEGORYID;
     api.Execute();
     //check whether the call is success.
     Assert.IsTrue(api.ApiResponse.Ack == AckCodeType.Success || api.ApiResponse.Ack == AckCodeType.Warning,"the call is failure!");
     Assert.IsNotNull(api.ApiResponse.FeatureDefinitions);
     Assert.AreEqual(api.ApiResponse.Category[0].CategoryID,COOKBOOKSCATEGORYID);
 }
		/// <summary>
		/// just support custom item specific. it would be enchance later.
		/// </summary>
		/// <param name="categoryID"></param>
		/// <param name="ids"></param>
		/// <returns></returns>
		private static bool isSupportFeature(int categoryID,FeatureIDCodeTypeCollection features,ApiContext apiContext,out bool isSupport,out string message)
		{
			isSupport=true;
			message=string.Empty;

			GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(apiContext);
			setBasicInfo(ref api);
			//spcify category id
			api.CategoryID=categoryID.ToString();
			api.FeatureIDList = features;
			try
			{
				//call
				CategoryFeatureTypeCollection featureTypes = api.GetCategoryFeatures();

                SiteDefaultsType siteDefaultsType = api.SiteDefaults;

				if(featureTypes!=null&&featureTypes.Count>0)
				{
					foreach(FeatureIDCodeType feature in features)
					{
						if(feature.ToString()=="ItemSpecificsEnabled")
						{
                            // Check if the specified category is ItemspecificEnabled,
                            // Check for ItemspecificEnabled element in the features level
                            // If the tag does not occur then fetch it from site defaults
                            if (!featureTypes[0].ItemSpecificsEnabledSpecified)
                            {
                                if (siteDefaultsType.ItemSpecificsEnabledSpecified)
                                {
                                    if (siteDefaultsType.ItemSpecificsEnabled != ItemSpecificsEnabledCodeType.Enabled)
                                    {
                                        isSupport = false;
                                        message = "ItemSpecificsEnabled is not supported!";
                                        break;
                                    }
                                }
                            } else if (featureTypes[0].ItemSpecificsEnabled!=ItemSpecificsEnabledCodeType.Enabled)
							{
								isSupport=false;
								message="ItemSpecificsEnabled is not supported!";
								break;
							}
						}

						if(feature.ToString()=="AdFormatEnabled")
						{
							if(featureTypes[0].AdFormatEnabled!=AdFormatEnabledCodeType.Enabled)
							{
								isSupport=false;
								message="AdFormatEnabled is not supported!";
								break;
							}
						}

					}
				}
			}
			catch(Exception e)
			{
				message=e.Message;
				return false;
			}
				
			return true;
		}
Exemple #19
0
        /// <summary>
        /// just support custom item specific. it would be enchance later.
        /// </summary>
        /// <param name="categoryID"></param>
        /// <param name="ids"></param>
        /// <returns></returns>
        private static bool isSupportFeature(int categoryID,FeatureIDCodeTypeCollection features,ApiContext apiContext,out bool isSupport,out string message)
        {
            isSupport=true;
            message=string.Empty;

            GetCategoryFeaturesCall api = new GetCategoryFeaturesCall(apiContext);
            setBasicInfo(ref api);
            //spcify category id
            api.CategoryID=categoryID.ToString();
            api.FeatureIDList = features;
            try
            {
                //call
                CategoryFeatureTypeCollection featureTypes = api.GetCategoryFeatures();

                if(featureTypes!=null&&featureTypes.Count>0)
                {
                    foreach(FeatureIDCodeType feature in features)
                    {
                        if(feature.ToString()=="ItemSpecificsEnabled")
                        {
                            if(featureTypes[0].ItemSpecificsEnabled!=ItemSpecificsEnabledCodeType.Enabled)
                            {
                                isSupport=false;
                                message="ItemSpecificsEnabled is not supported!";
                                break;
                            }
                        }

                        if(feature.ToString()=="AdFormatEnabled")
                        {
                            if(featureTypes[0].AdFormatEnabled!=AdFormatEnabledCodeType.Enabled)
                            {
                                isSupport=false;
                                message="AdFormatEnabled is not supported!";
                                break;
                            }
                        }

                    }
                }
            }
            catch(Exception e)
            {
                message=e.Message;
                return false;
            }

            return true;
        }