Esempio n. 1
0
        internal bool InitializeAlerts(AlertHandlerConfiguration configuration)
        {
            try
            {
                var submittedAlerts = new List <IAlertModel>();
                foreach (var alertExpressionModel in configuration.Alerts)
                {
                    var senders = alertExpressionModel.Senders
                                  .Select(alertSenderConfiguration => _alertAlertSenderManager.Parse(alertSenderConfiguration))
                                  .ToList();
                    submittedAlerts.Add(new AlertModel
                    {
                        Condition = alertExpressionModel.Expressions.Build(),
                        Senders   = senders
                    });
                }

                _alertTableMock.Create(configuration.Alerts);
                _alerts = submittedAlerts;
                return(true);
            }
            catch (Exception exception)
            {
                const string message = "Alert initialization failed.";
                _activityMonitor.Fatal(message, exception);
                return(false);
            }
        }
Esempio n. 2
0
 public AlertHandler(AlertHandlerConfiguration alertHandlerConfiguration)
 {
     _memoryStream            = new MemoryStream();
     _binaryReader            = new CKBinaryReader(_memoryStream, Encoding.UTF8, true);
     _alertAlertSenderManager = new AlertSenderManager();
     _alertTableMock          = new AlertTableMock(alertHandlerConfiguration.DatabasePath);
     InitializeAlerts(alertHandlerConfiguration);
 }