private void UpdateEmail(Email email) { if (email == null || email.Id <= 0) { throw new ArgumentException("Could not update email - email is null or has invalid id"); } EmailTableAdapter adapter = new EmailTableAdapter(); EmailData.EmailDataTable table = adapter.GetEmail(email.Id); if (table.Count == 0) { throw new ArgumentException(string.Format("Could not update email - email does not exist emailId=[{0}]", email.Id)); } EmailData.EmailRow row = table[0]; row.FailedAttempts = email.FailAttempts; if (email.FailedDate != null) { row.FailedDate = (DateTime)email.FailedDate; } row.FailedException = email.FailedException; if (email.SendDate != null) { row.SendDate = (DateTime)email.SendDate; } row.SendStatus = email.SendingStatus.ToString(); adapter.Update(row); }
public static MasterDataSet.EmailDataTable GetEmail(string email) { using (EmailTableAdapter adapter = new EmailTableAdapter()) { return(adapter.GetEmail(email)); } }
public Email GetEmail(int emailId) { if (emailId <= 0) { return(null); } EmailTableAdapter adapter = new EmailTableAdapter(); EmailData.EmailDataTable table = adapter.GetEmail(emailId); if (table.Count == 0) { return(null); } EmailData.EmailRow row = table[0]; return(EmailerHelper.ToEmailDTO(row, GetEmailAccountByEmailAddress(row.FromEmailAddress), GetEmailAttachments(row.Id))); }
public void UpdateEmailStatus(int id, EmailSendStatus status, string lastEditedBy) { if (id == 0) { throw new ArgumentException(string.Format("Could not update email status - invalid email [{0}].", id)); } EmailTableAdapter adapter = new EmailTableAdapter(); EmailData.EmailDataTable table = adapter.GetEmail(id); if (table.Count == 0) { throw new ArgumentException(string.Format("Could not update email - email does not exist emailId=[{0}]", id)); } EmailData.EmailRow row = table[0]; row.SendStatus = status.ToString(); adapter.Update(row); }