示例#1
0
        public static IList<EFTemplate> GetTemplatesForUserGroup(EFUserGroup userGroup)
        {
            var result = new List<EFTemplate>();
            var findRootSqlQry = string.Format("SELECT TemplateId from dbo.Template where UserGroupId = {0} and Parent_TemplateId is NULL",userGroup.UserGroupId);
            var roots = Context.Database.SqlQuery<int>(findRootSqlQry).ToList<int>();

            GetTemplateForRoots(roots, result);

            return result;
        }
示例#2
0
        public static void FillCacheWithAllMailForUser(EFUserGroup userGroup)
        {
            try
            {
                _cacheMails = Context.Mails
                    .Where(x => x.UserGroupId == userGroup.UserGroupId)
                    .Select<EFMail, IMail>(u => u)
                    .ToDictionary(x => x.MailScanId);

                _cacheMailGroups = Context.MailGroups
                    .Include(x => x.DataUnits)
                    .Include(x => x.Emails)
                    .Where(x => x.Emails.Any())
                    .Where(x => x.Emails.FirstOrDefault().UserGroup.UserGroupId == userGroup.UserGroupId)
                    .Select<EFMailGroup, IMailGroup>(u => u)
                    .ToDictionary(x => x.MailGroupScanId);
            }
            catch (Exception e)
            {
                _cacheMailGroups = new Dictionary<string, IMailGroup>();
                _cacheMails = new Dictionary<string, IMail>();
             _logger.ErrorFormat("Error while creating Mail manager cache => {0}", e);
            }
        }
示例#3
0
 public static EFTemplate GetDefaultTemplatesForUserGroup(EFUserGroup userGroup)
 {
     return GetTemplatesForUserGroup(userGroup).FirstOrDefault();
 }