private async Task CreateNotification(IMessageContext context, ReportAddedToIncident e, int accountId,
                                       NotificationState state)
 {
     if (state == NotificationState.Email)
     {
         var email = new SendIncidentEmail(_configuration);
         await email.SendAsync(context, accountId.ToString(), e.Incident, e.Report);
     }
     else
     {
         var handler = new SendIncidentSms(_userRepository, _configuration);
         await handler.SendAsync(accountId, e.Incident, e.Report);
     }
 }
Exemplo n.º 2
0
 private async Task CreateNotification(ReportAddedToIncident e, int accountId,
                                       NotificationState state)
 {
     if (state == NotificationState.Email)
     {
         var email = new SendIncidentEmail(_commandBus);
         await email.SendAsync(accountId.ToString(), e.Incident, e.Report);
     }
     else
     {
         var handler = new SendIncidentSms(_userRepository);
         await handler.SendAsync(accountId, e.Incident, e.Report);
     }
 }
Exemplo n.º 3
0
 private async Task CreateNotification(IMessageContext context, ReportAddedToIncident e, int accountId,
                                       NotificationState state)
 {
     if (state == NotificationState.BrowserNotification)
     {
         var notification = new Notification($"Application: {e.Incident.ApplicationName}\r\n{e.Incident.Name}");
         notification.Actions.Add(new NotificationAction()
         {
             Title  = "Assign to me",
             Action = "AssignToMe"
         });
         notification.Actions.Add(new NotificationAction()
         {
             Title  = "View",
             Action = "View"
         });
         notification.Icon      = "/favicon-32x32.png";
         notification.Timestamp = e.Report.CreatedAtUtc;
         notification.Title     = e.IsNewIncident == true
             ? "New incident"
             : "Re-opened incident";
         notification.Data = new
         {
             applicationId = e.Incident.ApplicationId,
             incidentId    = e.Incident.Id
         };
         await _notificationService.SendBrowserNotification(accountId, notification);
     }
     else if (state == NotificationState.Email)
     {
         var email = new SendIncidentEmail(_configuration);
         await email.SendAsync(context, accountId.ToString(), e.Incident, e.Report);
     }
     else
     {
         var handler = new SendIncidentSms(_userRepository, _configuration);
         await handler.SendAsync(accountId, e.Incident, e.Report);
     }
 }