public void SaveNotificationEmail(NotificationEmail email)
 {
     Require.NotNull(email, nameof(email));
     _databaseSessionProvider.OpenSession();
     Session.Save(email);
     _databaseSessionProvider.CloseSession();
 }
 public void RemoveNotificationEmail(NotificationEmail notificationMail)
 {
     Require.NotNull(notificationMail, nameof(notificationMail));
     _databaseSessionProvider.OpenSession();
     Session.Delete(notificationMail);
     _databaseSessionProvider.CloseSession();
 }
        public void SendNotificationEmail(int[] userIds, IEventInfo eventInfo)
        {
            Require.NotEmpty(userIds, nameof(userIds));
            Require.NotNull(eventInfo, nameof(eventInfo));

            var description = _notificationEmailDescriber.Describe(eventInfo);
            var notificationMail = new NotificationEmail(userIds, description);
            _notificationMailRepository.SaveNotificationEmail(notificationMail);
        }
Exemplo n.º 4
0
        public void SendNotificationEmail(int[] userIds, IEventInfo eventInfo)
        {
            Require.NotEmpty(userIds, nameof(userIds));
            Require.NotNull(eventInfo, nameof(eventInfo));

            var description      = _notificationEmailDescriber.Describe(eventInfo);
            var notificationMail = new NotificationEmail(userIds, description);

            _notificationMailRepository.SaveNotificationEmail(notificationMail);
        }
Exemplo n.º 5
0
        private void SendMail(NotificationEmail notificationEmail)
        {
            var mail = new MailMessage
            {
                From = new MailAddress(_mailerSettings.From)
            };
            var client = _mailerSettings.GetSmtpClient();

            mail.Subject = MailingResources.NotificationMailCaption;
            mail.Body    = string.Format(MailingResources.NotificationMessageTemplate, notificationEmail.NotificationDescription);

            foreach (var emailAdress in notificationEmail.UserIds.ToArray().Select(userId => _userRepository.GetAccount(userId).Email))
            {
                mail.To.Add(emailAdress);

                client.Send(mail);

                mail.To.Clear();
            }

            mail.Dispose();
        }
        private void SendMail(NotificationEmail notificationEmail)
        {
            var mail = new MailMessage
            {
                From = new MailAddress(_mailerSettings.From)
            };
            var client = _mailerSettings.GetSmtpClient();

            mail.Subject = MailingResources.NotificationMailCaption;
            mail.Body = string.Format(MailingResources.NotificationMessageTemplate, notificationEmail.NotificationDescription);

            foreach (var emailAdress in notificationEmail.UserIds.ToArray().Select(userId => _userRepository.GetAccount(userId).Email))
            {
                mail.To.Add(emailAdress);

                client.Send(mail);

                mail.To.Clear();
            }

            mail.Dispose();
        }