Ejemplo n.º 1
0
        public static string GetStlWhereString(int siteId, string group, string groupNot, string tags, bool isTopExists, bool isTop, string where)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetStlWhereString),
                                                       siteId.ToString(), group, groupNot, tags, isTopExists.ToString(), isTop.ToString(),
                                                       where);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetStlWhereString(siteId, group, groupNot, tags,
                                                                       isTopExists, isTop, where);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 2
0
        public static int GetSiteIdBySiteDir(string siteDir)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlSiteCache),
                                                       nameof(GetSiteIdBySiteDir), siteDir);
            var retVal = StlCacheManager.GetInt(cacheKey);

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

            lock (LockObject)
            {
                retVal = StlCacheManager.GetInt(cacheKey);
                if (retVal == -1)
                {
                    retVal =
                        DataProvider.SiteDao.GetIdBySiteDir(
                            siteDir);
                    StlCacheManager.Set(cacheKey, retVal);
                }
            }

            return(retVal);
        }
Ejemplo n.º 3
0
        public static string GetStlWhereStringBySearch(string group, string groupNot, bool isImageExists, bool isImage, bool isVideoExists, bool isVideo, bool isFileExists, bool isFile, bool isTopExists, bool isTop, bool isRecommendExists, bool isRecommend, bool isHotExists, bool isHot, bool isColorExists, bool isColor, string where)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetStlWhereStringBySearch), group, groupNot, isImageExists.ToString(), isImage.ToString(),
                                                       isVideoExists.ToString(), isVideo.ToString(), isFileExists.ToString(), isFile.ToString(),
                                                       isTopExists.ToString(), isTop.ToString(), isRecommendExists.ToString(), isRecommend.ToString(),
                                                       isHotExists.ToString(), isHot.ToString(), isColorExists.ToString(), isColor.ToString(), where);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetStlWhereStringBySearch(group, groupNot,
                                                                               isImageExists, isImage, isVideoExists, isVideo, isFileExists, isFile, isTopExists, isTop,
                                                                               isRecommendExists, isRecommend, isHotExists, isHot, isColorExists, isColor, where);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 4
0
        public static string GetStlSqlStringCheckedBySearch(string tableName, int startNum, int totalNum, string orderByString, string whereString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache),
                                                       nameof(GetStlSqlStringCheckedBySearch),
                                                       tableName, startNum.ToString(), totalNum.ToString(), orderByString, whereString);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetStlSqlStringCheckedBySearch(tableName, startNum, totalNum,
                                                                                    orderByString, whereString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 5
0
        public static string GetValue(string tableName, int contentId, string type)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetValue), tableName,
                                                       contentId.ToString(), type);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    var tuple = DataProvider.ContentDao.GetValue(tableName, contentId, type);
                    if (tuple != null)
                    {
                        retval = tuple.Item2;
                        StlCacheManager.Set(cacheKey, retval);
                    }
                }
            }

            return(retval);
        }
Ejemplo n.º 6
0
        public static string GetWhereString(int siteId, string groupContent, string groupContentNot, bool isImageExists, bool isImage, string where)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetWhereString),
                                                       siteId.ToString(), groupContent, groupContentNot, isImageExists.ToString(),
                                                       isImage.ToString(), where);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ChannelDao.GetWhereString(groupContent, groupContentNot,
                                                                    isImageExists, isImage, where);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 7
0
        public static int GetCountOfContentAdd(string tableName, int siteId, int channelId, EScopeType scope,
                                               DateTime begin, DateTime end, string userName, ETriState checkedState)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetCountOfContentAdd),
                                                       siteId.ToString(), channelId.ToString(), EScopeTypeUtils.GetValue(scope),
                                                       DateUtils.GetDateString(begin), DateUtils.GetDateString(end), userName, ETriStateUtils.GetValue(checkedState));
            var retval = StlCacheManager.GetInt(cacheKey);

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

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

            return(retval);
        }
Ejemplo n.º 8
0
        public static string GetSelectSqlStringByQueryString(string connectionString, string queryString, int startNum,
                                                             int totalNum, string orderByString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlSqlContentsCache),
                                                       nameof(GetSelectSqlStringByQueryString), connectionString, queryString, startNum.ToString(),
                                                       totalNum.ToString(), orderByString);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.DatabaseDao.GetSelectSqlStringByQueryString(connectionString,
                                                                                      queryString, startNum, totalNum, orderByString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 9
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 = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetStlSqlStringChecked),
                                                       tableName, siteId.ToString(), channelId.ToString(), startNum.ToString(),
                                                       totalNum.ToString(), orderByString, whereString, EScopeTypeUtils.GetValue(scopeType), groupChannel,
                                                       groupChannelNot);
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <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);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 10
0
        public static DataSet GetStlDataSourceChecked(List <int> channelIdList, string tableName, int startNum, int totalNum, string orderByString, string whereString, NameValueCollection others)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetStlDataSourceChecked),
                                                       TranslateUtils.ObjectCollectionToString(channelIdList), tableName, startNum.ToString(), totalNum.ToString(), orderByString, whereString, TranslateUtils.NameValueCollectionToString(others));
            var retval = StlCacheManager.Get <DataSet>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <DataSet>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetStlDataSourceChecked(channelIdList, tableName, startNum, totalNum, orderByString, whereString, others);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
        public static int GetContentId(string tableName, int channelId, bool isCheckedOnly, string orderByString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetContentId), tableName,
                                                       channelId.ToString(), orderByString);
            var retVal = StlCacheManager.GetInt(cacheKey);

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

            lock (LockObject)
            {
                retVal = StlCacheManager.GetInt(cacheKey);
                if (retVal == -1)
                {
                    retVal = DataProvider.ContentDao.GetContentId(tableName, channelId, isCheckedOnly, orderByString);
                    StlCacheManager.Set(cacheKey, retVal);
                }
            }

            return(retVal);
        }
Ejemplo n.º 12
0
        public static List <int> GetContentIdListChecked(string tableName, int channelId, string orderByFormatString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetContentIdListChecked),
                                                       tableName, channelId.ToString(), orderByFormatString);
            var retval = StlCacheManager.Get <List <int> >(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <List <int> >(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ContentDao.GetContentIdListChecked(tableName, channelId, orderByFormatString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 13
0
        public static int GetPageTotalCount(string sqlString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlDatabaseCache), nameof(GetPageTotalCount),
                                                       sqlString);
            var retval = StlCacheManager.GetInt(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.GetInt(cacheKey);
                if (retval == -1)
                {
                    retval = DataProvider.DatabaseDao.GetPageTotalCount(sqlString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 14
0
        public static int GetCountCheckedImage(int siteId, int channelId)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetCountCheckedImage),
                                                       siteId.ToString(), channelId.ToString());
            var retval = StlCacheManager.GetInt(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.GetInt(cacheKey);
                if (retval == -1)
                {
                    retval = DataProvider.ContentDao.GetCountCheckedImage(siteId, channelId);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 15
0
        public static DataSet GetStlDataSet(List <int> channelIdList, int startNum, int totalNum, string whereString, string orderByString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetStlDataSet),
                                                       TranslateUtils.ObjectCollectionToString(channelIdList), startNum.ToString(), totalNum.ToString(), whereString, orderByString);
            var retval = StlCacheManager.Get <DataSet>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <DataSet>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ChannelDao.GetStlDataSet(channelIdList, startNum, totalNum, whereString, orderByString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 16
0
        public static DataSet GetStlDataSourceBySiteId(int siteId, int startNum, int totalNum, string whereString, string orderByString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetStlDataSourceBySiteId),
                                                       siteId.ToString(), startNum.ToString(), totalNum.ToString(), whereString, orderByString);
            var retval = StlCacheManager.Get <DataSet>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <DataSet>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ChannelDao.GetStlDataSourceBySiteId(siteId, startNum, totalNum, whereString, orderByString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 17
0
        public static ChannelInfo GetChannelInfoByTaxis(int channelId)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetChannelInfoByTaxis),
                                                       channelId.ToString());
            var retval = StlCacheManager.Get <ChannelInfo>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <ChannelInfo>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.ChannelDao.GetChannelInfoByTaxis(channelId);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 18
0
        public static int GetSiteId(int channelId)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetSiteId),
                                                       channelId.ToString());
            var retval = StlCacheManager.GetInt(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.GetInt(cacheKey);
                if (retval == -1)
                {
                    retval = DataProvider.ChannelDao.GetSiteId(channelId);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 19
0
        public static int GetSequence(string tableName, int channelId, int contentId)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetSequence),
                                                       tableName, channelId.ToString(), contentId.ToString());
            var retval = StlCacheManager.GetInt(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.GetInt(cacheKey);
                if (retval == -1)
                {
                    retval = DataProvider.ContentDao.GetSequence(tableName, channelId, contentId);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 20
0
        public static int GetContentId(string tableName, int channelId, int taxis, bool isNextContent)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlContentCache), nameof(GetContentId), tableName,
                                                       channelId.ToString(), taxis.ToString(), isNextContent.ToString());
            var retval = StlCacheManager.GetInt(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.GetInt(cacheKey);
                if (retval == -1)
                {
                    retval = DataProvider.ContentDao.GetContentId(tableName, channelId, taxis, isNextContent);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 21
0
        public static int GetSiteIdByIsRoot()
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlSiteCache),
                                                       nameof(GetSiteIdByIsRoot));
            var retval = StlCacheManager.GetInt(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.GetInt(cacheKey);
                if (retval == -1)
                {
                    retval = DataProvider.SiteDao.GetIdByIsRoot();
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 22
0
        //public static int GetIdByIndexName(int siteId, string channelIndex)
        //{
        //    var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetIdByIndexName),
        //               siteId.ToString(), channelIndex);
        //    var retval = StlCacheManager.GetInt(cacheKey);
        //    if (retval != -1) return retval;

        //    lock (LockObject)
        //    {
        //        retval = StlCacheManager.GetInt(cacheKey);
        //        if (retval == -1)
        //        {
        //            retval = DataProvider.ChannelDao.GetIdByIndexName(siteId, channelIndex);
        //            StlCacheManager.Set(cacheKey, retval);
        //        }
        //    }

        //    return retval;
        //}

        public static int GetIdByParentIdAndTaxis(int parentId, int taxis, bool isNextChannel)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlChannelCache), nameof(GetIdByParentIdAndTaxis),
                                                       parentId.ToString(), taxis.ToString(), isNextChannel.ToString());
            var retval = StlCacheManager.GetInt(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.GetInt(cacheKey);
                if (retval == -1)
                {
                    retval = DataProvider.ChannelDao.GetIdByParentIdAndTaxis(parentId, taxis, isNextChannel);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 23
0
        public static List <TagInfo> GetTagInfoList(int siteId, int contentId, bool isOrderByCount, int totalNum)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlTagCache),
                                                       nameof(GetTagInfoList), siteId.ToString(), contentId.ToString(), isOrderByCount.ToString(), totalNum.ToString());
            var retval = StlCacheManager.Get <List <TagInfo> >(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <List <TagInfo> >(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.TagDao.GetTagInfoList(siteId, contentId, isOrderByCount, totalNum);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 24
0
        public static DataSet GetDataSet(string connectionString, string queryString)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlDatabaseCache), nameof(GetDataSet),
                                                       connectionString, queryString);
            var retval = StlCacheManager.Get <DataSet>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <DataSet>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.DatabaseDao.GetDataSet(connectionString, queryString);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 25
0
        public static List <int> GetContentIdListByTagCollection(StringCollection tagCollection, int siteId)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlTagCache),
                                                       nameof(GetContentIdListByTagCollection), TranslateUtils.ObjectCollectionToString(tagCollection),
                                                       siteId.ToString());
            var retval = StlCacheManager.Get <List <int> >(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <List <int> >(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.TagDao.GetContentIdListByTagCollection(tagCollection, siteId);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }
Ejemplo n.º 26
0
        public static string GetStlPageSqlString(string sqlString, string orderByString, int totalNum, int pageNum, int currentPageIndex)
        {
            var cacheKey = StlCacheManager.GetCacheKey(nameof(StlDatabaseCache), nameof(GetStlPageSqlString),
                                                       sqlString, orderByString, totalNum.ToString(), pageNum.ToString(), currentPageIndex.ToString());
            var retval = StlCacheManager.Get <string>(cacheKey);

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

            lock (LockObject)
            {
                retval = StlCacheManager.Get <string>(cacheKey);
                if (retval == null)
                {
                    retval = DataProvider.DatabaseDao.GetStlPageSqlString(sqlString, orderByString, totalNum, pageNum,
                                                                          currentPageIndex);
                    StlCacheManager.Set(cacheKey, retval);
                }
            }

            return(retval);
        }