Exemplo n.º 1
0
            public static List <KeyValuePair <int, SiteInfo> > GetSiteInfoKeyValuePairList()
            {
                var retval = DataCacheManager.Get <List <KeyValuePair <int, SiteInfo> > >(CacheKey);

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

                lock (LockObject)
                {
                    retval = DataCacheManager.Get <List <KeyValuePair <int, SiteInfo> > >(CacheKey);
                    if (retval == null)
                    {
                        var list = DataProvider.SiteDao.GetSiteInfoKeyValuePairList();
                        retval = new List <KeyValuePair <int, SiteInfo> >();
                        foreach (var pair in list)
                        {
                            var siteInfo = pair.Value;
                            if (siteInfo == null)
                            {
                                continue;
                            }

                            siteInfo.SiteDir = GetSiteDir(list, siteInfo);
                            retval.Add(pair);
                        }

                        DataCacheManager.Insert(CacheKey, retval);
                    }
                }

                return(retval);
            }
Exemplo n.º 2
0
            private static Dictionary <int, Dictionary <int, ChannelInfo> > GetAllDictionary()
            {
                var allDict = DataCacheManager.Get <Dictionary <int, Dictionary <int, ChannelInfo> > >(CacheKey);

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

                allDict = new Dictionary <int, Dictionary <int, ChannelInfo> >();
                DataCacheManager.Insert(CacheKey, allDict);
                return(allDict);
            }
            public static Dictionary <int, ContentInfo> GetContentDict(int channelId)
            {
                lock (LockObject)
                {
                    var cacheKey = GetCacheKey(channelId);
                    var dict     = DataCacheManager.Get <Dictionary <int, ContentInfo> >(cacheKey);
                    if (dict == null)
                    {
                        dict = new Dictionary <int, ContentInfo>();
                        DataCacheManager.Insert(cacheKey, dict);
                    }

                    return(dict);
                }
            }
Exemplo n.º 4
0
        public static List <KeyValuePair <int, DepartmentInfo> > GetDepartmentInfoKeyValuePair()
        {
            lock (LockObject)
            {
                var list = DataCacheManager.Get <List <KeyValuePair <int, DepartmentInfo> > >(CacheKey);
                if (list != null)
                {
                    return(list);
                }

                list = DataProvider.DepartmentDao.GetDepartmentInfoKeyValuePair();
                DataCacheManager.Insert(CacheKey, list);
                return(list);
            }
        }
Exemplo n.º 5
0
            public static List <int> GetContentIdList(int channelId, int?onlyAdminId)
            {
                lock (LockObject)
                {
                    var cacheKey = GetCacheKey(channelId, onlyAdminId);
                    var list     = DataCacheManager.Get <List <int> >(cacheKey);
                    if (list != null)
                    {
                        return(list);
                    }

                    list = new List <int>();
                    DataCacheManager.Insert(cacheKey, list);
                    return(list);
                }
            }
Exemplo n.º 6
0
            private static Dictionary <string, List <ContentCountInfo> > GetAllContentCounts()
            {
                lock (LockObject)
                {
                    var retVal = DataCacheManager.Get <Dictionary <string, List <ContentCountInfo> > >(CacheKey);
                    if (retVal != null)
                    {
                        return(retVal);
                    }

                    retVal = DataCacheManager.Get <Dictionary <string, List <ContentCountInfo> > >(CacheKey);
                    if (retVal == null)
                    {
                        retVal = new Dictionary <string, List <ContentCountInfo> >();
                        DataCacheManager.Insert(CacheKey, retVal);
                    }

                    return(retVal);
                }
            }
Exemplo n.º 7
0
            private static Dictionary <string, AdministratorInfo> GetDict()
            {
                var dict = DataCacheManager.Get <Dictionary <string, AdministratorInfo> >(CacheKey);

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

                lock (LockObject)
                {
                    dict = DataCacheManager.Get <Dictionary <string, AdministratorInfo> >(CacheKey);
                    if (dict == null)
                    {
                        dict = new Dictionary <string, AdministratorInfo>();
                        DataCacheManager.Insert(CacheKey, dict);
                    }
                }

                return(dict);
            }
Exemplo n.º 8
0
            private static Dictionary <string, UserInfo> GetDict()
            {
                var retval = DataCacheManager.Get <Dictionary <string, UserInfo> >(CacheKey);

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

                lock (LockObject)
                {
                    retval = DataCacheManager.Get <Dictionary <string, UserInfo> >(CacheKey);
                    if (retval == null)
                    {
                        retval = new Dictionary <string, UserInfo>();
                        DataCacheManager.Insert(CacheKey, retval);
                    }
                }

                return(retval);
            }
Exemplo n.º 9
0
            public static List <UserMenuInfo> GetAllUserMenus()
            {
                var retval = DataCacheManager.Get <List <UserMenuInfo> >(CacheKey);

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

                lock (LockObject)
                {
                    retval = DataCacheManager.Get <List <UserMenuInfo> >(CacheKey);
                    if (retval == null)
                    {
                        retval = DataProvider.UserMenuDao.GetUserMenuInfoList();

                        DataCacheManager.Insert(CacheKey, retval);
                    }
                }

                return(retval);
            }
Exemplo n.º 10
0
            public static Dictionary <string, AccessTokenInfo> GetAccessTokenDictionary()
            {
                var retval = DataCacheManager.Get <Dictionary <string, AccessTokenInfo> >(CacheKey);

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

                lock (LockObject)
                {
                    retval = DataCacheManager.Get <Dictionary <string, AccessTokenInfo> >(CacheKey);
                    if (retval == null)
                    {
                        retval = DataProvider.AccessTokenDao.GetAccessTokenInfoDictionary();

                        DataCacheManager.Insert(CacheKey, retval);
                    }
                }

                return(retval);
            }
            public static List <KeyValuePair <string, TableStyleInfo> > GetAllTableStyles()
            {
                var retVal = DataCacheManager.Get <List <KeyValuePair <string, TableStyleInfo> > >(CacheKey);

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

                lock (LockObject)
                {
                    retVal = DataCacheManager.Get <List <KeyValuePair <string, TableStyleInfo> > >(CacheKey);
                    if (retVal == null)
                    {
                        retVal = DataProvider.TableStyleDao.GetAllTableStyles();

                        DataCacheManager.Insert(CacheKey, retVal);
                    }
                }

                return(retVal);
            }
Exemplo n.º 12
0
            public static Dictionary <int, List <ContentGroupInfo> > GetAllContentGroups()
            {
                var retval = DataCacheManager.Get <Dictionary <int, List <ContentGroupInfo> > >(CacheKey);

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

                lock (LockObject)
                {
                    retval = DataCacheManager.Get <Dictionary <int, List <ContentGroupInfo> > >(CacheKey);
                    if (retval == null)
                    {
                        retval = DataProvider.ContentGroupDao.GetAllContentGroups();

                        DataCacheManager.Insert(CacheKey, retval);
                    }
                }

                return(retval);
            }
Exemplo n.º 13
0
        private static string GetContentByFilePath(string filePath)
        {
            try
            {
                var content = DataCacheManager.Get <string>(filePath);
                if (content != null)
                {
                    return(content);
                }

                if (FileUtils.IsFileExists(filePath))
                {
                    content = FileUtils.ReadText(filePath, Encoding.UTF8);
                }

                DataCacheManager.Insert(filePath, content, TimeSpan.FromHours(12), filePath);
                return(content);
            }
            catch
            {
                return(string.Empty);
            }
        }
Exemplo n.º 14
0
        public static List <KeyValuePair <int, AreaInfo> > GetAreaInfoPairList()
        {
            lock (LockObject)
            {
                var list = DataCacheManager.Get <List <KeyValuePair <int, AreaInfo> > >(CacheKey);
                if (list != null)
                {
                    return(list);
                }

                var pairListFormDb = DataProvider.AreaDao.GetAreaInfoPairList();
                list = new List <KeyValuePair <int, AreaInfo> >();
                foreach (var pair in pairListFormDb)
                {
                    var areaInfo = pair.Value;
                    if (areaInfo != null)
                    {
                        list.Add(pair);
                    }
                }
                DataCacheManager.Insert(CacheKey, list);
                return(list);
            }
        }