private void SaveAttachment(int emailId, EmailAttachment newAttachment) { EmailAttachmentTableAdapter adapter = new EmailAttachmentTableAdapter(); int?id = 0; adapter.Insert(emailId, newAttachment.Name, newAttachment.Path, ref id); newAttachment.Id = (int)id; }
private List <EmailAttachment> GetEmailAttachments(int emailId) { List <EmailAttachment> attachments = new List <EmailAttachment>(); EmailAttachmentTableAdapter adapter = new EmailAttachmentTableAdapter(); EmailData.EmailAttachmentDataTable table = adapter.GetEmailAttachments(emailId); foreach (EmailData.EmailAttachmentRow row in table) { attachments.Add(new EmailAttachment(row.Id, row.Name, row.Path)); } return(attachments); }