Beispiel #1
0
        override internal XsdNs.AbstractDataComponentType GetObjectForXml_DataRecordField(string idPrefix)
        {
            var quantity = new XsdNs.QuantityType
            {
                uom            = new XsdNs.UnitReference(),
                value          = Value,
                valueSpecified = true
            };

            quantity.uom.code = UnitOfMeasure;

            return(quantity);
        }
Beispiel #2
0
        /// <summary>
        /// Constructor. Use this to instantiate an item from XML (data record field).
        /// </summary>
        /// <param name="el">XML data.</param>
        internal Item_Measurement(XsdNs.QuantityType el) : base(XNeut.Helper.TypeUri_Measurement)
        {
            try
            {
                if (!el.valueSpecified)
                {
                    throw new XNeut.InvalidMessageException("Measurement: value not specified");
                }

                UnitOfMeasure = el.uom.code;
                Value         = el.value;
            }
            catch (NullReferenceException e)
            {
                throw new XNeut.InvalidMessageException("Failed to read measurement (something missing?)", e);
            }
        }
Beispiel #3
0
            private XsdNs.AbstractSimpleComponentType GetValueProxy()
            {
                XsdNs.AbstractSimpleComponentType retval = null;

                if (DataType.Equals(typeof(string)))
                {
                    retval = new XsdNs.TextType();
                }
                else if (DataType.Equals(typeof(bool)))
                {
                    retval = new XsdNs.BooleanType();
                }
                else if (DataType.Equals(typeof(long)))
                {
                    retval = new XsdNs.CountType();
                }
                else if (DataType.Equals(typeof(double)))
                {
                    retval = new XsdNs.QuantityType()
                    {
                        uom = new XsdNs.UnitReference()
                        {
                            code = UnitOfMeasure
                        }
                    };
                }
                else if (DataType.Equals(typeof(DateTime)))
                {
                    retval = new XsdNs.TimeType1()
                    {
                        // The XML schema requires this "uom" element here
                        uom = new XsdNs.UnitReference()
                    };
                }
                else
                {
                    throw new ArgumentException("Unexpected column type " + DataType.ToString());
                }

                // Assign descrition and label
                retval.label       = Label;
                retval.description = Description;
                return(retval);
            }