Ejemplo n.º 1
0
        /// <summary>
        ///


        public static void LogMessage(string message, int error, bool verbose)
        {
            if (!Connected)
            {
                return;
            }

            System.Diagnostics.Debug.Assert(ETLController.connection.State == ConnectionState.Open);

            ControllerMessage msg = new ControllerMessage();

            msg.Message = message;
            msg.Error   = error;

            if (verbose || (ETLController.Header.Options & 1) == 1)
            {
                string infoXML = ControllerProcessInfo.build(ETLController.Header, msg);
                ETLController.print.Parameters["@pProcessInfo"].Value = infoXML;
                try
                {
                    ETLController.print.ExecuteNonQuery();
                    int retval = Convert.ToInt32(ETLController.print.Parameters["@RTC"].Value, CultureInfo.InvariantCulture);
                    if (retval != 0)
                    {
                        throw new CouldNotSendMessage(message);
                    }
                }
                catch (Exception e)
                {
                    throw new CouldNotSendMessage(e.Message, e);
                }
            }
        }
Ejemplo n.º 2
0
        public static string build(ControllerHeader header, ControllerMessage message)
        {
            ControllerProcessInfo processInfo = new ControllerProcessInfo();

            processInfo.Header  = header;
            processInfo.Message = message;
            XmlSerializer serparam = new XmlSerializer(typeof(ControllerProcessInfo));
            StringWriter  sw       = new StringWriter();

            serparam.Serialize(sw, processInfo);
            return(sw.ToString());
        }