Example #1
0
            public static List <int> GetNodeIdListByScopeType(NodeInfo nodeInfo, EScopeType scopeType)
            {
                List <int> list;

                var dic = GetDictionary();
                var key = EScopeTypeUtils.GetValue(scopeType) + nodeInfo.NodeId;

                if (dic.ContainsKey(key))
                {
                    list = dic[key];
                }
                else
                {
                    list     = DataProvider.NodeDao.GetNodeIdListByScopeType(nodeInfo, scopeType, string.Empty, string.Empty);
                    dic[key] = list;
                }

                return(list);
            }
Example #2
0
        public static List <int> GetIdListByScopeType(int channelId, EScopeType scopeType, string groupChannel, string groupChannelNot)
        {
            var cacheKey = StlCacheUtils.GetCacheKey(nameof(Node), nameof(GetIdListByScopeType),
                                                     channelId.ToString(), EScopeTypeUtils.GetValue(scopeType), groupChannel, groupChannelNot);
            var retval = StlCacheUtils.GetCache <List <int> >(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheUtils.GetCache <List <int> >(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ChannelDao.GetIdListByScopeType(channelId, scopeType, groupChannel, groupChannelNot);
                    StlCacheUtils.SetCache(cacheKey, retval);
                }
            }

            return(retval);
        }
Example #3
0
        public static string GetStlSqlStringChecked(string tableName, int siteId, int channelId, int startNum, int totalNum, string orderByString, string whereString, EScopeType scopeType, string groupChannel, string groupChannelNot)
        {
            var cacheKey = StlCacheUtils.GetCacheKey(nameof(Content), nameof(GetStlSqlStringChecked),
                                                     tableName, siteId.ToString(), channelId.ToString(), startNum.ToString(),
                                                     totalNum.ToString(), orderByString, whereString, EScopeTypeUtils.GetValue(scopeType), groupChannel,
                                                     groupChannelNot);
            var retval = StlCacheUtils.GetCache <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheUtils.GetCache <string>(cacheKey);
                if (retval == null)
                {
                    var channelInfo   = ChannelManager.GetChannelInfo(siteId, channelId);
                    var channelIdList = ChannelManager.GetChannelIdList(channelInfo, scopeType, groupChannel, groupChannelNot, string.Empty);
                    retval = DataProvider.ContentDao.GetStlSqlStringChecked(channelIdList, tableName, siteId, channelId, startNum,
                                                                            totalNum, orderByString, whereString, scopeType, groupChannel, groupChannelNot);
                    StlCacheUtils.SetCache(cacheKey, retval);
                }
            }

            return(retval);
        }
Example #4
0
        public static int GetCountOfContentAdd(string tableName, int siteId, int channelId, EScopeType scope,
                                               DateTime begin, DateTime end, string userName, ETriState checkedState)
        {
            var cacheKey = StlCacheUtils.GetCacheKey(nameof(Content), nameof(GetCountOfContentAdd),
                                                     siteId.ToString(), channelId.ToString(), EScopeTypeUtils.GetValue(scope),
                                                     DateUtils.GetDateString(begin), DateUtils.GetDateString(end), userName, ETriStateUtils.GetValue(checkedState));
            var retval = StlCacheUtils.GetIntCache(cacheKey);

            if (retval != -1)
            {
                return(retval);
            }

            lock (LockObject)
            {
                retval = StlCacheUtils.GetIntCache(cacheKey);
                if (retval == -1)
                {
                    retval = DataProvider.ContentDao.GetCountOfContentAdd(tableName, siteId, channelId, scope,
                                                                          begin, end, userName, checkedState);
                    StlCacheUtils.SetCache(cacheKey, retval);
                }
            }

            return(retval);
        }