918博天堂

Server : Microsoft-IIS/10.0
System : Windows NT EBS-6136 10.0 build 17763 (Windows Server 2016) i586
User : jxgj ( 0)
PHP Version : 7.0.33
Disable Function : passthru,exec,system,shell_exec,proc_open,popen,pcntl_exec,socket_bind,stream_socket_server
Directory :  D:/tmp_aspnet/root/dc15253c/377bd30d/
Upload File :
Current Directory [ Writeable ] Root Directory [ Writeable ]


Current File : D:/tmp_aspnet/root/dc15253c/377bd30d/App_Web_7dsc66iy.0.cs
?#pragma checksum "D:\wwwroot\jmxbaogao\wwwroot\Counter\NewArticleMessageView.ashx" "{406ea660-64cf-4c82-b6f0-42d48172a799}" "2D69845A03B8A6CDF3999BCFAB0748E5"

#line 1 "D:\wwwroot\jmxbaogao\wwwroot\Counter\NewArticleMessageView.ashx"


/****************************************
 * 版权所有:南昌金启软件有限公司
 * 网    址:www.21it.com
 ****************************************/
using System;
using System.Collections.Specialized;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Reflection;
using System.Web;
using Com.Huji.DataBll;
using Com.Huji.DataTools;
using Com.Huji.Web.Pager;

namespace Com.Huji.Web.Counter
{
    public class NewArticleMessageView : BaseHandler
    {
        protected NewColumnsBll columnBll = new NewColumnsBll();
        protected NewArticleBll articleBll = new NewArticleBll();
        private NewLanguageBll languageBll = new NewLanguageBll();


        /// <summary>
        /// 此职能仅用于文章所关联的留言信息中,对设置设计师评论进行显示。
        /// <script type="text/javascript" src="/Counter/NewArticleMessageView.ashx?id=67&language_id=1&article_id=13&is_list=true&page_num=8&PageIndex=1"></script>
        /// </summary>
        /// <param name="context"></param>
        public override void ProcessRequest(HttpContext context)
        {

            context.Response.ContentType = "text/plain";
            if (!ProcessRequestError()) return;
            try
            {

                #region 显示列表
                //显示列表
                StringText builderList = new StringText();
                if (Converts.ToBoolean(context.Request.QueryString["is_list"]))
                {
                    NewMessageBll comBll = new NewMessageBll();
                    string strWhere = " and t.column_id=" + context.Request.QueryString["id"] + " and t.language_id=" + context.Request.QueryString["language_id"];
                    if (!String.IsNullOrEmpty(context.Request.QueryString["article_id"]))
                        strWhere += " and t.article_id=" + context.Request.QueryString["article_id"];
                    //先行查找所有能找到的数据,若是为0,则暗示找不到任何纪录
                    int articleNum = comBll.GetNewMessageCount(strWhere);
                    builderList.Append("<div class=\"messageList_com\">");

                    int pageSize = Converts.ToInt32(context.Request.QueryString["page_num"]) != 0 ? Converts.ToInt32(context.Request.QueryString["page_num"]) : articleNum;

                    if (articleNum != 0)
                    {
                        //12 UsePage -------是否分页显示,True为分页显示,False为不分页显示,每页显示的文章数量在后盾栏目设置中指定 
                        DataTable dt = comBll.GetNewMessageList(pageSize, strWhere, PageIndex, " t.createdate desc", articleNum);

                        foreach (DataRow c in dt.Rows)
                        {

                            builderList.Append("<div class=\"messageList_name\">");
                            builderList.Append("<span class=\"messageList_name_span\"> " + c["message_1"] + "</span> ");
                            builderList.Append("<span class=\"messageList_time_span\"> " + Converts.ToDateTime(c["createdate"]) + "</span> ");
                            builderList.Append("</div>");

                            builderList.Append("<div class=\"messageList_list\">");
                            builderList.Append("<div class=\"jt\"></div>");
                            builderList.Append("<div><span>服务态度:</span> " + c["message_3"] + "</div>");
                            builderList.Append("<div><span>技术技术:</span> " + c["message_2"] + "</div>");
                            builderList.Append("<div style=\"clear:both;\"></div>");
                            builderList.Append("</div>");
                        }
                    }
                    else
                    {
                        builderList.Append(ShowLangInfo("NoData", context));
                    }
                    builderList.Append("</div>");
                    if (articleNum != 0)
                    {
                        string surl = "";

                        if (context.Request.UrlReferrer != null)
                            surl = Converts.StrSplitIndex(context.Request.UrlReferrer.AbsoluteUri, '?', 0) + "?" +
                                   Converts.StrSplitIndex(context.Request.RawUrl, '?', 1);

                        int allpage = articleNum % pageSize == 0
                                          ? articleNum / pageSize
                                          : Converts.ToInt32(Converts.SubFileName((articleNum / pageSize).ToString())) + 1;
                        builderList.Append("<div class=\"pageClass\">");
                        builderList.Append(GetPageSize(surl, PageIndex, allpage, articleNum, context));
                        builderList.Append("</div>");
                    }
                    context.Response.Write("document.write('" + builderList.ToString() + "');");
                }
                #endregion

            }
            catch (SqlException ex)
            {
                Logger.Error(ex.ToString());
                throw ex;
            }
        }



        #region
        /// <summary>
        /// 分页号
        /// </summary>
        protected int PageIndex
        {
            get { return String.IsNullOrEmpty(HttpContext.Current.Request.UrlReferrer.AbsoluteUri) ? PublicParameters.OnePram : Converts.ToInt32(Converts.StrSplitIndex(HttpContext.Current.Request.UrlReferrer.AbsoluteUri, "PageIndex=", 1), 1); }
        }

        /// <summary>
        /// 分页代码
        /// </summary>
        /// <param name="url">页面URL</param>
        /// <param name="page">当前页面</param>
        /// <param name="allPage">共几多页</param>
        /// <param name="allCount">共几多笔纪录</param>
        /// <param name="isStatic"></param>
        /// <param name="isNewsView"></param>
        /// <returns></returns>
        protected string GetPageSize(string url, int page, int allPage, int allCount, HttpContext context)
        {

            int pageNum = 7;
            int pageSelect = 3;
            int prvPage = page - 1;
            int nextPage = page + 1;
            if (prvPage < 1)
                prvPage = 1;
            if (nextPage > allPage)
                nextPage = allPage;
            int startPage = page - pageSelect;
            int endPage = page + pageSelect;
            //若是总数据大于页数
            if (allPage > pageNum)
            {
                if (startPage < 1)
                {
                    startPage = 1;
                    endPage = pageNum;
                }

                if (endPage > allPage)
                {
                    endPage = allPage;
                    startPage = allPage - pageNum;
                }
            }
            else
            {
                startPage = 1;
                endPage = allPage;
            }

            string strHtml = "";
            string fh;
            if (url.IndexOf("?") > -1)
                fh = "&";
            else
                fh = "?";

            strHtml += "<A><span>" + ShowLangInfo("PageAll", context) + " " + allCount + " " + ShowLangInfo("PageUnit", context) + "</span></A> ";

            //若是起头数大于组装数
            if (page > (pageNum - pageSelect) && allPage > pageNum)
            {
                strHtml += "<a  href=\"" + url + fh + "PageIndex=1\"><span>1..</span></a> ";
            }
            if (page != 1)
            {
                strHtml += "<a class=\"prv\"  href=\"" + url + fh + "PageIndex=" + prvPage + "\"><span>" + ShowLangInfo("PagePrev", context) + "</span></a> ";
            }

            for (int i = startPage; i <= endPage; i++)
            {
                if (i.Equals(page))
                {
                    strHtml += "<strong><span>" + i + "</span></strong> ";
                }
                else
                {
                    strHtml += "<a href=\"" + url + fh + "PageIndex=" + i + "\"><span>" + i + "</span></a> ";

                }
            }
            if (page != allPage)
            {

                strHtml += "<a class=\"next\" href=\"" + url + fh + "PageIndex=" + nextPage + "\"><span>" + ShowLangInfo("PageNext", context) + "</span></a> ";
            }
            //若是页数+扩大数 幼于总数
            if (page + pageSelect < allPage && allPage > pageNum)
            {

                strHtml += "<a  href=\"" + url + fh + "PageIndex=" + allPage + "\"><span>" + allPage + "..</span></a>";
            }
            return strHtml;
        }

        #endregion
    }
}

#line default
#line hidden