示例#1
0
        public static GlobalLogin GetCurrentLogin()
        {
            GlobalLogin login = new GlobalLogin();

            string globalLoginId = string.Empty;

            if (HttpContext.Current.User != null)
            {
                globalLoginId = HttpContext.Current.User.Identity.Name;
            }

            if (!string.IsNullOrWhiteSpace(globalLoginId))
            {
                login = CacheFactory.GetFromDefaultCacheByKey(globalLoginId) as GlobalLogin;
            }

            if (login == null)
            {
                login = new GlobalLogin();
            }

            if (login.View == null)
            {
                login.View = new SignInView();
            }

            return(login);
        }
示例#2
0
        public static Collection <FrequencyDates> GetFrequencyDates(string catalog)
        {
            object dates = CacheFactory.GetFromDefaultCacheByKey(catalog + appDatesKey);

            if (dates == null)
            {
                return(new Collection <FrequencyDates>());
            }

            return(dates as Collection <FrequencyDates>);
        }
示例#3
0
        public static SignInView GetSignInView()
        {
            SignInView view = new SignInView();

            string signInId = HttpContext.Current.User.Identity.Name;

            if (!string.IsNullOrWhiteSpace(signInId))
            {
                view = CacheFactory.GetFromDefaultCacheByKey(signInId) as SignInView;
            }

            if (view == null)
            {
                view = new SignInView();
            }

            return(view);
        }
示例#4
0
        public static SignInView GetSignInView()
        {
            while (true)
            {
                string signInId = HttpContext.Current.User.Identity.Name;

                if (string.IsNullOrWhiteSpace(signInId))
                {
                    return(new SignInView());
                }

                SignInView view = CacheFactory.GetFromDefaultCacheByKey(signInId) as SignInView;

                if (view != null)
                {
                    return(view);
                }

                SetSignInView();
            }
        }
示例#5
0
        public static MetaLogin GetCurrent(long globalLoginId)
        {
            MetaLogin login = new MetaLogin();


            if (globalLoginId != 0)
            {
                login = CacheFactory.GetFromDefaultCacheByKey(globalLoginId.ToString(CultureInfo.InvariantCulture)) as MetaLogin;
            }

            if (login == null)
            {
                login = new MetaLogin();
            }

            if (login.View == null)
            {
                login.View = new LoginView();
            }

            return(login);
        }
示例#6
0
        private static string GetDictionaryValue(string key)
        {
            string globalLoginId = HttpContext.Current.User.Identity.Name;

            if (!string.IsNullOrWhiteSpace(globalLoginId))
            {
                string cacheKey = "Dictionary" + globalLoginId;

                Dictionary <string, object> dictionary = CacheFactory.GetFromDefaultCacheByKey(cacheKey) as Dictionary <string, object>;

                if (dictionary != null)
                {
                    object value = dictionary[key];

                    if (value != null)
                    {
                        return(Conversion.TryCastString(value));
                    }
                }
            }

            return(string.Empty);
        }