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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
/// <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); }
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(); }
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; }
/// <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; }
/// <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; }
/// <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; }
/// <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; }