Ejemplo n.º 1
0
        /// <summary>
        /// Constructor. Use this to instantiate an item from XML (data record field).
        /// </summary>
        /// <param name="el">XML data.</param>
        /// <exception cref="XNeut.InvalidMessageException">Thrown if an error is encountered.</exception>
        internal Item_Boolean(XsdNs.BooleanType el) : base(XNeut.Helper.TypeUri_Truth)
        {
            if (!el.valueSpecified)
            {
                throw new XNeut.InvalidMessageException("Value must be specified for the boolean type");
            }

            Value = el.value;
        }
Ejemplo n.º 2
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);
            }