Beispiel #1
0
        public static NotificationProvider LoadNotificationProvider(string connectionString, int SQLCommandTimeout)
        {
            NotificationProvider provider = new NotificationProvider(SQLCommandTimeout);

            try
            {
                if (!string.IsNullOrEmpty(connectionString))
                {
                    // Retrieve server information.
                    LOG.Info("Retrieve NotificationProvider");

                    using (SqlConnection connection = new SqlConnection(connectionString)
                           )
                    {
                        // Open the connection.
                        connection.Open();

                        using (SqlDataReader rdr = provider.ExecuteLocalReader(connection, null, CommandType.Text,
                                                                               QueryGetNotificationProvider, null))
                        {
                            while (rdr.Read())
                            {
                                provider.setValues(rdr);
                            }
                        }
                    }
                }
            }
            catch (SqlException ex)
            {
                LOG.Error(string.Format("Error loading Notification Provider: {0}", ex.ToString()));
            }
            catch (Exception ex)
            {
                LOG.Error(string.Format("Error loading Notification Provider: {0}", ex.ToString()));
            }

            return(provider);
        }
Beispiel #2
0
 public void RefreshNotificationProvider()
 {
     m_notificationProvider = Idera.SQLsecure.Core.Accounts.NotificationProvider.LoadNotificationProvider(m_ConnectionStringBuilder.ConnectionString, Utility.SQLCommandTimeout.GetSQLCommandTimeoutFromRegistry());
 }