public List <Email> FindEmails(DateTime fromDate, DateTime toDate)
        {
            List <Email>      emails  = new List <Email>();
            EmailTableAdapter adapter = new EmailTableAdapter();

            EmailData.EmailDataTable table = adapter.FindEmails(fromDate, toDate);
            foreach (EmailData.EmailRow row in table)
            {
                emails.Add(EmailerHelper.ToEmailDTO(row, GetEmailAccountByEmailAddress(row.FromEmailAddress), GetEmailAttachments(row.Id)));
            }
            return(emails);
        }
        public List <Email> GetEmailsByBatch(string batchId)
        {
            List <Email>      emails  = new List <Email>();
            EmailTableAdapter adapter = new EmailTableAdapter();

            EmailData.EmailDataTable table = adapter.GetEmailsByBatchId(batchId);
            foreach (EmailData.EmailRow row in table)
            {
                emails.Add(EmailerHelper.ToEmailDTO(row, GetEmailAccountByEmailAddress(row.FromEmailAddress), GetEmailAttachments(row.Id)));
            }
            return(emails);
        }
        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)));
        }