Пример #1
0
        public static void UpdateCacheMailGroup(EFMailGroup mailgroup, bool addNew)
        {
            lock (_lockObject)
            {
                if (_cacheMailGroups.ContainsKey(mailgroup.MailGroupScanId))
                {
                    _cacheMailGroups.Remove(mailgroup.MailGroupScanId);
                }
                if (addNew) _cacheMailGroups.Add(mailgroup.MailGroupScanId, mailgroup);

                foreach (var mail in mailgroup.Mails)
                {
                    UpdateCacheMail(mail as EFMail, addNew);
                }
            }
        }
Пример #2
0
        public EFMailGroup SaveMailGroup(IEnumerable<EFDataUnit> dataUnits)
        {
            try
            {
                var mailGroup = new EFMailGroup(this);

                mailGroup.DataUnits = dataUnits.ToList();

                foreach (var du in mailGroup.DataUnits)
                {
                    _logger.InfoFormat("EFMailGroup -> Trying to save dataunits {0} value {1}", du.DataField.FieldName, du.ValueAsString());
                }
                OADBManager.Instance.DBContext.MailGroups.Add(mailGroup);
                OADBManager.Instance.DBContext.SaveChanges();
                MailManager.UpdateCacheMailGroup(mailGroup);
                _logger.InfoFormat("EFMailGroup -> Saved {0} dataunits successfully", mailGroup.DataUnits.Count);
                return mailGroup;
            }
            catch (Exception e)
            {
                _logger.ErrorFormat("EFMailGroup -> Error while saving mail {0} {1}", this.MailGroupScanId, e);
                return null;
            }
        }
Пример #3
0
 /****************cache Mail Group********************/
 public static void UpdateCacheMailGroup(EFMailGroup mailgroup)
 {
     UpdateCacheMailGroup(mailgroup, true);
 }