Пример #1
0
        internal override XsdNs.AbstractDataComponentType GetObjectForXml_DataRecordField(string idPrefix)
        {
            var proxy = new XsdNs.QuantityRangeType
            {
                uom = new XsdNs.UnitReference()
                {
                    code = UnitOfMeasure
                },
                ValuesHelper = new System.Collections.Generic.List <double> {
                    LowerBound, UpperBound
                }
            };

            return(proxy);
        }
Пример #2
0
        /// <summary>
        /// Constructor. Use this to instantiate an item from XML (a result or data record field).
        /// </summary>
        /// <param name="el">XML proxy.</param>
        /// <exception cref="XNeut.InvalidMessageException">Thrown if an error is encountered.</exception>
        internal Item_MeasurementRange(XsdNs.QuantityRangeType el)
            : base(XNeut.Helper.TypeUri_MeasurementRange)
        {
            // If "uom" is null, assign null; otherwise, assign "code"
            UnitOfMeasure = el.uom?.code;

            if (el.ValuesHelper == null || el.ValuesHelper.Count != 2)
            {
                throw new XNeut.InvalidMessageException("Expected exactly 2 values in range");
            }

            LowerBound = el.ValuesHelper[0];
            UpperBound = el.ValuesHelper[1];

            if (LowerBound > UpperBound)
            {
                throw new XNeut.InvalidMessageException("Lower bound of range must be lower than or equal to the upper bound");
            }
        }