private void NotifyOnMail(User user, INotificationInfo notificationInfo)
        {
            var messageContent   = _messageMapper.MapNotification(notificationInfo, user.UserProfile.Name);
            var notificationType = notificationInfo.GetNotificationType();

            _sender.SendMessage(user.UserProfile.Email, messageContent, _messageThemes[notificationType]);
        }
        private void NotifySubscriber(int userId, INotificationInfo notificationInfo)
        {
            var user     = _userRepository.GetUserById(userId);
            var settings = user.NotificationsSettings.Settings;

            var doesSubscribedOnSite =
                settings[notificationInfo.GetNotificationType()].Equals(NotificationValue.OnSite) ||
                settings[notificationInfo.GetNotificationType()].Equals(NotificationValue.Everywhere);
            var doesSubscribedOnMail =
                settings[notificationInfo.GetNotificationType()].Equals(NotificationValue.ToMail) ||
                settings[notificationInfo.GetNotificationType()].Equals(NotificationValue.Everywhere);

            if (doesSubscribedOnSite)
            {
                NotifyOnSite(user, notificationInfo);
            }

            if (doesSubscribedOnMail)
            {
                NotifyOnMail(user, notificationInfo);
            }
        }
Ejemplo n.º 3
0
 public Notification(INotificationInfo notificationInfo)
 {
     OccurredOn       = DateTimeOffset.Now;
     NotificationInfo = JsonConvert.SerializeObject(notificationInfo);
     NotificationType = notificationInfo.GetNotificationType();
 }
Ejemplo n.º 4
0
 public GroupMessage(INotificationInfo notificationInfo, int id, DateTimeOffset sentOn)
     : base(id, sentOn)
 {
     NotificationType = notificationInfo.GetNotificationType();
     NotificationInfo = JsonConvert.SerializeObject(notificationInfo);
 }
Ejemplo n.º 5
0
 public GroupMessage(INotificationInfo notificationInfo)
 {
     SentOn           = DateTimeOffset.UtcNow;
     NotificationType = notificationInfo.GetNotificationType();
     NotificationInfo = JsonConvert.SerializeObject(notificationInfo);
 }