public bool ValidateEmail(int id, string code) { Email email = _emailRepository.Get(id).SingleOrDefault(); email.Validate(); _userRepository.Flush(); return(email.ValidationCode == code); }
public Email Get(string id) { try { return(_emailRepository.Get(id)); } catch (Exception ex) { throw HandleException(new object[] { id }, ex); } }
public void Execute(Quartz.IJobExecutionContext context) { List <Email> emailjob = new List <Email>(); IRepository <Email, int?> mailRepo = new EmailRepository(); try { MailUtility mailUtility = new MailUtility(); foreach (Email msg in mailRepo.Get().Where(x => x.Active == true).ToList()) { if (mailUtility.Send(msg.ToAddress, msg.Subject, msg.Body)) { log.Info("Mail Sent: " + msg.ToAddress + " " + msg.Subject); mailRepo.Remove(msg); } } } catch (Exception ex) { } }
public List <RequiredInformation> GetInformation(string connectionString) { List <Address> addresses = new List <Address>(); AddressRepository addressRepository = new AddressRepository(); addresses = addressRepository.Get(connectionString); List <Contact> contacts = new List <Contact>(); ContactRepository contactRepository = new ContactRepository(); contacts = contactRepository.Get(connectionString); List <Phone> phones = new List <Phone>(); PhoneRepository phoneRepository = new PhoneRepository(); phones = phoneRepository.Get(connectionString); List <PersonData> personsData = new List <PersonData>(); PersonDataRepository personData = new PersonDataRepository(); personsData = personData.Get(connectionString); List <Email> emails = new List <Email>(); EmailRepository emailRepository = new EmailRepository(); emails = emailRepository.Get(connectionString); List <RequiredInformation> information = new List <RequiredInformation>(); for (int i = 0; i < addresses.Count; i++) { RequiredInformation required = new RequiredInformation(); required.Address = addresses[i].PersonAddress; required.Contact = contacts[i].Name; required.Email = emails[i].EmailAddress; required.PhoneNumber = phones[i].PhoneNumber; required.LastName = personsData[i].LastName; required.FirstName = personsData[i].FirstName; information.Add(required); } return(information); }