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);
            }
        }
 public Notification(INotificationInfo notificationInfo)
 {
     OccurredOn       = DateTimeOffset.Now;
     NotificationInfo = JsonConvert.SerializeObject(notificationInfo);
     NotificationType = notificationInfo.GetNotificationType();
 }
 public GroupMessage(INotificationInfo notificationInfo, int id, DateTimeOffset sentOn)
     : base(id, sentOn)
 {
     NotificationType = notificationInfo.GetNotificationType();
     NotificationInfo = JsonConvert.SerializeObject(notificationInfo);
 }
 public GroupMessage(INotificationInfo notificationInfo)
 {
     SentOn           = DateTimeOffset.UtcNow;
     NotificationType = notificationInfo.GetNotificationType();
     NotificationInfo = JsonConvert.SerializeObject(notificationInfo);
 }