Example #1
0
 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);
     }
 }
Example #2
0
        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;
            }
        }
Example #3
0
 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);
         }
     }
 }
Example #4
0
 /****************cache Mail********************/
 public static void UpdateCacheMail(EFMail mail)
 {
     UpdateCacheMail(mail, true);
 }