/// <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);
        }
Пример #2
0
        /// <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);
        }
 /// <summary>
 /// Returns a <see cref="System.String"/> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String"/> that represents this instance.
 /// </returns>
 public override string ToString()
 {
     using (XmlWriterHelper helper = XmlWriterHelper.GetHelper())
     {
         this.WriteXmlElement(helper);
         return(helper.ToString());
     }
 }
Пример #4
0
 /// <summary>
 /// Returns a <see cref="System.String"/> that represents this instance.
 /// </summary>
 /// <returns>
 /// A <see cref="System.String"/> that represents this instance.
 /// </returns>
 public override string ToString()
 {
     using (XmlWriterHelper helper = XmlWriterHelper.GetHelper(true))
     {
         helper.WriteStartElement("Meters")
         .WriteAction((h) =>
         {
             foreach (PolledEventMessageMeter meter in _currentMeters.Values)
             {
                 meter.WriteXmlElement(h);
             }
         })
         .WriteEndElement();;
         return(helper.ToString());
     }
 }