/// <summary> /// Constructor. Use this to instantiate an item from XML (data record field). /// </summary> /// <param name="el">XML contents.</param> internal Item_TimeInstant(XsdNs.TimeType1 el) : base(XNeut.Helper.TypeUri_Temporal) { // DataRecord uses this ctor. try { string valueRaw = el.value; Value = XNeut.Helper.DateTimeFromString(valueRaw); } catch (FormatException e) { throw new XNeut.InvalidMessageException("Failed to read time instant", e); } catch (NullReferenceException e) { throw new XNeut.InvalidMessageException("Failed to read time instant (something missing?)", e); } }
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); }