private string _getTabLabel(Domain.Email email) { if (email == null) { return(null); } return(email.subject); }
private string _getTabRef(Domain.Email email) { if (email == null) { return(null); } return("/Email/Edit/" + Convert.ToString(email.ID)); }
public ActionResult Duplicate(int id, int?woid, string userName) { Domain.Email duplicate = serv.Duplicate(id, woid, userName); return(Json(new { sNewRef = _getTabRef(duplicate), sNewLabel = _getTabLabel(duplicate), iNewID = duplicate.ID }, JsonRequestBehavior.AllowGet)); }
public ActionResult Create() { var e = new Domain.Email(); var ev = map.Map <Domain.Email, EmailView>(e); ev.status = def.byID(e.statusID); ev.templates = def.getEmailTemplates(); ev.def = def; ViewBag.EmailStatuses = def.getSelectList(Machete.Domain.LCategory.emailstatus); return(PartialView("Create", ev)); }
public ActionResult Edit(int id, string userName) { EmailView ev; string pvType; // lock on read for fail Domain.Email email = serv.GetExclusive(id, userName); if (email != null) { pvType = "Edit"; } else { pvType = "View"; email = serv.Get(id); } ev = map.Map <Domain.Email, EmailView>(email); ev.def = def; ev.status = def.byID(email.statusID); ev.templates = def.getEmailTemplates(); return(PartialView(pvType, ev)); }
public List<Domain.Email> GetMail() { bool getAllMail = Config["GetMailType"].Equals("GETALLMAIL123")? true : false; List<Domain.Email> emails = new List<Domain.Email>(); try { using (LotusNotesMailClient client = new LotusNotesMailClient()) { LotusNotesMailService.Email[] emailsLotusNotes = client.GetMail(getAllMail); if (emailsLotusNotes != null) { CurrentMailAccessIndicator = MailAccessIndicator.MailChecked; foreach (var emailLotusNotes in emailsLotusNotes) { Domain.Email localEmail = new Domain.Email(); localEmail.From = emailLotusNotes.From; localEmail.To = emailLotusNotes.To; localEmail.Subject = emailLotusNotes.Subject; localEmail.Body = emailLotusNotes.Body; if (emailLotusNotes.Attachments != null && emailLotusNotes.Attachments.Length > 0) { try { using (LotusNotesMailClient clientFetchAttachments = new LotusNotesMailClient()) { emailLotusNotes.Attachments = clientFetchAttachments.GetEmailAttachments(emailLotusNotes); foreach (LotusNotesMailService.Attachment attachment in emailLotusNotes.Attachments) { Domain.Attachment localAttachment = new Domain.Attachment(); localAttachment.FileName = attachment.FileName; localAttachment.FilePath = attachment.FilePath; localAttachment.Content = attachment.Content; localEmail.Attachments.Add(localAttachment); } } } catch (Exception e) { Logger logger = LogManager.GetCurrentClassLogger(); logger.Log(LogLevel.Error, "Exception occurred when getting attachments for the email", e); CurrentMailAccessIndicator = MailAccessIndicator.MailFetchError; } } emails.Add(localEmail); CurrentMailAccessIndicator = MailAccessIndicator.MailFetched; } } } } catch (CommunicationException ce) { Logger logger = LogManager.GetCurrentClassLogger(); logger.Log(LogLevel.Error, "Exception occurred when connecting to the Lotus Notes mail server", ce); CurrentMailAccessIndicator = MailAccessIndicator.LoginError; } catch (Exception e) { Logger logger = LogManager.GetCurrentClassLogger(); logger.Log(LogLevel.Error, "Exception occurred when retrieving mail from Lotus Notes", e); CurrentMailAccessIndicator = MailAccessIndicator.MailFetchError; } return emails; }