/////////////////////////////////////////////////////////////////////////////////////////////////// ////////////BUILD FROM MUTABLE OBJECT ////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// #region Constructors and Destructors /// <summary> /// Initializes a new instance of the <see cref="ReleaseCalendarCore"/> class. /// </summary> /// <param name="mutable"> /// The mutable. /// </param> /// <param name="parent"> /// The parent. /// </param> public ReleaseCalendarCore(IReleaseCalendarMutableObject mutable, IContentConstraintObject parent) : base(SdmxStructureType.GetFromEnum(SdmxStructureEnumType.ReleaseCalendar), parent) { if (mutable != null) { this.offset = mutable.Offset; this.periodicity = mutable.Periodicity; this.tolerance = mutable.Tolerance; } }
/// <summary> /// Write ReleaseCalendar /// </summary> /// <param name="releaseCalendar"> /// The IReleaseCalendarMutableObject to write /// </param> private void WriteReleaseCalendar(IReleaseCalendarMutableObject releaseCalendar) { if (releaseCalendar != null) { this.WriteStartElement(this._commonPrefix, ElementNameTable.ReleaseCalendar); this.TryToWriteElement(this._commonPrefix, ElementNameTable.Periodicity, releaseCalendar.Periodicity); this.TryToWriteElement(this._commonPrefix, ElementNameTable.Offset, releaseCalendar.Offset); this.TryToWriteElement(this._commonPrefix, ElementNameTable.Tolerance, releaseCalendar.Tolerance); this.WriteEndElement(); } }
/// <summary> /// Handle <see cref="IReleaseCalendarMutableObject"/> Child elements /// </summary> /// <param name="parent"> /// The parent <see cref="IReleaseCalendarMutableObject"/> object /// </param> /// <param name="localName"> /// The name of the current xml element /// </param> private void HandleTextChildElement(IReleaseCalendarMutableObject parent, object localName) { if (NameTableCache.IsElement(localName, ElementNameTable.Periodicity)) { parent.Periodicity = this.Text; } else if (NameTableCache.IsElement(localName, ElementNameTable.Offset)) { parent.Offset = this.Text; } else if (NameTableCache.IsElement(localName, ElementNameTable.Tolerance)) { parent.Tolerance = this.Text; } }