Esempio n. 1
0
        public static string ParseInSearchPage(string stlElement, PageInfo pageInfo, string ajaxDivId, int nodeId, int currentPageIndex, int pageCount, int totalNum)
        {
            string parsedContent;

            try
            {
                var     xmlDocument = StlParserUtility.GetXmlDocument(stlElement, false);
                XmlNode node        = xmlDocument.DocumentElement;
                node = node.FirstChild;

                var ie       = node.Attributes.GetEnumerator();
                var autoHide = true;
                while (ie.MoveNext())
                {
                    var attr          = (XmlAttribute)ie.Current;
                    var attributeName = attr.Name.ToLower();
                    if (attributeName.Equals(AttributeAutoHide))
                    {
                        autoHide = TranslateUtils.ToBool(attr.Value);
                    }
                }

                if (pageCount <= 1 && autoHide)
                {
                    return(string.Empty);
                }

                //bool isXmlContent;
                var index  = stlElement.IndexOf(">", StringComparison.Ordinal) + 1;
                var length = stlElement.LastIndexOf("<", StringComparison.Ordinal) - index;
                if (index <= 0 || length <= 0)
                {
                    stlElement = node.InnerXml;
                    //isXmlContent = true;
                }
                else
                {
                    stlElement = stlElement.Substring(index, length);
                    //isXmlContent = false;
                }

                parsedContent = StlPageElementParser.ParseStlPageItemsInSearchPage(stlElement, pageInfo, ajaxDivId, nodeId, currentPageIndex, pageCount, totalNum);
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, ex);
            }

            return(parsedContent);
        }
Esempio n. 2
0
        public static string ParseInSearchPage(string stlElement, PageInfo pageInfo, string ajaxDivId, int channelId, int currentPageIndex, int pageCount, int totalNum)
        {
            string parsedContent;

            try
            {
                var     xmlDocument = StlParserUtility.GetXmlDocument(stlElement, false);
                XmlNode node        = xmlDocument.DocumentElement;
                node = node?.FirstChild;

                if (pageCount <= 1)
                {
                    return(string.Empty);
                }

                //bool isXmlContent;
                var index  = stlElement.IndexOf(">", StringComparison.Ordinal) + 1;
                var length = stlElement.LastIndexOf("<", StringComparison.Ordinal) - index;
                if (index <= 0 || length <= 0)
                {
                    stlElement = node?.InnerXml;
                    //isXmlContent = true;
                }
                else
                {
                    stlElement = stlElement.Substring(index, length);
                    //isXmlContent = false;
                }

                parsedContent = StlPageElementParser.ParseStlPageItemsInSearchPage(stlElement, pageInfo, ajaxDivId, channelId, currentPageIndex, pageCount, totalNum);
            }
            catch (Exception ex)
            {
                parsedContent = StlParserUtility.GetStlErrorMessage(ElementName, stlElement, ex);
            }

            return(parsedContent);
        }
Esempio n. 3
0
        public static string ParseInSearchPage(string stlElement, PageInfo pageInfo, string ajaxDivId, int channelId, int currentPageIndex, int pageCount, int totalNum)
        {
            string parsedContent;

            try
            {
                var stlElementInfo = StlParserUtility.ParseStlElement(stlElement);

                if (pageCount <= 1)
                {
                    return(string.Empty);
                }

                //bool isXmlContent;
                var index  = stlElement.IndexOf(">", StringComparison.Ordinal) + 1;
                var length = stlElement.LastIndexOf("<", StringComparison.Ordinal) - index;
                if (index <= 0 || length <= 0)
                {
                    stlElement = stlElementInfo.InnerHtml;
                    //isXmlContent = true;
                }
                else
                {
                    stlElement = stlElement.Substring(index, length);
                    //isXmlContent = false;
                }

                parsedContent = StlPageElementParser.ParseStlPageItemsInSearchPage(stlElement, pageInfo, ajaxDivId, channelId, currentPageIndex, pageCount, totalNum);
            }
            catch (Exception ex)
            {
                parsedContent = LogUtils.AddStlErrorLog(pageInfo, ElementName, stlElement, ex);
            }

            return(parsedContent);
        }