Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int bookid = Convert.ToInt32(context.Request["bookid"]);

            List <BookComment> list = new BookCommentBll().GetModelList("BookId=" + bookid);

            //把ubb编码转换为html
            foreach (var item in list)
            {
                item.Msg = ubbCode.UbbToHtml(item.Msg);
            }
            //序列化
            System.Web.Script.Serialization.JavaScriptSerializer jss = new System.Web.Script.Serialization.JavaScriptSerializer();
            context.Response.Write(jss.Serialize(list));
        }
Exemplo n.º 2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BookCommentBll Bll   = new BookCommentBll();
            string         index = Request["index"];

            if (string.IsNullOrEmpty(index))
            {
                pageIndex = 1;
            }
            else
            {
                pageIndex = Convert.ToInt32(index);
            }
            //总页数
            int total = Bll.GetRecordCount("");

            pageCount = Convert.ToInt32(Math.Ceiling((double)total / pageSize));

            //集合
            DataSet ds = Bll.GetListByPage("", "", (pageIndex - 1) * pageSize + 1, pageIndex * pageSize);

            BookCommentList = Bll.DataTableToList(ds.Tables[0]);
        }
Exemplo n.º 3
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string content = context.Request["content"];

            if (IsForbid(content))
            {
                context.Response.Write("no");
            }
            else
            {
                BookComment bc = new BookComment();
                bc.BookId         = Convert.ToInt32(context.Request["bookid"]);
                bc.CreateDateTime = DateTime.Now;

                //将敏感词替换为*号
                List <Articel_Words> awList = new Articel_WordsBll().GetModelList("IsForbid=0");
                foreach (var item in awList)
                {
                    if (content.Contains(item.WordPattern))
                    {
                        content = content.Replace(item.WordPattern, "***");
                    }
                }

                bc.Msg = content;
                int r = new BookCommentBll().Add(bc);
                if (r >= 1)
                {
                    context.Response.Write("ok");
                }
                else
                {
                    context.Response.Write("error");
                }
            }
        }