Writes the results of fault analysis to an email.
Inheritance: IDataWriter
Exemplo n.º 1
0
        // Static Methods
        private static void Initialize(EventEmailWriter writer, MeterDataSet meterDataSet)
        {
            bool configurationChanged =
                s_dbConnectionString != writer.DbConnectionString ||
                s_timeTolerance != writer.TimeTolerance ||
                s_smtpServer != writer.EmailSettings.SMTPServer ||
                s_fromAddress != writer.EmailSettings.FromAddress ||
                s_username != writer.EmailSettings.Username ||
                s_password != writer.EmailSettings.SecurePassword ||
                s_enableSSL != writer.EmailSettings.EnableSSL ||
                s_minWaitPeriod != TimeSpan.FromSeconds(writer.EventEmailSettings.MinWaitPeriod) ||
                s_maxWaitPeriod != TimeSpan.FromSeconds(writer.EventEmailSettings.MaxWaitPeriod) ||
                s_timeZone.Id != writer.XDATimeZone;

            if (configurationChanged)
            {
                EmailProcessingThread.Push(() =>
                {
                    s_dbConnectionString = writer.DbConnectionString;
                    s_timeTolerance      = writer.TimeTolerance;
                    s_smtpServer         = writer.EmailSettings.SMTPServer;
                    s_fromAddress        = writer.EmailSettings.FromAddress;
                    s_username           = writer.EmailSettings.Username;
                    s_password           = writer.EmailSettings.SecurePassword;
                    s_enableSSL          = writer.EmailSettings.EnableSSL;
                    s_minWaitPeriod      = TimeSpan.FromSeconds(writer.EventEmailSettings.MinWaitPeriod);
                    s_maxWaitPeriod      = TimeSpan.FromSeconds(writer.EventEmailSettings.MaxWaitPeriod);
                    s_timeZone           = TimeZoneInfo.FindSystemTimeZoneById(writer.XDATimeZone);
                    s_connectionFactory  = meterDataSet.CreateDbConnection;
                });
            }
        }
Exemplo n.º 2
0
        // Static Methods
        private static void Initialize(EventEmailWriter writer)
        {
            bool configurationChanged =
                s_timeTolerance != writer.TimeTolerance ||
                s_smtpServer != writer.EmailSettings.SMTPServer ||
                s_fromAddress != writer.EmailSettings.FromAddress ||
                s_username != writer.EmailSettings.Username ||
                s_password != writer.EmailSettings.SecurePassword ||
                s_enableSSL != writer.EmailSettings.EnableSSL ||
                s_waitPeriod != TimeSpan.FromSeconds(writer.FaultEmailSettings.WaitPeriod) ||
                s_timeZone.Id != writer.XDATimeZone;


            if (configurationChanged)
            {
                ProcessQueue.Add(() =>
                {
                    s_timeTolerance = writer.TimeTolerance;
                    s_smtpServer    = writer.EmailSettings.SMTPServer;
                    s_fromAddress   = writer.EmailSettings.FromAddress;
                    s_username      = writer.EmailSettings.Username;
                    s_password      = writer.EmailSettings.SecurePassword;
                    s_enableSSL     = writer.EmailSettings.EnableSSL;
                    s_waitPeriod    = TimeSpan.FromSeconds(writer.FaultEmailSettings.WaitPeriod);
                    s_timeZone      = TimeZoneInfo.FindSystemTimeZoneById(writer.XDATimeZone);
                });
            }

            if ((object)s_dbAdapterContainer == null)
            {
                ProcessQueue.Add(() =>
                {
                    if ((object)s_dbAdapterContainer != null && s_dbAdapterContainer.Connection.State.HasFlag(ConnectionState.Open))
                    {
                        return;
                    }

                    using (s_dbAdapterContainer)
                    {
                        s_dbAdapterContainer = new DbAdapterContainer(writer.DbConnectionString);
                    }
                });
            }
        }
        // Static Methods
        private static void Initialize(EventEmailWriter writer)
        {
            bool configurationChanged =
                s_timeTolerance != writer.TimeTolerance ||
                s_smtpServer != writer.EmailSettings.SMTPServer ||
                s_fromAddress != writer.EmailSettings.FromAddress ||
                s_username != writer.EmailSettings.Username ||
                s_password != writer.EmailSettings.SecurePassword ||
                s_enableSSL != writer.EmailSettings.EnableSSL ||
                s_waitPeriod != TimeSpan.FromSeconds(writer.FaultEmailSettings.WaitPeriod) ||
                s_timeZone.Id != writer.XDATimeZone;


            if (configurationChanged)
            {
                ProcessQueue.Add(() =>
                {
                    s_timeTolerance = writer.TimeTolerance;
                    s_smtpServer = writer.EmailSettings.SMTPServer;
                    s_fromAddress = writer.EmailSettings.FromAddress;
                    s_username = writer.EmailSettings.Username;
                    s_password = writer.EmailSettings.SecurePassword;
                    s_enableSSL = writer.EmailSettings.EnableSSL;
                    s_waitPeriod = TimeSpan.FromSeconds(writer.FaultEmailSettings.WaitPeriod);
                    s_timeZone = TimeZoneInfo.FindSystemTimeZoneById(writer.XDATimeZone);
                });
            }

            if ((object)s_dbAdapterContainer == null)
            {
                ProcessQueue.Add(() =>
                {
                    if ((object)s_dbAdapterContainer == null)
                        s_dbAdapterContainer = new DbAdapterContainer(writer.DbConnectionString);
                });
            }
        }