Exemple #1
0
        /// <summary>
        /// Get xml that contains multiple CSs. Only set AttributeSet.CSId
        /// and AttributeSet.ProductId (optional).
        /// </summary>
        /// <param name="asList">List of <c>AttributeSet</c> objects for which
        /// you want to get CSXml.</param>
        /// <returns>The CS xml for specified CSs.</returns>
        public XmlDocument GetMultipleCSXml(IAttributeSetCollection asList)
        {
            bool            validVersion = validateCurrentVersion();
            Int32Collection csIds        = new Int32Collection();

            if (asList != null)
            {
                foreach (AttributeSet ast in asList)
                {
                    if (ast == null)
                    {
                        continue;
                    }
                    csIds.Add(ast.attributeSetID);
                }
            }
            ATTR_XML_FILE_NAME_PREFIX = createXmlFilePrefix(csIds.ToArray());
            DownloadXml();
            if (!validateCurrentVersion())
            {
                init();
            }

            XmlDocument xml = ExtractMultiCSFromXml(mXml, csIds, true);

            return(xml);
        }
Exemple #2
0
        /// <summary>
        /// Get Site-Wide characteristics sets by category ID.
        /// </summary>
        /// <param name="catId">A specific category ID for which fetch Site-Wide CategoryCS data.</param>
        public int[] GetSiteWideCharSetsAttrIds(string catId)
        {
            SiteWideCharacteristicsTypeCollection swAttrs = GetSiteWideCharacteristics(catId);
            Int32Collection attrSetIds = new Int32Collection();

            for (int i = 0; i < swAttrs.Count; i++)
            {
                SiteWideCharacteristicsType swCharSet = swAttrs.ToArray()[i];
                int attrSetId = swCharSet.CharacteristicsSet.AttributeSetID;
                attrSetIds.Add(attrSetId);
            }

            return(attrSetIds.ToArray());
        }
Exemple #3
0
 public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 {
     if ((destinationType != null) && (value is Int32Collection))
     {
         Int32Collection ints = (Int32Collection)value;
         if (destinationType == typeof(InstanceDescriptor))
         {
             ConstructorInfo ci = typeof(Int32Collection).GetConstructor(new Type[] { typeof(int[]) });
             return(new InstanceDescriptor(ci, new object[] { ints.ToArray() }));
         }
         else if (destinationType == typeof(string))
         {
             return(ints.ConvertToString(null, culture));
         }
     }
     return(base.ConvertTo(context, culture, value, destinationType));
 }
Exemple #4
0
        /// <summary>
        /// Get CharacteristicSet(CS) xml. This implementation does not support
        /// catalog, i.e., csInfo.ProductId will be ignored.
        /// </summary>
        /// <param name="csInfo">Identification information about the CS for which
        /// you want to get CSXml. You only need to set CS.CSId and, optionally, you can
        /// set CS.ProductId if you want to get the CSXml that is associated with
        /// specific product information.
        /// Set CS.CSId to 0 to get entire CharacteristicSet xml for all CSs.</param>
        /// <returns>The xml text of the CS.</returns>
        public string GetCSXmlText(AttributeSet csInfo)
        {
            if (csInfo == null)
            {
                return(null);
            }
            Int32Collection csIds = new Int32Collection();

            csIds.Add(csInfo.attributeSetID);

            ATTR_XML_FILE_NAME_PREFIX = createXmlFilePrefix(csIds.ToArray());

            if (!validateCurrentVersion())
            {
                init();
            }

            XmlDocument xml = ExtractCSFromXml(this.mXml, csInfo.attributeSetID, true);

            return(xml.InnerXml);
        }
		/// <summary>
		/// Get xml that contains multiple CSs. Only set AttributeSet.CSId
		/// and AttributeSet.ProductId (optional).
		/// </summary>
		/// <param name="asList">List of <c>AttributeSet</c> objects for which
		/// you want to get CSXml.</param>
		/// <returns>The CS xml for specified CSs.</returns>
		public XmlDocument GetMultipleCSXml(IAttributeSetCollection asList)
		{
			bool validVersion = validateCurrentVersion();
			Int32Collection csIds = new Int32Collection();
			if(asList != null) 
			{
				foreach(AttributeSet ast in asList) 
				{
					if(ast == null) 
					{
						continue;
					}
					csIds.Add(ast.attributeSetID);
				}
			}
			ATTR_XML_FILE_NAME_PREFIX = createXmlFilePrefix(csIds.ToArray());
			DownloadXml();
			if(!validateCurrentVersion()) 
			{
				init();
			}

			XmlDocument xml = ExtractMultiCSFromXml(mXml, csIds, true);
			
			return xml;
		}
		/// <summary>
		/// Get CharacteristicSet(CS) xml. This implementation does not support
		/// catalog, i.e., csInfo.ProductId will be ignored.
		/// </summary>
		/// <param name="csInfo">Identification information about the CS for which 
		/// you want to get CSXml. You only need to set CS.CSId and, optionally, you can
		/// set CS.ProductId if you want to get the CSXml that is associated with
		/// specific product information.
		/// Set CS.CSId to 0 to get entire CharacteristicSet xml for all CSs.</param>
		/// <returns>The xml text of the CS.</returns>
		public string GetCSXmlText(AttributeSet csInfo)
		{
			if(csInfo == null) 
			{
				return null;
			}
			Int32Collection csIds = new Int32Collection();
			csIds.Add(csInfo.attributeSetID);

			ATTR_XML_FILE_NAME_PREFIX = createXmlFilePrefix(csIds.ToArray());

			if(!validateCurrentVersion()) 
			{
				init();
			}

			XmlDocument xml = ExtractCSFromXml(this.mXml, csInfo.attributeSetID, true);
			return xml.InnerXml;
		}
		/// <summary>
		/// Get Site-Wide characteristics sets by category ID.
		/// </summary>
		/// <param name="catId">A specific category ID for which fetch Site-Wide CategoryCS data.</param>
		public int[] GetSiteWideCharSetsAttrIds(string catId) 
		{
			SiteWideCharacteristicsTypeCollection swAttrs = GetSiteWideCharacteristics(catId);
			Int32Collection attrSetIds = new Int32Collection();
			for(int i = 0; i < swAttrs.Count; i++) {
				SiteWideCharacteristicsType swCharSet = swAttrs.ToArray()[i];
				int attrSetId = swCharSet.CharacteristicsSet.AttributeSetID;
				attrSetIds.Add(attrSetId);
			}

			return attrSetIds.ToArray();
		}