コード例 #1
0
ファイル: AttributesMaster.cs プロジェクト: 88dsl/88dsl
        private IAttributeSetCollection ExcludeReturnPolicyFromSiteWideAttributes(IAttributeSetCollection siteWideAttributeSet)
        {
            if (siteWideAttributeSet == null)
            {
                return(null);
            }
            AttributeSet retPolicyAttrSet = GetReturnPolicyAttributeSet(siteWideAttributeSet);

            if (retPolicyAttrSet == null)
            {
                return(siteWideAttributeSet);
            }
            int retPolicyAttrId = retPolicyAttrSet.attributeSetID;
            IAttributeSetCollection attrList = new AttributeSetCollection();

            foreach (AttributeSet swAttrSet in siteWideAttributeSet)
            {
                if (swAttrSet.attributeSetID == retPolicyAttrId)
                {
                    continue;
                }
                else
                {
                    attrList.Add(swAttrSet);
                }
            }
            return(attrList);
        }
コード例 #2
0
        /// <summary>
        /// Clone the object.
        /// </summary>
        public IAttributeSetCollection Clone()
        {
            AttributeSetCollection asc = (AttributeSetCollection)MemberwiseClone();

            asc.Clear();

            foreach (AttributeSet ast in this.InnerList)
            {
                asc.Add(ast.Clone());
            }

            return(asc);
        }
コード例 #3
0
ファイル: AttributesMaster.cs プロジェクト: 88dsl/88dsl
        /// <summary>
        /// Returns collection of Site Wide AttributeSet objects for a given array category Ids.
        /// Each element of the array contains a VCS Id, if it exists for a given category Id.
        /// </summary>
        /// <param name="catIds">int[]</param>
        /// <returns>Collection of site wide AttributeSet objects</returns>
        public IAttributeSetCollection GetSiteWideAttributeSetsForCategories(Int32Collection catIds)
        {
            IAttributeSetCollection attrSetsList = new AttributeSetCollection();

            //int i = 0;
            //foreach(int catId in catIds)
            //{
            //    SiteWideCharacteristicsTypeCollection swAttrs = mCategoryCSProvider.GetSiteWideCharacteristics(catId.ToString());
            //    foreach(SiteWideCharacteristicsType swChar in swAttrs)
            //    {
            //        AttributeSet swAst = new AttributeSet();
            //        swAst.attributeSetID = swChar.CharacteristicsSet.AttributeSetID;
            //        swAst.CategoryID = catId;
            //        swAst.CategoryOrdinal = i++;
            //        swAst.Name = swChar.CharacteristicsSet.Name;
            //        attrSetsList.Add(swAst);
            //    }
            //}

            return(attrSetsList);
        }
コード例 #4
0
ファイル: AttributesMaster.cs プロジェクト: 88dsl/88dsl
        /// <summary>
        /// Creates an array AttributeSet objects which contains item specific attribute sets and
        /// site wide attribute sets with the exception of the attribute set for return policy.
        /// </summary>
        /// <param name="itemSpecAttrSets">IAttributeSetCollection</param>
        /// <param name="swAttrSets">IAttributeSetCollection</param>
        /// <returns>Joined collection of of item specific attributes sets and site wide attribute sets, except Return Policy</returns>
        public IAttributeSetCollection JoinItemSpecificAndSiteWideAttributeSets(IAttributeSetCollection itemSpecAttrSets, IAttributeSetCollection swAttrSets)
        {
            if (swAttrSets == null || swAttrSets.Count == 0)
            {
                if (itemSpecAttrSets == null || itemSpecAttrSets.Count == 0)
                {
                    return(null);
                }
                else
                {
                    return(itemSpecAttrSets);
                }
            }

            // Exclude Return Policy:
            IAttributeSetCollection swAttrNoRetPolicySets = ExcludeReturnPolicyFromSiteWideAttributes(swAttrSets);

            if (swAttrNoRetPolicySets == null || swAttrNoRetPolicySets.Count == 0)
            {
                return(itemSpecAttrSets);
            }

            // Append Site Wide attributes to the Site Specific attributes:
            IAttributeSetCollection joinedAttrSet = new AttributeSetCollection();

            if (itemSpecAttrSets != null)
            {
                foreach (AttributeSet itemSpecAttrSet in itemSpecAttrSets)
                {
                    joinedAttrSet.Add(itemSpecAttrSet);
                }
            }
            foreach (AttributeSet swAttrNoRetPolicySet in swAttrNoRetPolicySets)
            {
                joinedAttrSet.Add(swAttrNoRetPolicySet);
            }

            return(joinedAttrSet);
        }
コード例 #5
0
ファイル: AttributesMaster.cs プロジェクト: 88dsl/88dsl
        /// <summary>
        /// Extract <c>IAttributeSetCollection</c> object from <c>IKeyValueCollection</c> object.
        /// </summary>
        /// <param name="nameValues">The <c>IKeyValueCollection</c> to be converted.</param>
        /// <returns>The extracted <c>IAttributeSetCollection</c> object.</returns>
        public IAttributeSetCollection NameValuesToAttributeSets(IKeyValueCollection nameValues)
        {
            IAttributeSetCollection attrSets = new AttributeSetCollection();
            AttributeSet            attrSet;
            NameValueCollection     nvs = AttributesHelper.ConvertToNameValues(nameValues);

            for (int ordinal = 0; ; ordinal++)
            {
                attrSet = ExtractOneCat(CAT_CS_ID + ordinal.ToString(), nvs);
                if (attrSet != null)
                {
                    attrSet.CategoryOrdinal = attrSets.Count;
                    attrSets.Add(attrSet);
                }
                else
                {
                    break;
                }
            }

            return(attrSets);
        }
コード例 #6
0
ファイル: AttributesMaster.cs プロジェクト: 88dsl/88dsl
        /// <summary>
        /// Returns collection of item specific AttributeSet objects for an array category Ids.
        /// Each element of the array contains a VCS Id, if it exists for a given category Id.
        /// </summary>
        /// <param name="catIds">int[]</param>
        /// <returns>Collection of item specific AttributeSet objects</returns>
        public IAttributeSetCollection GetItemSpecificAttributeSetsForCategories(Int32Collection catIds)
        {
            IAttributeSetCollection sets = new AttributeSetCollection();
            int i = 0;

            foreach (int catId in catIds)
            {
                AttributeSet ast  = new AttributeSet();
                int          csId = mCategoryCSProvider.GetVCSId(catId);
                if (csId == 0)
                {
                    return(null);
                    //throw new SdkException("Unable to get CSID by category Id");
                }
                ast.attributeSetID  = csId;
                ast.CategoryID      = catId;
                ast.CategoryOrdinal = i++;

                sets.Add(ast);
            }

            return(sets);
        }
コード例 #7
0
 public void RenderHtml()
 {
     init();
     Int32Collection catIds = new Int32Collection();
     catIds.Add(CATEGORYID);
     IAttributeSetCollection siteWideAttrSets = master.GetSiteWideAttributeSetsForCategories(catIds);
     AttributeSet retPolicySet = master.GetReturnPolicyAttributeSet(siteWideAttrSets);
     IAttributeSetCollection retPolicySetCollection = new AttributeSetCollection();
     retPolicySetCollection.Add(retPolicySet);
     string tableText = master.RenderHtml(retPolicySetCollection, null);
     DOMDocument30 xmlDoc = master.getXmlToRenderDoc();
     //TextWriter writer = new StreamWriter("C:\\SDK\\48514.xml");
     string xmlString = xmlDoc.xml;
     Console.WriteLine(xmlString);
     releaseResource();
 }
コード例 #8
0
		private IAttributeSetCollection ExcludeReturnPolicyFromSiteWideAttributes(IAttributeSetCollection siteWideAttributeSet) 
		{
			if(siteWideAttributeSet == null) 
			{
				return null;
			}
			AttributeSet retPolicyAttrSet = GetReturnPolicyAttributeSet(siteWideAttributeSet);
			if(retPolicyAttrSet == null) 
			{
				return siteWideAttributeSet;
			}
			int retPolicyAttrId = retPolicyAttrSet.attributeSetID;
			IAttributeSetCollection attrList = new AttributeSetCollection();
			foreach(AttributeSet swAttrSet in siteWideAttributeSet) 
			{
				if(swAttrSet.attributeSetID == retPolicyAttrId) 
				{
					continue;
				} 
				else 
				{
					attrList.Add(swAttrSet);
				}
			}
			return attrList;
		}
コード例 #9
0
		/// <summary>
		/// Returns collection of Site Wide AttributeSet objects for a given array category Ids.
		/// Each element of the array contains a VCS Id, if it exists for a given category Id. 
		/// </summary>
		/// <param name="catIds">int[]</param>
		/// <returns>Collection of site wide AttributeSet objects</returns>
		public IAttributeSetCollection GetSiteWideAttributeSetsForCategories(Int32Collection catIds) 
		{
			IAttributeSetCollection attrSetsList = new AttributeSetCollection();
			int i = 0;
			foreach(int catId in catIds) 
			{
				SiteWideCharacteristicsTypeCollection swAttrs = mCategoryCSProvider.GetSiteWideCharacteristics(catId.ToString());
				foreach(SiteWideCharacteristicsType swChar in swAttrs) 
				{
					AttributeSet swAst = new AttributeSet();
					swAst.attributeSetID = swChar.CharacteristicsSet.AttributeSetID;
					swAst.CategoryID = catId;
					swAst.CategoryOrdinal = i++;
					swAst.Name = swChar.CharacteristicsSet.Name;
					attrSetsList.Add(swAst);
				}
			}

			return attrSetsList;
		}
コード例 #10
0
		/// <summary>
		/// Returns collection of item specific AttributeSet objects for an array category Ids.
		/// Each element of the array contains a VCS Id, if it exists for a given category Id. 
		/// </summary>
		/// <param name="catIds">int[]</param>
		/// <returns>Collection of item specific AttributeSet objects</returns>
		public IAttributeSetCollection GetItemSpecificAttributeSetsForCategories(Int32Collection catIds) 
		{
			IAttributeSetCollection sets = new AttributeSetCollection();
			int i = 0;
			foreach(int catId in catIds) 
			{
				AttributeSet ast = new AttributeSet();
				int csId = mCategoryCSProvider.GetVCSId(catId);
				if (csId == 0) 
				{
					return null;
					//throw new SdkException("Unable to get CSID by category Id");
				}
				ast.attributeSetID = csId;
				ast.CategoryID = catId;
				ast.CategoryOrdinal = i++;

				sets.Add(ast);
			}

			return sets;
		}
コード例 #11
0
		/// <summary>
		/// Creates an array AttributeSet objects which contains item specific attribute sets and
		/// site wide attribute sets with the exception of the attribute set for return policy. 
		/// </summary>
		/// <param name="itemSpecAttrSets">IAttributeSetCollection</param>
		/// <param name="swAttrSets">IAttributeSetCollection</param>
		/// <returns>Joined collection of of item specific attributes sets and site wide attribute sets, except Return Policy</returns>
		public IAttributeSetCollection JoinItemSpecificAndSiteWideAttributeSets(IAttributeSetCollection itemSpecAttrSets, IAttributeSetCollection swAttrSets) 
		{
			if(swAttrSets == null || swAttrSets.Count == 0) 
			{
				if(itemSpecAttrSets == null || itemSpecAttrSets.Count == 0) 
				{
					return null;
				} 
				else 
				{
					return itemSpecAttrSets;
				}
			}
	  
			// Exclude Return Policy:
			IAttributeSetCollection swAttrNoRetPolicySets = ExcludeReturnPolicyFromSiteWideAttributes(swAttrSets);
			if(swAttrNoRetPolicySets == null || swAttrNoRetPolicySets.Count == 0) 
			{
				return itemSpecAttrSets;
			}

			// Append Site Wide attributes to the Site Specific attributes:
			IAttributeSetCollection joinedAttrSet = new AttributeSetCollection();
			if(itemSpecAttrSets!=null)
			{
				foreach(AttributeSet itemSpecAttrSet in itemSpecAttrSets) 
				{
					joinedAttrSet.Add(itemSpecAttrSet);
				}
			}
			foreach(AttributeSet swAttrNoRetPolicySet in swAttrNoRetPolicySets) 
			{
				joinedAttrSet.Add(swAttrNoRetPolicySet);
			}
	  
			return joinedAttrSet;
		}
コード例 #12
0
		/// <summary>
		/// Extract <c>IAttributeSetCollection</c> object from <c>IKeyValueCollection</c> object.
		/// </summary>
		/// <param name="nameValues">The <c>IKeyValueCollection</c> to be converted.</param>
		/// <returns>The extracted <c>IAttributeSetCollection</c> object.</returns>
		public IAttributeSetCollection NameValuesToAttributeSets(IKeyValueCollection nameValues)
		{
			IAttributeSetCollection attrSets = new AttributeSetCollection();			
			AttributeSet attrSet;
			NameValueCollection nvs = AttributesHelper.ConvertToNameValues(nameValues);
			for(int ordinal = 0; ; ordinal++ )
			{
				attrSet = ExtractOneCat(CAT_CS_ID + ordinal.ToString(), nvs);
				if( attrSet != null )
				{
					attrSet.CategoryOrdinal = attrSets.Count;
					attrSets.Add(attrSet);
				}
				else
					break;
			}

			return attrSets;
		}