public EFMailGroup(BackBoneMailGroup backBoneMailGroup) { StatusUser = backBoneMailGroup.StatusUser; //UserGroup = UserManager.UserGroup; MailGroupScanId = backBoneMailGroup.MailGroupScanId; Emails = new List<EFMail>(); foreach (var backoneMail in backBoneMailGroup.Mails) { var mail = new EFMail((BackBoneMail)backoneMail); mail.MailGroup = this; Emails.Add(mail); } }
public EFMail SaveMail() { try { var mail = new EFMail(this); OADBManager.Instance.DBContext.Mails.Add(mail); OADBManager.Instance.DBContext.SaveChanges(); MailManager.UpdateCacheMail(mail); return mail; } catch (Exception e) { _logger.ErrorFormat("EFMail -> Error while saving mail {0} {1} => {3}", this.Subject, this.MailScanUniqueId, e); return null; } }
public static void UpdateCacheMail(EFMail mail, bool addNew) { lock (_lockObject) { if (mail != null) { if (_cacheMails.ContainsKey(mail.MailScanId)) { _cacheMails.Remove(mail.MailScanId); } if (addNew) _cacheMails.Add(mail.MailScanId, mail); } } }
/****************cache Mail********************/ public static void UpdateCacheMail(EFMail mail) { UpdateCacheMail(mail, true); }