Beispiel #1
0
		static APRptReferDef()
		{
			columnIdProp = new APXmlProperty("columnId", typeof(string), "", APXmlPropertyOptions.IsRequired | APXmlPropertyOptions.IsKey);

			properties = new APXmlPropertyCollection();
			properties.Add(columnIdProp);
		}
Beispiel #2
0
		public APXmlElementMap(Type type)
		{
			_properties = new APXmlPropertyCollection();

			_collectionAttribute = Attribute.GetCustomAttribute(type, typeof(APXmlCollectionAttribute)) as APXmlCollectionAttribute;

			PropertyInfo[] props = type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);

			foreach (PropertyInfo prop in props)
			{
				APXmlPropertyAttribute attr = Attribute.GetCustomAttribute(prop, typeof(APXmlPropertyAttribute)) as APXmlPropertyAttribute;
				if (attr == null)
					continue;
				string name = attr.Name != null ? attr.Name : prop.Name;

				APValidatorAttribute validatorAttr = Attribute.GetCustomAttribute(prop, typeof(APValidatorAttribute)) as APValidatorAttribute;
				APValidatorBase validator = validatorAttr != null ? validatorAttr.ValidatorInstance : null;

				TypeConverterAttribute convertAttr = Attribute.GetCustomAttribute(prop, typeof(TypeConverterAttribute)) as TypeConverterAttribute;
				TypeConverter converter = convertAttr != null ? (TypeConverter)Activator.CreateInstance(Type.GetType(convertAttr.ConverterTypeName), true) : null;

				APXmlProperty property = new APXmlProperty(name, prop.PropertyType, attr.DefaultValue, converter, validator, attr.Options);

				property.CollectionAttribute = Attribute.GetCustomAttribute(prop, typeof(APXmlCollectionAttribute)) as APXmlCollectionAttribute;
				_properties.Add(property);
			}
		}
Beispiel #3
0
        public APXmlElementMap(Type type)
        {
            _properties = new APXmlPropertyCollection();

            _collectionAttribute = Attribute.GetCustomAttribute(type, typeof(APXmlCollectionAttribute)) as APXmlCollectionAttribute;

            PropertyInfo[] props = type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static | BindingFlags.Instance);

            foreach (PropertyInfo prop in props)
            {
                APXmlPropertyAttribute attr = Attribute.GetCustomAttribute(prop, typeof(APXmlPropertyAttribute)) as APXmlPropertyAttribute;
                if (attr == null)
                {
                    continue;
                }
                string name = attr.Name != null ? attr.Name : prop.Name;

                APValidatorAttribute validatorAttr = Attribute.GetCustomAttribute(prop, typeof(APValidatorAttribute)) as APValidatorAttribute;
                APValidatorBase      validator     = validatorAttr != null ? validatorAttr.ValidatorInstance : null;

                TypeConverterAttribute convertAttr = Attribute.GetCustomAttribute(prop, typeof(TypeConverterAttribute)) as TypeConverterAttribute;
                TypeConverter          converter   = convertAttr != null ? (TypeConverter)Activator.CreateInstance(Type.GetType(convertAttr.ConverterTypeName), true) : null;

                APXmlProperty property = new APXmlProperty(name, prop.PropertyType, attr.DefaultValue, converter, validator, attr.Options);

                property.CollectionAttribute = Attribute.GetCustomAttribute(prop, typeof(APXmlCollectionAttribute)) as APXmlCollectionAttribute;
                _properties.Add(property);
            }
        }
		static APRptConditionDef()
		{
			logicProp = new APXmlProperty("logic", typeof(string), "");
			rpnProp = new APXmlProperty("rpn", typeof(string), "");
			filtersProp = new APXmlProperty("", typeof(APRptFilterDefCollection), null, APXmlPropertyOptions.IsDefaultCollection);

			properties = new APXmlPropertyCollection();
			properties.Add(logicProp);
			properties.Add(rpnProp);
			properties.Add(filtersProp);
		}
Beispiel #5
0
		static APRptOrderDef()
		{
			columnIdProp = new APXmlProperty("columnId", typeof(string), "", APXmlPropertyOptions.IsRequired | APXmlPropertyOptions.IsKey);
			accordingProp = new APXmlProperty("according", typeof(APSqlOrderAccording), APSqlOrderAccording.Asc,
				new GenericEnumAPConverter(typeof(APSqlOrderAccording)),
				APCVHelper.DefaultValidator,
				APXmlPropertyOptions.IsRequired);

			properties = new APXmlPropertyCollection();
			properties.Add(columnIdProp);
			properties.Add(accordingProp);
		}
Beispiel #6
0
		static APRptViewDef()
		{
			nameProp = new APXmlProperty("name", typeof(string), "");
			refersProp = new APXmlProperty("refers", typeof(APRptReferDefCollection));
			ordersProp = new APXmlProperty("orders", typeof(APRptOrderDefCollection));
			conditionProp = new APXmlProperty("condition", typeof(APRptConditionDef));

			properties = new APXmlPropertyCollection();
			properties.Add(nameProp);
			properties.Add(refersProp);
			properties.Add(ordersProp);
			properties.Add(conditionProp);
		}
Beispiel #7
0
		static APRptFilterDef()
		{
			serialProp = new APXmlProperty("serial", typeof(string), "", APXmlPropertyOptions.IsRequired | APXmlPropertyOptions.IsKey);
			columnIdProp = new APXmlProperty("columnId", typeof(string), "", APXmlPropertyOptions.IsRequired);
			comparatorProp = new APXmlProperty("comparator", typeof(APRptFilterComparator), APRptFilterComparator.Equals,
				new GenericEnumAPConverter(typeof(APRptFilterComparator)),
				APCVHelper.DefaultValidator,
				APXmlPropertyOptions.IsRequired);
			valuesProp = new APXmlProperty("values", typeof(string), "");

			properties = new APXmlPropertyCollection();
			properties.Add(serialProp);
			properties.Add(columnIdProp);
			properties.Add(comparatorProp);
			properties.Add(valuesProp);
		}
Beispiel #8
0
        /// <summary>
        /// Writes the contents of this element to the file when implemented in a derived class.
        /// </summary>
        /// <param name="writer">The XmlWriter that writes to the file.</param>
        /// <param name="serializeCollectionKey">true to serialize only the collection key properties; otherwise, false.</param>
        /// <returns>true if any data was actually serialized; otherwise, false.</returns>
        protected internal virtual bool SerializeElement(XmlWriter writer, bool serializeCollectionKey)
        {
            PreSerialize(writer);

            if (serializeCollectionKey)
            {
                APXmlPropertyCollection props = GetKeyProperties();
                foreach (APXmlProperty prop in props)
                {
                    writer.WriteAttributeString(prop.Name, prop.ConvertToString(this[prop.Name]));
                }
                return(props.Count > 0);
            }

            bool wroteData = false;

            foreach (APXmlPropertyInformation prop in ElementInformation.Properties)
            {
                if (prop.IsElement || prop.ValueOrigin == APXmlPropertyValueOrigin.Default)
                {
                    continue;
                }

                if (!object.Equals(prop.Value, prop.DefaultValue))
                {
                    writer.WriteAttributeString(prop.Name, prop.GetStringValue());
                    wroteData = true;
                }
            }

            foreach (APXmlPropertyInformation prop in ElementInformation.Properties)
            {
                if (!prop.IsElement)
                {
                    continue;
                }

                APXmlElement val = prop.Value as APXmlElement;
                if (val != null)
                {
                    wroteData = val.SerializeToXmlElement(writer, prop.Name) || wroteData;
                }
            }

            return(wroteData);
        }
Beispiel #9
0
        internal APXmlPropertyCollection GetKeyProperties()
        {
            if (_keyProps != null)
            {
                return(_keyProps);
            }

            APXmlPropertyCollection tmpkeyProps = new APXmlPropertyCollection();

            foreach (APXmlProperty prop in Properties)
            {
                if (prop.IsKey)
                {
                    tmpkeyProps.Add(prop);
                }
            }

            return(_keyProps = tmpkeyProps);
        }
Beispiel #10
0
		static APRptReportDef()
		{
			nameProp = new APXmlProperty("name", typeof(string), "");
			refersProp = new APXmlProperty("refers", typeof(APRptReferDefCollection));
			ordersProp = new APXmlProperty("orders", typeof(APRptOrderDefCollection));
			groupsProp = new APXmlProperty("groups", typeof(APRptGroupDefCollection));
			conditionProp = new APXmlProperty("condition", typeof(APRptConditionDef));
			showSummaryProp = new APXmlProperty("showSummary", typeof(bool), true);
			frameColumnIdProp = new APXmlProperty("frameColumnId", typeof(string), "");
			frameBeginProp = new APXmlProperty("frameBegin", typeof(string), "");
			frameEndProp = new APXmlProperty("frameEnd", typeof(string), "");

			properties = new APXmlPropertyCollection();
			properties.Add(nameProp);
			properties.Add(refersProp);
			properties.Add(ordersProp);
			properties.Add(groupsProp);
			properties.Add(showSummaryProp);
			properties.Add(frameColumnIdProp);
			properties.Add(frameBeginProp);
			properties.Add(frameEndProp);
			properties.Add(conditionProp);
		}
		static APRptReferDefCollection()
		{
			properties = new APXmlPropertyCollection();
		}
		static APRptGroupDefCollection()
		{
			properties = new APXmlPropertyCollection();
		}
Beispiel #13
0
		internal APXmlPropertyCollection GetKeyProperties()
		{
			if (_keyProps != null)
				return _keyProps;

			APXmlPropertyCollection tmpkeyProps = new APXmlPropertyCollection();

			foreach (APXmlProperty prop in Properties)
			{
				if (prop.IsKey)
					tmpkeyProps.Add(prop);
			}

			return _keyProps = tmpkeyProps;
		}