/// <summary>
 /// Returns a <see cref="System.String"/> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String"/> that represents this instance.
 /// </returns>
 internal void WriteXmlElement(XmlWriterHelper helper)
 {
     helper
        .WriteStartElement("M")
        .WriteAttribute("id", (int)this.Type)
        .WriteString(this.CoalesceValue)
        .WriteEndElement();
 }
 /// <summary>
 /// Gets the raw message internal.
 /// </summary>
 /// <param name="helper"></param>
 /// <returns></returns>
 /// <value>The raw message internal.</value>
 internal override string RawMessageDataInternal(XmlWriterHelper helper)
 {
     helper
        .WriteStartElement("counter")
        .WriteAttribute("counterid", (int)this.Type)
        .WriteString(this.CoalesceValue)
        .WriteEndElement();
     return string.Empty;
 }
 /// <summary>
 /// Gets the raw message internal.
 /// </summary>
 /// <value>The raw message internal.</value>
 internal virtual string RawMessageDataInternal(XmlWriterHelper helper)
 {
     return null;
 }
        /// <summary>
        /// Gets the raw message internal.
        /// </summary>
        /// <param name="helper"></param>
        /// <returns></returns>
        /// <value>The raw message internal.</value>
        internal override string RawMessageDataInternal(XmlWriterHelper helper)
        {
            string result = string.Empty;

            using (XmlWriterHelper helper2 = XmlWriterHelper.GetHelper())
            {
                try
                {
                    helper2
                        .WriteStartElement("Polled_Event")
                        .WriteElementString("Site_Code", this.SiteCode)
                        .WriteElementString("Bar_Pos", this.BarPosition)
                        .WriteElementString("Fault_Source", this.FaultSource)
                        .WriteElementString("Fault_Type", this.FaultType)
                        .WriteElementString("Installation", this.InstallationNo)
                        .WriteElementString("Serial_No", this.SerialNo)
                        .WriteElementString("Fault_Message", this.FaultMessage)
                        .WriteElementString("Date", this.Date, DATE_TIME_FORMAT)
                        .WriteElementString("Event_Value", this.EventValue)
                        .WriteAction((h) =>
                        {
                            this.Meters.RawMessageDataInternal(h);
                        })
                        .WriteElementString("Description", this.Description)
                        .WriteEndElement();
                }
                catch { }
                finally
                {
                    result = helper2.ToString();
                }
            }

            return result;
        }
        /// <summary>
        /// Gets the raw message internal.
        /// </summary>
        /// <param name="helper"></param>
        /// <returns></returns>
        /// <value>The raw message internal.</value>
        internal override string RawMessageDataInternal(XmlWriterHelper helper)
        {
            bool isNew = false;
            try
            {
                if (helper == null)
                {
                    isNew = true;
                    helper = XmlWriterHelper.GetHelper();
                }

                helper
                    .WriteStartElement("sector")
                    .WriteAction((h) =>
                    {
                        foreach (PolledEventMessageMeter meter in _currentMeters.Values)
                        {
                            meter.RawMessageDataInternal(h);
                        }
                    })
                    .WriteEndElement();
            }
            catch { }
            finally
            {
                if (isNew && helper != null)
                {
                    Extensions.DisposeObject(ref helper);
                }
            }
            return string.Empty;
        }