コード例 #1
0
        public async Task Handle(E2BSubmittedDomainEvent domainEvent, CancellationToken cancellationToken)
        {
            var config = await _configRepository.GetAsync(c => c.ConfigType == ConfigType.ReportInstanceNewAlertCount);

            var alertCount = 1;

            if (config != null)
            {
                alertCount = Convert.ToInt32(config.ConfigValue);
            }

            var summary                    = $"E2B submitted for report {domainEvent.ReportInstance.PatientIdentifier}";
            var notificationType           = NotificationType.FromName("Informational");
            var notificationClassification = NotificationClassification.FromName("E2BSubmitted");
            var contextRoute               = "/clinical/feedbacksearch";
            var newNotification            = new Notification(domainEvent.ReportInstance.CreatedBy, DateTime.Now.AddDays(alertCount), summary, "", notificationType, notificationClassification, contextRoute);

            await _notificationRepository.SaveAsync(newNotification);

            await _unitOfWork.CompleteAsync();
        }
        public async Task Handle(TaskAttendedToDomainEvent domainEvent, CancellationToken cancellationToken)
        {
            var config = await _configRepository.GetAsync(c => c.ConfigType == ConfigType.ReportInstanceNewAlertCount);

            var alertCount = 1;

            if (config != null)
            {
                alertCount = Convert.ToInt32(config.ConfigValue);
            }

            var summary                    = $"A task for a report for patient {domainEvent.Task.ReportInstance.PatientIdentifier} has been attended to";
            var notificationType           = NotificationType.FromName("Informational");
            var notificationClassification = NotificationClassification.FromName("AttendedToTask");
            var contextRoute               = $"/analytical/reporttask/{domainEvent.Task.ReportInstance.WorkFlow.WorkFlowGuid}/{domainEvent.Task.ReportInstance.Id}";
            var newNotification            = new Notification(domainEvent.Task.CreatedBy, DateTime.Now.AddDays(alertCount), summary, "", notificationType, notificationClassification, contextRoute);

            await _notificationRepository.SaveAsync(newNotification);

            await _unitOfWork.CompleteAsync();
        }
コード例 #3
0
        public async Task Handle(TaskCommentAddedDomainEvent domainEvent, CancellationToken cancellationToken)
        {
            var config = await _configRepository.GetAsync(c => c.ConfigType == ConfigType.ReportInstanceNewAlertCount);

            var alertCount = 1;

            if (config != null)
            {
                alertCount = Convert.ToInt32(config.ConfigValue);
            }

            var summary = $"Task comment has been added for patient {domainEvent.Comment.ReportInstanceTask.ReportInstance.PatientIdentifier}";
            var detail  = domainEvent.Comment.Comment.Length > 100 ? $"{domainEvent.Comment.Comment.Substring(0, 100)} ..." : domainEvent.Comment.Comment;

            var notificationType           = NotificationType.FromName("Informational");
            var notificationClassification = NotificationClassification.FromName("NewTaskComment");

            var newNotification = new Notification(GetDestinationUser(domainEvent), DateTime.Now.AddDays(alertCount), summary, detail, notificationType, notificationClassification, GetDestinationRoute(domainEvent));

            await _notificationRepository.SaveAsync(newNotification);

            await _unitOfWork.CompleteAsync();
        }