Ejemplo n.º 1
0
        public liteDashboardSettings DashboardSettingsGet(DashboardType type, Int32 idCommunity = -1, Boolean useCache = true)
        {
            liteDashboardSettings settings = (useCache) ? lm.Comol.Core.DomainModel.Helpers.CacheHelper.Find <liteDashboardSettings>(CacheKeys.CurrentDashboardSettings(UC.CurrentUserID, idCommunity)) : null;

            if (settings == null)
            {
                litePerson p = Manager.Get <litePerson>(UC.CurrentUserID);
                if (p != null)
                {
                    switch (type)
                    {
                    case DashboardType.Portal:
                        settings = GetPortalSettings(p, useCache);
                        if (settings != null && useCache)
                        {
                            CacheHelper.AddToCache <liteDashboardSettings>(CacheKeys.CurrentDashboardSettings(p.Id, 0), (liteDashboardSettings)settings.Clone(), CacheExpiration.Week);
                        }
                        break;

                    case DashboardType.Community:
                        settings = GetCommunitySettings(p, idCommunity, useCache);
                        if (settings != null && useCache)
                        {
                            CacheHelper.AddToCache <liteDashboardSettings>(CacheKeys.CurrentDashboardSettings(p.Id, idCommunity), (liteDashboardSettings)settings.Clone(), CacheExpiration.Week);
                        }
                        break;

                    case DashboardType.AllCommunities:
                        settings = GetCommonCommunitySettings(p, useCache);
                        if (settings != null && useCache)
                        {
                            CacheHelper.AddToCache <liteDashboardSettings>(CacheKeys.CurrentDashboardSettings(p.Id, -1), (liteDashboardSettings)settings.Clone(), CacheExpiration.Week);
                        }
                        break;
                    }
                }
            }
            return(settings);
        }