コード例 #1
0
        public IList <NotificationListItemModel> GetNotificationListItems(NotificationType[] notificationType, int?dayRange)
        {
            var notifications = NotificationServices.GetNotifications(CurrentCedUser.CurrentUser.Email, notificationType, dayRange);

            if (notifications != null)
            {
                foreach (var notif in notifications)
                {
                    notif.Description = _inAppNotificationHelper.GetDescription(notif);
                }
            }

            var listItems = Mapper.Map <IList <NotificationEntity>, IList <NotificationListItemModel> >(notifications);

            return(listItems);
        }
コード例 #2
0
        protected void PushRealTimeInAppNotification(EditionEntity edition, NotificationType notificationType, string recipients, string actorUserEmail)
        {
            // TODO: If there are no recipients then notifications are getting pushed to Admins.
            if (string.IsNullOrWhiteSpace(recipients))
            {
                recipients = WebConfigHelper.AdminEmails;
            }

            var notifDesc = _inAppNotificationHelper.GetDescription(edition, notificationType);

            if (notificationType == NotificationType.EditionUpdated)
            {
                notifDesc = notifDesc + " by " + CurrentCedUser.CurrentUser.FullName + " on " + DateTime.Now;
            }

            if (WebConfigHelper.RemoveActorUserFromNotificationRecipients)
            {
                recipients = NotificationControllerHelper.RemoveCurrentUserFromRecipients(recipients, actorUserEmail);
            }

            NotificationHub.PushNotification(recipients.Split(',').ToList(), notifDesc, null);
        }