Example #1
0
        private string GetDefultSearchPage(string pageUrl, SEARCH_PAGE_LIST default_page, string moduleFlag)
        {
            XYECOM.Configuration.WebInfo webInfo = XYECOM.Configuration.WebInfo.Instance;

            string pageChar = XYECOM.Core.Utils.UrlEncode("{p}");

            if (default_page == SEARCH_PAGE_LIST.SEARCH_SELLER_SEARCH)
            {
                if (pageUrl.IndexOf("search/seller_search") != -1
                    || pageUrl.IndexOf("search/buyer_search") != -1
                    ) return pageUrl;

                if (webInfo.IsBogusStatic)
                    return "/search/seller_search-" + moduleFlag + "---------" + pageChar;
                else
                    return "/search/seller_search." + webInfo.WebSuffix + "?flag=" + moduleFlag;
            }

            if (default_page == SEARCH_PAGE_LIST.SEARCH_NEWS_SEARCH)
            {
                if (pageUrl.IndexOf("channel") != -1) return pageUrl;

                if (pageUrl.IndexOf("search/news_search") != -1) return pageUrl;

                if (webInfo.IsBogusStatic)
                    return "/search/news_search-------" + pageChar + "-";
                else
                    return "/search/news_search." + webInfo.WebSuffix;
            }

            if (default_page == SEARCH_PAGE_LIST.BAIKE_LIST)
            {
                if (webInfo.IsBogusStatic)
                    return "/baike/list---" + pageChar;
                else
                    return "/baike/list." + webInfo.WebSuffix;
            }
            //if (default_page == SEARCH_PAGE_LIST.NEWS_CHANNEL)
            //{

            //    if (webInfo.IsBogusStatic)
            //        return "/search/news_search-------" + pageChar + "-";
            //    else
            //        return "/search/news_search." + webInfo.WebSuffix;
            //}

            if (default_page == SEARCH_PAGE_LIST.JOB_LIST)
            {
                if (pageUrl.IndexOf("/job/list") != -1) return pageUrl;

                if (webInfo.IsBogusStatic)
                    return "/job/list-------" + pageChar + "-";
                else
                    return "/job/list." + webInfo.WebSuffix;

            }

            if (default_page == SEARCH_PAGE_LIST.JOB_RESUMELIST)
            {
                if (pageUrl.IndexOf("/job/resumelist") != -1) return pageUrl;

                if (webInfo.IsBogusStatic)
                    return "/job/resumelist---------" + pageChar + "-";
                else
                    return "/job/resumelist." + webInfo.WebSuffix;

            }

            return pageUrl;
        }
Example #2
0
        /// <summary>
        /// ��ҳ
        /// </summary>
        /// <param name="pageIndex">ҳ��</param>
        /// <param name="pageUrl">Ŀ��ҳ��URL</param>
        /// <param name="default_page">Ŀ��ҳ��URL�޷�ƥ��ʱʹ�õ�Ĭ��ҳ��(��Ҫ�������ҳ��ǩ�ŵ��Ƿ�ҳҳ�������ҳ����ʱ��ҳ����������)</param>
        /// <param name="moduleFlag">ģ���ʶ</param>
        public void SetPagination(int pageIndex, string pageUrl, SEARCH_PAGE_LIST default_page, string moduleFlag)
        {
            if (this.TotalRecord < 1) return;

            string url = string.Empty;

            lock (this)
            {
                //�Ƿ���Ҫת��
                bool exchange = config.IsBogusStatic;

                if (default_page == SEARCH_PAGE_LIST.TEAMBUY_LIST_SHOP)
                {
                    //������������ӣ�����Ҫ����α��̬����ת����������Ҫ����Ϊ��̬���Ӹ�ʽת��
                    config.IsBogusStatic = true;
                    url = pageUrl;
                }
                else if (default_page == SEARCH_PAGE_LIST.SEARCH_BUY)
                {
                    config.IsBogusStatic = false;
                    url = pageUrl;
                }
                else
                {
                    url = GetDefultSearchPage(pageUrl, default_page, moduleFlag);
                }

                int num = 0;
                bool flag = true;
                this.PreviousPage = "";

                this.PageCount = ((this.TotalRecord + this.PageSize - 1) / this.PageSize);

                #region ����ҳ
                if (pageIndex > this.PageCount)
                {
                    this.NextPage = "<span>��һҳ</span>";
                    if (config.IsBogusStatic)
                    {
                        this.PreviousPage += "<a href=\"" + url.Replace("{p}", (pageIndex - 1) + "") + "." + config.WebSuffix + "\">��һҳ</a>";
                    }
                    else
                    {
                        if (url.IndexOf('?') > 0)
                            this.PreviousPage += "<a href=\"" + url + "&pageindex=" + (pageIndex - 1) + "\">��һҳ</a>";
                        else
                            this.PreviousPage += "<a href=\"" + url + "?pageindex=" + (pageIndex - 1) + "\">��һҳ</a>";
                    }
                }
                else if (pageIndex <= 1 && pageIndex != this.PageCount)
                {
                    this.PreviousPage = "<span>��һҳ</span>";
                    if (config.IsBogusStatic)
                    {
                        this.NextPage = "<a href=\"" + url.Replace("{p}", (pageIndex + 1) + "") + "." + config.WebSuffix + "\">��һҳ</a>";
                    }
                    else
                    {
                        if (url.IndexOf('?') > 0)
                            this.NextPage = "<a href=\"" + url + "&pageindex=" + (pageIndex + 1) + "\">��һҳ</a>";
                        else
                            this.NextPage = "<a href=\"" + url + "?pageindex=" + (pageIndex + 1) + "\">��һҳ</a>";
                    }
                }
                else if (pageIndex > 1 && pageIndex < this.PageCount)
                {
                    if (config.IsBogusStatic)
                    {
                        this.NextPage = "<a href=\"" + url.Replace("{p}", (pageIndex + 1) + "") + "." + config.WebSuffix + "\">��һҳ</a>";
                        this.PreviousPage += "<a href=\"" + url.Replace("{p}", (pageIndex - 1) + "") + "." + config.WebSuffix + "\">��һҳ</a>";
                    }
                    else
                    {
                        if (url.IndexOf('?') > 0)
                        {
                            this.NextPage = "<a href=\"" + url + "&pageindex=" + (pageIndex + 1) + "\">��һҳ</a>";
                            this.PreviousPage += "<a href=\"" + url + "&pageindex=" + (pageIndex - 1) + "\">��һҳ</a>";
                        }
                        else
                        {
                            this.NextPage = "<a href=\"" + url + "?pageindex=" + (pageIndex + 1) + "\">��һҳ</a>";
                            this.PreviousPage += "<a href=\"" + url + "?pageindex=" + (pageIndex - 1) + "\">��һҳ</a>";
                        }
                    }
                }
                else if (pageIndex == this.PageCount && this.PageCount != 1)
                {
                    this.NextPage = "<span>��һҳ</span>";

                    if (config.IsBogusStatic)
                    {
                        this.PreviousPage += "<a href=\"" + url.Replace("{p}", (pageIndex - 1) + "") + "." + config.WebSuffix + "\">��һҳ</a>";
                    }
                    else
                    {
                        if (url.IndexOf('?') > 0)
                            this.PreviousPage += "<a href=\"" + url + "&pageindex=" + (pageIndex - 1) + "\">��һҳ</a>";
                        else
                            this.PreviousPage += "<a href=\"" + url + "?pageindex=" + (pageIndex - 1) + "\">��һҳ</a>";
                    }
                }
                else if (pageIndex == this.PageCount && this.PageCount == 1)
                {
                    this.PreviousPage += "<span>��һҳ</span>";
                    this.NextPage = "<span>��һҳ</span>";
                }
                #endregion

                #region ����ҳ��
                for (int i = 1; i <= this.PageCount; i++)
                {
                    if (pageIndex <= 10)
                    {
                        if (num < 10)
                        {
                            if (i == pageIndex)
                                this.NumPage += "<span>" + i + "</span>";
                            else
                            {
                                if (config.IsBogusStatic)
                                {
                                    this.NumPage += "<a href=\"" + url.Replace("{p}", i + "") + "." + config.WebSuffix + "\">" + i + "</a>";
                                }
                                else
                                {
                                    if (url.IndexOf('?') > 0)
                                        this.NumPage += "<a href=\"" + url + "&pageindex=" + i + "\">" + i + "</a>";
                                    else
                                        this.NumPage += "<a href=\"" + url + "?pageindex=" + i + "\">" + i + "</a>";
                                }
                            }
                        }
                    }
                    else
                    {
                        if (num < 3)
                        {
                            if (config.IsBogusStatic)
                            {
                                this.NumPage += "<a href=\"" + url.Replace("{p}", i + "") + "." + config.WebSuffix + "\">" + i + "</a>";
                            }
                            else
                            {
                                if (url.IndexOf('?') > 0)
                                    this.NumPage += "<a href=\"" + url + "&pageindex=" + i + "\">" + i + "</a>";
                                else
                                    this.NumPage += "<a href=\"" + url + "?pageindex=" + i + "\">" + i + "</a>";
                            }
                        }
                        else
                        {
                            if (pageIndex == this.PageCount - 4)
                            {
                                flag = false;
                            }
                            if (pageIndex == this.PageCount - 3)
                            {
                                flag = false;
                            }
                            if (i == pageIndex)
                            {
                                this.NumPage += "<span>" + i + "</span>";
                            }

                            else if (i == pageIndex - 1 && i != this.PageCount - 1)
                            {
                                this.NumPage += "������";

                                if (config.IsBogusStatic)
                                {
                                    this.NumPage += "<a href=\"" + url.Replace("{p}", i + "") + "." + config.WebSuffix + "\">" + i + "</a>";
                                }
                                else
                                {
                                    if (url.IndexOf('?') > 0)
                                        this.NumPage += "<a href=\"" + url + "&pageindex=" + i + "\">" + i + "</a>";
                                    else
                                        this.NumPage += "<a href=\"" + url + "?pageindex=" + i + "\">" + i + "</a>";
                                }
                            }
                            else if (i == this.PageCount - 2 && i != pageIndex - 1)
                            {
                                if (flag)
                                    this.NumPage += "������";
                                if (config.IsBogusStatic)
                                {
                                    this.NumPage += "<a href=\"" + url.Replace("{p}", i + "") + "." + config.WebSuffix + "\">" + i + "</a>";
                                }
                                else
                                {
                                    if (url.IndexOf('?') > 0)
                                        this.NumPage += "<a href=\"" + url + "&pageindex=" + i + "\">" + i + "</a>";
                                    else
                                        this.NumPage += "<a href=\"" + url + "?pageindex=" + i + "\">" + i + "</a>";
                                }
                                flag = true;
                            }
                            else if (i == this.PageCount - 2 && i == pageIndex - 1)
                            {
                                if (config.IsBogusStatic)
                                {
                                    this.NumPage += "<a href=\"" + url + "-" + i + "." + config.WebSuffix + "\">" + i + "</a>";
                                }
                                else
                                {
                                    if (url.IndexOf('?') > 0)
                                        this.NumPage += "<a href=\"" + url + "&pageindex=" + i + "\">" + i + "</a>";
                                    else
                                        this.NumPage += "<a href=\"" + url + "?pageindex=" + i + "\">" + i + "</a>";
                                }
                            }
                            else if (i == this.PageCount || i == pageIndex + 1)
                            {
                                if (config.IsBogusStatic)
                                {
                                    this.NumPage += "<a href=\"" + url.Replace("{p}", i + "") + "." + config.WebSuffix + "\">" + i + "</a>";
                                }
                                else
                                {
                                    if (url.IndexOf('?') > 0)
                                        this.NumPage += "<a href=\"" + url + "&pageindex=" + i + "\">" + i + "</a>";
                                    else
                                        this.NumPage += "<a href=\"" + url + "?pageindex=" + i + "\">" + i + "</a>";
                                }

                            }
                            else if (i == this.PageCount - 1)
                            {
                                if (config.IsBogusStatic)
                                {
                                    this.NumPage += "<a href=\"" + url.Replace("{p}", i + "") + "." + config.WebSuffix + "\">" + i + "</a>";
                                }
                                else
                                {
                                    if (url.IndexOf('?') > 0)
                                        this.NumPage += "<a href=\"" + url + "&pageindex=" + i + "\">" + i + "</a>";
                                    else
                                        this.NumPage += "<a href=\"" + url + "?pageindex=" + i + "\">" + i + "</a>";
                                }
                            }
                        }

                    }

                    num++;
                }
                #endregion
                config.IsBogusStatic = exchange;
            }
        }