Example #1
0
        /// <summary>
        /// Generates an XML proxy from the object.
        /// </summary>
        /// <returns>XML proxy.</returns>
        internal XsdNs.QuantityValueType ToXmlProxy()
        {
            // Create proxy for unit of measure if specified
            XsdNs.UnitOfMeasureType unitOfMeasProxy = UnitOfMeasure == null ? null :
                                                      new XsdNs.UnitOfMeasureType()
            {
                Value = UnitOfMeasure
            };

            // Create proxy for key if specified
            XsdNs.IdentifierType keyProxy = null;

            if (Key != null)
            {
                keyProxy = new XsdNs.IdentifierType();
                Key.PopulateXmlProxy(keyProxy);
            }

            return(new XsdNs.QuantityValueType()
            {
                // Data type
                DataType = DataType?.ToXmlProxy(),

                // Quantity string
                QuantityString = new XsdNs.QuantityStringType()
                {
                    Value = RawQuantityString
                },

                // Unit of measure
                UnitOfMeasure = unitOfMeasProxy,

                // Key
                Key = keyProxy
            });
        }
Example #2
0
        /// <summary>
        /// Generates an XML proxy from the object.
        /// </summary>
        /// <param name="extraTypes">Any extra types utilised in serialisation.</param>
        /// <returns>Proxy.</returns>
        internal XsdNs.ProductionRequestType ToXmlProxy(out ICollection <Type> extraTypes)
        {
            object parametersProxy = null;

            // Scheduling parameters specified?
            if (SchedulingParameters != null)
            {
                parametersProxy = SchedulingParameters;

                // Assuming that the parameters use an extra type
                extraTypes = new List <Type> {
                    SchedulingParameters.GetType()
                };
            }
            else
            {
                // No extra types used
                extraTypes = new List <Type>();
            }

            XsdNs.IdentifierType identifier = null;

            if (Identifier != null)
            {
                identifier = new XsdNs.IdentifierType();
                Identifier.PopulateXmlProxy(identifier);
            }

            return(new XsdNs.ProductionRequestType()
            {
                ID = identifier,                                  // Can be null
                HierarchyScope = HierarchyScopeObj?.ToXmlProxy(), // Can be null
                SegmentRequirement = BuildSegmentRequirementsForProxy(),
                SchedulingParameters = parametersProxy
            });
        }
Example #3
0
 /// <summary>
 /// Populates an XML proxy from the object.
 /// </summary>
 /// <param name="proxy">The proxy to be populated. This is necessary, because the
 /// populated proxy is of a base type inapplicable in serialisation.</param>
 internal void PopulateXmlProxy(XsdNs.IdentifierType proxy)
 {
     proxy.Value = Value;
 }
Example #4
0
 /// <summary>
 /// Constructor.
 /// </summary>
 /// <param name="proxy">XML proxy.</param>
 /// <exception cref="XNeut.InvalidMessageException">Thrown if an error is encountered.</exception>
 internal IdentifierType(XsdNs.IdentifierType proxy)
 {
     // The type is normalizedString -> remove whitespaces
     Value = proxy.Value == null ? "" : proxy.Value.Trim();
 }