Ejemplo n.º 1
0
        private List <liteDashboardSettings> LoadingSettingsGetForAllCommunity(Boolean useCache = true)
        {
            List <liteDashboardSettings> settings = null;

            settings = (useCache) ? lm.Comol.Core.DomainModel.Helpers.CacheHelper.Find <List <liteDashboardSettings> >(CacheKeys.Dashboard(DashboardType.AllCommunities)) : null;

            if (settings == null || !settings.Any())
            {
                settings = (from t in Manager.GetIQ <liteDashboardSettings>() where t.Deleted == BaseStatusDeleted.None && t.Active && t.Type == DashboardType.AllCommunities select t).ToList();
                if (settings != null && settings.Any())
                {
                    Manager.DetachList(settings);
                }
                if (settings != null && useCache)
                {
                    CacheHelper.AddToCache <List <liteDashboardSettings> >(CacheKeys.Dashboard(DashboardType.AllCommunities), settings, CacheExpiration.Week);
                }
            }
            return(settings);
        }
Ejemplo n.º 2
0
        public List <liteDashboardSettings> LoadingSettingsGetAll(DashboardType type, Int32 idCommunity, Boolean useCache = true)
        {
            List <liteDashboardSettings> settings = null;
            String cacheKey = "";

            switch (type)
            {
            case DashboardType.AllCommunities:
            case DashboardType.Portal:
                cacheKey = CacheKeys.Dashboard(type);
                break;

            case DashboardType.Community:
                settings = LoadingSettingsGetForCommunity(idCommunity, useCache);
                if (settings == null)
                {
                    cacheKey = CacheKeys.Dashboard(DashboardType.AllCommunities);
                }
                break;
            }
            if (type != DashboardType.Community || settings == null)
            {
                settings = (useCache) ? lm.Comol.Core.DomainModel.Helpers.CacheHelper.Find <List <liteDashboardSettings> >(cacheKey) : null;
            }

            if (settings == null || !settings.Any())
            {
                settings = (from t in Manager.GetIQ <liteDashboardSettings>() where t.Active && t.Deleted == BaseStatusDeleted.None select t).ToList();
                if (settings != null && settings.Any())
                {
                    Manager.DetachList(settings);
                }

                if (settings != null && useCache)
                {
                    CacheHelper.AddToCache <List <liteDashboardSettings> >(cacheKey, settings, CacheExpiration.Week);
                }
            }
            return(settings);
        }