コード例 #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);
        }
コード例 #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);
        }
コード例 #3
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);
        }
コード例 #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);
        }
コード例 #5
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);
        }
コード例 #6
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);
        }
コード例 #7
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);
        }
コード例 #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);
        }
コード例 #9
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);
        }
コード例 #10
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);
        }
コード例 #11
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);
        }
コード例 #12
0
        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);
        }
コード例 #13
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);
        }
コード例 #14
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);
        }
コード例 #15
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);
        }
コード例 #16
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);
        }
コード例 #17
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);
        }
コード例 #18
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);
        }
コード例 #19
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);
        }
コード例 #20
0
ファイル: StlSiteCache.cs プロジェクト: ym1100/siteserver-cms
        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);
        }
コード例 #21
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);
        }
コード例 #22
0
ファイル: StlTagCache.cs プロジェクト: googlaq/siteservercms
        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);
        }
コード例 #23
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);
        }
コード例 #24
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);
        }
コード例 #25
0
ファイル: StlTagCache.cs プロジェクト: googlaq/siteservercms
        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);
        }
コード例 #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);
        }
コード例 #27
0
 public static void ClearCache()
 {
     StlCacheManager.Clear(nameof(StlChannelCache));
 }
コード例 #28
0
ファイル: StlDynamic.cs プロジェクト: googlaq/siteservercms
        public static string ParseDynamicContent(int siteId, int channelId, int contentId, int templateId, bool isPageRefresh, string templateContent, string pageUrl, int pageIndex, string ajaxDivId, NameValueCollection queryString, IUserInfo userInfo)
        {
            StlCacheManager.ClearAll();

            var templateInfo = TemplateManager.GetTemplateInfo(siteId, templateId);
            //TemplateManager.GetTemplateInfo(siteID, channelID, templateType);
            var siteInfo = SiteManager.GetSiteInfo(siteId);
            var pageInfo = new PageInfo(channelId, contentId, siteInfo, templateInfo, new Dictionary <string, object>())
            {
                UniqueId = 1000,
                UserInfo = userInfo
            };
            var contextInfo = new ContextInfo(pageInfo);

            templateContent = StlRequestEntities.ParseRequestEntities(queryString, templateContent);
            var contentBuilder = new StringBuilder(templateContent);
            var stlElementList = StlParserUtility.GetStlElementList(contentBuilder.ToString());

            //如果标签中存在<stl:pageContents>
            if (StlParserUtility.IsStlElementExists(StlPageContents.ElementName, stlElementList))
            {
                var stlElement             = StlParserUtility.GetStlElement(StlPageContents.ElementName, stlElementList);
                var stlPageContentsElement = stlElement;
                var stlPageContentsElementReplaceString = stlElement;

                var pageContentsElementParser = new StlPageContents(stlPageContentsElement, pageInfo, contextInfo);
                var pageCount = pageContentsElementParser.GetPageCount(out var totalNum);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    if (currentPageIndex == pageIndex)
                    {
                        var pageHtml = pageContentsElementParser.Parse(totalNum, currentPageIndex, pageCount, false);
                        contentBuilder.Replace(stlPageContentsElementReplaceString, pageHtml);

                        StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, pageUrl, pageInfo.PageChannelId, currentPageIndex, pageCount, totalNum, isPageRefresh, ajaxDivId);

                        break;
                    }
                }
            }
            //如果标签中存在<stl:pageChannels>
            else if (StlParserUtility.IsStlElementExists(StlPageChannels.ElementName, stlElementList))
            {
                var stlElement             = StlParserUtility.GetStlElement(StlPageChannels.ElementName, stlElementList);
                var stlPageChannelsElement = stlElement;
                var stlPageChannelsElementReplaceString = stlElement;

                var pageChannelsElementParser = new StlPageChannels(stlPageChannelsElement, pageInfo, contextInfo);
                int totalNum;
                var pageCount = pageChannelsElementParser.GetPageCount(out totalNum);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    if (currentPageIndex == pageIndex)
                    {
                        var pageHtml = pageChannelsElementParser.Parse(currentPageIndex, pageCount);
                        contentBuilder.Replace(stlPageChannelsElementReplaceString, pageHtml);

                        StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, pageUrl, pageInfo.PageChannelId, currentPageIndex, pageCount, totalNum, isPageRefresh, ajaxDivId);

                        break;
                    }
                }
            }
            //如果标签中存在<stl:pageSqlContents>
            else if (StlParserUtility.IsStlElementExists(StlPageSqlContents.ElementName, stlElementList))
            {
                var stlElement = StlParserUtility.GetStlElement(StlPageSqlContents.ElementName, stlElementList);
                var stlPageSqlContentsElement = stlElement;
                var stlPageSqlContentsElementReplaceString = stlElement;

                var pageSqlContentsElementParser = new StlPageSqlContents(stlPageSqlContentsElement, pageInfo, contextInfo);
                int totalNum;
                var pageCount = pageSqlContentsElementParser.GetPageCount(out totalNum);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    if (currentPageIndex == pageIndex)
                    {
                        var pageHtml = pageSqlContentsElementParser.Parse(totalNum, currentPageIndex, pageCount, false);
                        contentBuilder.Replace(stlPageSqlContentsElementReplaceString, pageHtml);

                        StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, pageUrl, pageInfo.PageChannelId, currentPageIndex, pageCount, totalNum, isPageRefresh, ajaxDivId);

                        break;
                    }
                }
            }

            else if (StlParserUtility.IsStlElementExists(StlPageItems.ElementName, stlElementList))
            {
                var pageCount             = TranslateUtils.ToInt(queryString["pageCount"]);
                var totalNum              = TranslateUtils.ToInt(queryString["totalNum"]);
                var pageContentsAjaxDivId = queryString["pageContentsAjaxDivId"];

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    if (currentPageIndex == pageIndex)
                    {
                        StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, pageUrl, pageInfo.PageChannelId, currentPageIndex, pageCount, totalNum, isPageRefresh, pageContentsAjaxDivId);

                        break;
                    }
                }
            }

            StlParserManager.ParseInnerContent(contentBuilder, pageInfo, contextInfo);

            //var parsedContent = StlParserUtility.GetBackHtml(contentBuilder.ToString(), pageInfo);
            //return pageInfo.HeadCodesHtml + pageInfo.BodyCodesHtml + parsedContent + pageInfo.FootCodesHtml;
            return(contentBuilder.ToString());
        }
コード例 #29
0
ファイル: StlDynamic.cs プロジェクト: xueyu19870128/MyProject
        public static string ParseDynamicContent(DynamicInfo dynamicInfo, string template)
        {
            if (string.IsNullOrEmpty(template))
            {
                return(string.Empty);
            }

            StlCacheManager.ClearAll();

            var templateInfo = TemplateManager.GetTemplateInfo(dynamicInfo.SiteId, dynamicInfo.TemplateId);
            var siteInfo     = SiteManager.GetSiteInfo(dynamicInfo.SiteId);
            var pageInfo     = new PageInfo(dynamicInfo.ChannelId, dynamicInfo.ContentId, siteInfo, templateInfo, new Dictionary <string, object>())
            {
                UniqueId = 1000,
                UserInfo = dynamicInfo.UserInfo
            };
            var contextInfo = new ContextInfo(pageInfo);

            var templateContent = StlRequestEntities.ParseRequestEntities(dynamicInfo.QueryString, template);
            var contentBuilder  = new StringBuilder(templateContent);
            var stlElementList  = StlParserUtility.GetStlElementList(contentBuilder.ToString());

            var pageIndex = dynamicInfo.Page - 1;

            //如果标签中存在<stl:pageContents>
            if (StlParserUtility.IsStlElementExists(StlPageContents.ElementName, stlElementList))
            {
                var stlElement             = StlParserUtility.GetStlElement(StlPageContents.ElementName, stlElementList);
                var stlPageContentsElement = stlElement;
                var stlPageContentsElementReplaceString = stlElement;

                var pageContentsElementParser = new StlPageContents(stlPageContentsElement, pageInfo, contextInfo);
                var pageCount = pageContentsElementParser.GetPageCount(out var totalNum);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    if (currentPageIndex == pageIndex)
                    {
                        var pageHtml = pageContentsElementParser.Parse(totalNum, currentPageIndex, pageCount, false);
                        contentBuilder.Replace(stlPageContentsElementReplaceString, pageHtml);

                        StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);

                        break;
                    }
                }
            }
            //如果标签中存在<stl:pageChannels>
            else if (StlParserUtility.IsStlElementExists(StlPageChannels.ElementName, stlElementList))
            {
                var stlElement             = StlParserUtility.GetStlElement(StlPageChannels.ElementName, stlElementList);
                var stlPageChannelsElement = stlElement;
                var stlPageChannelsElementReplaceString = stlElement;

                var pageChannelsElementParser = new StlPageChannels(stlPageChannelsElement, pageInfo, contextInfo);
                var pageCount = pageChannelsElementParser.GetPageCount(out var totalNum);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    if (currentPageIndex != pageIndex)
                    {
                        continue;
                    }

                    var pageHtml = pageChannelsElementParser.Parse(currentPageIndex, pageCount);
                    contentBuilder.Replace(stlPageChannelsElementReplaceString, pageHtml);

                    StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);

                    break;
                }
            }
            //如果标签中存在<stl:pageSqlContents>
            else if (StlParserUtility.IsStlElementExists(StlPageSqlContents.ElementName, stlElementList))
            {
                var stlElement = StlParserUtility.GetStlElement(StlPageSqlContents.ElementName, stlElementList);
                var stlPageSqlContentsElement = stlElement;
                var stlPageSqlContentsElementReplaceString = stlElement;

                var pageSqlContentsElementParser = new StlPageSqlContents(stlPageSqlContentsElement, pageInfo, contextInfo);
                var pageCount = pageSqlContentsElementParser.GetPageCount(out var totalNum);

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    if (currentPageIndex != pageIndex)
                    {
                        continue;
                    }

                    var pageHtml = pageSqlContentsElementParser.Parse(totalNum, currentPageIndex, pageCount, false);
                    contentBuilder.Replace(stlPageSqlContentsElementReplaceString, pageHtml);

                    StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, dynamicInfo.AjaxDivId);

                    break;
                }
            }

            else if (StlParserUtility.IsStlElementExists(StlPageItems.ElementName, stlElementList))
            {
                var pageCount             = TranslateUtils.ToInt(dynamicInfo.QueryString["pageCount"]);
                var totalNum              = TranslateUtils.ToInt(dynamicInfo.QueryString["totalNum"]);
                var pageContentsAjaxDivId = dynamicInfo.QueryString["pageContentsAjaxDivId"];

                for (var currentPageIndex = 0; currentPageIndex < pageCount; currentPageIndex++)
                {
                    if (currentPageIndex != pageIndex)
                    {
                        continue;
                    }

                    StlParserManager.ReplacePageElementsInDynamicPage(contentBuilder, pageInfo, stlElementList, currentPageIndex, pageCount, totalNum, false, pageContentsAjaxDivId);

                    break;
                }
            }

            StlParserManager.ParseInnerContent(contentBuilder, pageInfo, contextInfo);

            //var parsedContent = StlParserUtility.GetBackHtml(contentBuilder.ToString(), pageInfo);
            //return pageInfo.HeadCodesHtml + pageInfo.BodyCodesHtml + parsedContent + pageInfo.FootCodesHtml;
            return(contentBuilder.ToString());
        }
コード例 #30
0
 public static void ClearCache()
 {
     StlCacheManager.Clear(nameof(StlContentCache));
 }