Beispiel #1
0
        public async Task <ANotification_NotificationList> GetNotificationsAsync(bool?acknowledged, int recordCount)
        {
            using var log = BeginFunction(nameof(NotificationAdminService), nameof(GetNotificationsAsync), acknowledged, recordCount);
            try
            {
                await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false);

                var notifications  = new List <ANotification_Notification>();
                var mNotifications = await CommunicationMicroService.GetNotificationsAsync(recordCount, acknowledged).ConfigureAwait(false);

                foreach (var mNotification in mNotifications.Notifications)
                {
                    var mUser = mNotification.ParticipantReference != null && TryParseUserId.FromParticipantReference(mNotification.ParticipantReference, out string userId)
                        ? await UserMicroService.GetUserAsync(userId)
                        : null;

                    var notification = Create.ANotification_Notification(mNotification, mUser);
                    notifications.Add(notification);
                }

                var result = new ANotification_NotificationList()
                {
                    Notifications = notifications
                };

                log.Result(result);

                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }
Beispiel #2
0
        public async Task <ANotification_Notification> GetNotificationAsync(long notificationId)
        {
            using var log = BeginFunction(nameof(NotificationAdminService), nameof(GetNotificationAsync), notificationId);
            try
            {
                await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false);

                var mNotification = await CommunicationMicroService.GetNotificationAsync(notificationId).ConfigureAwait(false);

                var mUser = mNotification.ParticipantReference != null && TryParseUserId.FromParticipantReference(mNotification.ParticipantReference, out string userId)
                    ? await UserMicroService.GetUserAsync(userId)
                    : null;

                var result = Create.ANotification_Notification(mNotification, mUser);

                log.Result(result);

                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }
        public async Task <AAlert_AlertList> GetAlertsAsync(bool?acknowledged, int recordCount)
        {
            using var log = BeginFunction(nameof(AlertAdminService), nameof(GetAlertsAsync), acknowledged, recordCount);
            try
            {
                await Assert(SecurityPolicy.IsPrivileged).ConfigureAwait(false);

                var alerts  = new List <AAlert_Alert>();
                var mAlerts = await CommunicationMicroService.GetAlertsAsync(recordCount, acknowledged);

                foreach (var mAlert in mAlerts.Alerts)
                {
                    var mUser = mAlert.ParticipantReference != null && TryParseUserId.FromParticipantReference(mAlert.ParticipantReference, out string userId)
                        ? await UserMicroService.GetUserAsync(userId)
                        : null;

                    var alert = Create.AAlert_Alert(mAlert, mUser);
                    alerts.Add(alert);
                }

                var result = new AAlert_AlertList()
                {
                    Alerts = alerts
                };

                log.Result(result);

                return(result);
            }
            catch (Exception ex)
            {
                log.Exception(ex);
                throw;
            }
        }