コード例 #1
0
ファイル: NotificationJob.cs プロジェクト: litfung/travely
        public async Task ExecuteAsync(NotificationJobParameter parameter)
        {
            var notificationModel = await _notificationService.GetNotification(parameter.ScheduleId);

            var statusResponse = await _notifierService.NotifyAsync(notificationModel);

            //TODO: Update schedule users statuses
            //_notificationService.UpdateNotification(statusResponse);
        }
コード例 #2
0
 protected async Task NotifyAsync(INotifierService service, NotifierData data)
 {
     try
     {
         await service.NotifyAsync(data);
     }
     catch (Exception ex)
     {
         _logger.Error <NotificationsService>(ex);
     }
 }
コード例 #3
0
        public async Task ExecuteAsync(NotificationJobParameter parameter)
        {
            var notificationModel = await _notificationService.GetNotification(parameter.ScheduleId);

            var succeededUsers = await _notifierService.NotifyAsync(notificationModel);

            //TODO: delete converting to int when notifier will return list of integers
            var succeededUserIds = succeededUsers.Select(s => Convert.ToInt64(s)).ToList();
            var failedUsers      = notificationModel.UserIds.Except(succeededUserIds);

            //Update Users statuses
            _notificationService.SetNotificationStatus(NotificationStatus.Succeeded, notificationModel.ScheduleId, succeededUserIds.ToArray());
            _notificationService.SetNotificationStatus(NotificationStatus.Failed, notificationModel.ScheduleId, failedUsers.ToArray());
        }