Esempio n. 1
0
        protected virtual async Task OnInitiativeLogged(InitiativeLoggedEventArgs args, CancellationToken token)
        {
            if (args == null)
            {
                throw new ArgumentNullException("args");
            }
            if (args.Initiative == null)
            {
                throw new ArgumentException("Initiative cannot be null");
            }

            using (LogContext.PushProperty("InitiativeId", args.Initiative.Id))
            {
                _logger.Information("Recieved message that initiative {InitiativeId} has been logged", args.Initiative.Id);

                if (args.SkipEmailNotification)
                {
                    _logger.Information("Skipping initiative {InitiativeId} because SkipEmailNotification was specified", args.Initiative.Id);
                    return;
                }

                Stopwatch watch = new Stopwatch();
                watch.Start();

                var mergeTemplate = await GetMessageTemplate();

                if (mergeTemplate != null)
                {
                    string ideaRange = args.RangeUpdated;

                    IDictionary <string, object> ideaData = await GetInitiativeData(ideaRange, mergeTemplate, args.Initiative.Id);

                    if (ideaData != null)
                    {
                        await _emailService.SendEmailAsync(mergeTemplate, ideaData);

                        _logger.Information("Email Notification sent. Time Elapsed: {ElapsedMilliseconds}ms", watch.ElapsedMilliseconds);
                    }
                }
            }
        }
Esempio n. 2
0
 public Task SendInitiativeLoggedAsync(InitiativeLoggedEventArgs args)
 {
     // Not applicable to Remedy tests
     throw new System.NotImplementedException();
 }