Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="proxy">XML proxy.</param>
        /// <exception cref="XNeut.InvalidMessageException">Thrown if an error is encountered.</exception>
        internal QuantityValue(XsdNs.QuantityValueType proxy)
        {
            // Quantity string
            if (proxy.QuantityString == null)
            {
                throw new XNeut.InvalidMessageException("Quantity value is required");
            }

            RawQuantityString = string.IsNullOrEmpty(proxy.QuantityString.Value) ? "" : proxy.QuantityString.Value;

            // Data type
            if (proxy.DataType != null)
            {
                DataType = new DataType(proxy.DataType); // throws InvalidMessageException
            }
            else
            {
                DataType = null;
            }

            // Unit of measure
            UnitOfMeasure = proxy.UnitOfMeasure?.Value;

            // Key
            if (proxy.Key != null)
            {
                Key = new IdentifierType(proxy.Key);
            }
            else
            {
                Key = null;
            }
        }
Ejemplo n.º 2
0
        private XsdNs.QuantityValueType[] BuildQuantitiesForProxy()
        {
            var retval = new XsdNs.QuantityValueType[Quantities.Count];

            for (int a = 0; a < Quantities.Count; ++a)
            {
                retval[a] = Quantities[a].ToXmlProxy();
            }

            return(retval);
        }