Exemplo n.º 1
0
        public void SendNotification()
        {
            IEnumerable <ContactDTO> contacts = _reader.Read();

            foreach (var contact in contacts)
            {
                _reminder.RegistrationDate = contact.ConvertRegistrationToDate();
                if (_reminder.HasExpiryDateApproaching())
                {
                    if (_repo.IsMailSentToday(contact.Id))
                    {
                        continue;
                    }

                    //_emailService.SendEmail(contact.Email,
                    //"Your IMG registration is expiring " +
                    //_formatter.GetEmailSubject(_reminder), _formatter.GenerateHtml(contact, _reminder));

                    _emailService.SendEmail(contact.Email,
                                            " Membership Reminder from the IMG ", _formatter.GenerateHtml(contact, _reminder));



                    var history = new EmailHistory()
                    {
                        ContactID     = contact.Id,
                        LastEmailSent = DateTime.Today,
                        Name          = contact.Name
                    };
                    history.TotalReminders += 1;
                    _repo.Add(history);
                }
            }
        }
Exemplo n.º 2
0
        public void MailNotSentForThisEntry()
        {
            EmailHistoryRepository manager = new EmailHistoryRepository();
            var contact = new EmailHistory()
            {
                LastEmailSent = DateTime.Today,
                ContactID     = "AB-3215"
            };

            Assert.IsTrue(!manager.IsMailSentToday(contact.ContactID));
        }