Exemplo n.º 1
0
        public StlPageChannels(string stlPageChannelsElement, PageInfo pageInfo, ContextInfo contextInfo)
        {
            _stlPageChannelsElement = stlPageChannelsElement;

            _stlPageChannelsElement = stlPageChannelsElement;
            _pageInfo = pageInfo;
            var stlElementInfo = StlParserUtility.ParseStlElement(stlPageChannelsElement);

            _contextInfo = contextInfo.Clone(stlPageChannelsElement, stlElementInfo.InnerHtml, stlElementInfo.Attributes);

            DisplayInfo = ListInfo.GetListInfo(pageInfo, _contextInfo, EContextType.Channel);

            var channelId = StlDataUtility.GetChannelIdByLevel(pageInfo.SiteId, _contextInfo.ChannelId, DisplayInfo.UpLevel, DisplayInfo.TopLevel);

            channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(pageInfo.SiteId, channelId, DisplayInfo.ChannelIndex, DisplayInfo.ChannelName);

            var isTotal = TranslateUtils.ToBool(DisplayInfo.Others.Get(IsTotal));

            if (TranslateUtils.ToBool(DisplayInfo.Others.Get(IsAllChildren)))
            {
                DisplayInfo.Scope = EScopeType.Descendant;
            }

            _dataSet = StlDataUtility.GetPageChannelsDataSet(pageInfo.SiteId, channelId, DisplayInfo.GroupChannel, DisplayInfo.GroupChannelNot, DisplayInfo.IsImageExists, DisplayInfo.IsImage, DisplayInfo.StartNum, DisplayInfo.TotalNum, DisplayInfo.OrderByString, DisplayInfo.Scope, isTotal, DisplayInfo.Where);
        }
Exemplo n.º 2
0
        public static object Parse(PageInfo pageInfo, ContextInfo contextInfo)
        {
            var listInfo   = ListInfo.GetListInfo(pageInfo, contextInfo, EContextType.Content);
            var dataSource = GetDataSource(pageInfo, contextInfo, listInfo);

            if (contextInfo.IsStlEntity)
            {
                return(ParseEntity(pageInfo, dataSource));
            }

            return(ParseElement(pageInfo, contextInfo, listInfo, dataSource));
        }
Exemplo n.º 3
0
        public static object Parse(PageInfo pageInfo, ContextInfo contextInfo)
        {
            var listInfo   = ListInfo.GetListInfo(pageInfo, contextInfo, EContextType.SqlContent);
            var dataSource = StlDataUtility.GetSqlContentsDataSource(listInfo.ConnectionString, listInfo.QueryString, listInfo.StartNum, listInfo.TotalNum, listInfo.OrderByString);

            if (contextInfo.IsStlEntity)
            {
                return(ParseEntity(dataSource));
            }

            return(ParseElement(pageInfo, contextInfo, listInfo, dataSource));
        }
Exemplo n.º 4
0
        public static object Parse(PageInfo pageInfo, ContextInfo contextInfo)
        {
            var listInfo = ListInfo.GetListInfo(pageInfo, contextInfo, EContextType.Site);
            var siteName = listInfo.Others.Get(SiteName);
            var siteDir  = listInfo.Others.Get(SiteDir);

            var dataSource = StlDataUtility.GetSitesDataSource(siteName, siteDir, listInfo.StartNum, listInfo.TotalNum, listInfo.Where, listInfo.Scope, listInfo.OrderByString);

            if (contextInfo.IsStlEntity)
            {
                return(ParseEntity(dataSource));
            }

            return(ParseElement(pageInfo, contextInfo, listInfo, dataSource));
        }
Exemplo n.º 5
0
        //public StlPageSqlContents(string stlPageSqlContentsElement, PageInfo pageInfo, ContextInfo contextInfo, bool isXmlContent, bool isLoadData)
        //{
        //    _stlPageSqlContentsElement = stlPageSqlContentsElement;
        //    _pageInfo = pageInfo;
        //    try
        //    {
        //        var stlElementInfo = StlParserUtility.ParseStlElement(_stlPageSqlContentsElement);

        //        _contextInfo = contextInfo.Clone(stlPageSqlContentsElement, stlElementInfo.InnerHtml, stlElementInfo.Attributes);

        //        _listInfo = ListInfo.GetListInfo(_pageInfo, _contextInfo, EContextType.SqlContent);
        //        if (isLoadData)
        //        {
        //            _dataSet = StlDataUtility.GetPageSqlContentsDataSet(_listInfo.ConnectionString, _listInfo.QueryString, _listInfo.StartNum, _listInfo.TotalNum, _listInfo.OrderByString);
        //        }
        //    }
        //    catch
        //    {
        //        _listInfo = new ListInfo();
        //    }
        //}

        public StlPageSqlContents(string stlPageSqlContentsElement, PageInfo pageInfo, ContextInfo contextInfo)
        {
            _pageInfo = pageInfo;
            try
            {
                var stlElementInfo = StlParserUtility.ParseStlElement(stlPageSqlContentsElement);

                _contextInfo = contextInfo.Clone(stlPageSqlContentsElement, stlElementInfo.InnerHtml, stlElementInfo.Attributes);

                _listInfo = ListInfo.GetListInfo(_pageInfo, _contextInfo, EContextType.SqlContent);
                _dataSet  = StlDataUtility.GetPageSqlContentsDataSet(_listInfo.ConnectionString, _listInfo.QueryString, _listInfo.StartNum, _listInfo.TotalNum, _listInfo.OrderByString);
            }
            catch
            {
                _listInfo = new ListInfo();
            }
        }
Exemplo n.º 6
0
        public StlPageContents(string stlPageContentsElement, PageInfo pageInfo, ContextInfo contextInfo)
        {
            _stlPageContentsElement = stlPageContentsElement;
            _pageInfo    = pageInfo;
            _contextInfo = contextInfo;

            var stlElementInfo = StlParserUtility.ParseStlElement(stlPageContentsElement);

            _contextInfo = contextInfo.Clone(stlPageContentsElement, stlElementInfo.InnerHtml, stlElementInfo.Attributes);

            ListInfo = ListInfo.GetListInfo(_pageInfo, _contextInfo, EContextType.Content);

            var channelId = StlDataUtility.GetChannelIdByLevel(_pageInfo.SiteId, _contextInfo.ChannelId, ListInfo.UpLevel, ListInfo.TopLevel);

            channelId = StlDataUtility.GetChannelIdByChannelIdOrChannelIndexOrChannelName(_pageInfo.SiteId, channelId, ListInfo.ChannelIndex, ListInfo.ChannelName);

            SqlString = StlDataUtility.GetStlPageContentsSqlString(_pageInfo.SiteInfo, channelId, ListInfo);
        }
Exemplo n.º 7
0
        //API StlActionsSearchController调用
        public StlPageContents(string stlPageContentsElement, PageInfo pageInfo, ContextInfo contextInfo, int pageNum, string tableName, string whereString)
        {
            _pageInfo    = pageInfo;
            _contextInfo = contextInfo;

            var stlElementInfo = StlParserUtility.ParseStlElement(stlPageContentsElement);

            _contextInfo = contextInfo.Clone(stlPageContentsElement, stlElementInfo.InnerHtml, stlElementInfo.Attributes);

            ListInfo = ListInfo.GetListInfo(_pageInfo, _contextInfo, EContextType.Content);

            ListInfo.Scope = EScopeType.All;

            ListInfo.Where += whereString;
            if (pageNum > 0)
            {
                ListInfo.PageNum = pageNum;
            }

            SqlString = StlDataUtility.GetPageContentsSqlStringBySearch(tableName, ListInfo.GroupContent, ListInfo.GroupContentNot, ListInfo.Tags, ListInfo.IsImageExists, ListInfo.IsImage, ListInfo.IsVideoExists, ListInfo.IsVideo, ListInfo.IsFileExists, ListInfo.IsFile, ListInfo.StartNum, ListInfo.TotalNum, ListInfo.OrderByString, ListInfo.IsTopExists, ListInfo.IsTop, ListInfo.IsRecommendExists, ListInfo.IsRecommend, ListInfo.IsHotExists, ListInfo.IsHot, ListInfo.IsColorExists, ListInfo.IsColor, ListInfo.Where);
        }
Exemplo n.º 8
0
        //private readonly DataSet _dataSet;

        public StlPageSqlContents(string stlPageSqlContentsElement, PageInfo pageInfo, ContextInfo contextInfo)
        {
            _stlPageSqlContentsElement = stlPageSqlContentsElement;
            _pageInfo = pageInfo;
            try
            {
                var stlElementInfo = StlParserUtility.ParseStlElement(stlPageSqlContentsElement);

                _contextInfo = contextInfo.Clone(stlPageSqlContentsElement, stlElementInfo.InnerHtml, stlElementInfo.Attributes);

                _listInfo = ListInfo.GetListInfo(_pageInfo, _contextInfo, EContextType.SqlContent);

                _sqlString = _listInfo.QueryString;
                if (string.IsNullOrWhiteSpace(_listInfo.OrderByString))
                {
                    var pos = _sqlString.LastIndexOf(" ORDER BY ", StringComparison.OrdinalIgnoreCase);
                    if (pos > -1)
                    {
                        _sqlString = _sqlString.Substring(0, pos);
                        _listInfo.OrderByString = _sqlString.Substring(pos);
                    }
                }
                else
                {
                    if (_listInfo.OrderByString.IndexOf("ORDER BY", StringComparison.OrdinalIgnoreCase) == -1)
                    {
                        _listInfo.OrderByString = $"ORDER BY {_listInfo.OrderByString}";
                    }
                }

                //_dataSet = StlDataUtility.GetPageSqlContentsDataSet(_listInfo.ConnectionString, _listInfo.QueryString, _listInfo.StartNum, _listInfo.PageNum, _listInfo.OrderByString);
            }
            catch (Exception ex)
            {
                LogUtils.AddStlErrorLog(pageInfo, ElementName, stlPageSqlContentsElement, ex);
                _listInfo = new ListInfo();
            }
        }
Exemplo n.º 9
0
        public static string Parse(PageInfo pageInfo, ContextInfo contextInfo)
        {
            var listInfo = ListInfo.GetListInfo(pageInfo, contextInfo, EContextType.Content);

            return(ParseImpl(pageInfo, contextInfo, listInfo));
        }