コード例 #1
0
        private void LoadPortalDashboard(liteDashboardSettings settings)
        {
            String url = "";

            switch (settings.Container.Default.AfterUserLogon)
            {
            case OnLoadSettings.AlwaysDefault:
                url = RootObject.LoadPortalView(UserContext.CurrentUserID, settings.Container.Default);
                View.SaveCurrentCookie(settings.Container.Default);
                break;

            case OnLoadSettings.UserDefault:
                liteUserDashboardSettings userSettings = Service.UserPortalDashboardSettingsGet(UserContext.CurrentUserID, true, settings);
                if (userSettings == null || userSettings.AfterUserLogon == OnLoadSettings.AlwaysDefault)
                {
                    url = RootObject.LoadPortalView(UserContext.CurrentUserID, settings.Container.Default);
                    View.SaveCurrentCookie(settings.Container.Default);
                }
                else if (userSettings.AfterUserLogon == OnLoadSettings.UserLastClick && View.GetCurrentCookie() != null)
                {
                    url = RootObject.LoadPortalView(UserContext.CurrentUserID, View.GetCurrentCookie());
                }
                else
                {
                    url = RootObject.LoadPortalView(UserContext.CurrentUserID, userSettings);
                    View.SaveCurrentCookie(userSettings);
                }
                break;

            case OnLoadSettings.UserLastClick:
                if (View.GetCurrentCookie() != null)
                {
                    url = RootObject.LoadPortalView(UserContext.CurrentUserID, View.GetCurrentCookie());
                }
                else
                {
                    url = RootObject.LoadPortalView(UserContext.CurrentUserID, settings.Container.Default);
                    View.SaveCurrentCookie(settings.Container.Default);
                }
                break;
            }
            View.LoadDashboard(url);
        }
コード例 #2
0
        private liteUserDashboardSettings UserDashboardSettingsGet(Int32 idUser, Boolean useCache = true, Int32 idCommunity = -1, liteDashboardSettings settings = null)
        {
            liteUserDashboardSettings userSettings = null;

            userSettings = (useCache) ? lm.Comol.Core.DomainModel.Helpers.CacheHelper.Find <liteUserDashboardSettings>(CacheKeys.UserSettings(idUser, idCommunity)) : null;

            if (userSettings == null)
            {
                userSettings = (from t in Manager.GetIQ <liteUserDashboardSettings>() where t.Deleted == BaseStatusDeleted.None && t.IdPerson == idUser && t.IdCommunity == idCommunity select t).Skip(0).Take(1).FirstOrDefault();
                if (userSettings == null && idCommunity > 0)
                {
                    userSettings = (from t in Manager.GetIQ <liteUserDashboardSettings>() where t.Deleted == BaseStatusDeleted.None && t.IdPerson == idUser && t.IdCommunity == -1 select t).Skip(0).Take(1).FirstOrDefault();
                }
                if (userSettings != null)
                {
                    Manager.Detach(userSettings);
                }
                if (userSettings != null && useCache)
                {
                    CacheHelper.AddToCache <liteUserDashboardSettings>(CacheKeys.UserSettings(idUser, idCommunity), userSettings, CacheExpiration.Week);
                }
            }
            return(userSettings);
        }