Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            int         id  = int.Parse(context.Request["Id"] ?? "0");
            BulletinBll bll = new BulletinBll();

            if (bll.Delete(id))
            {
                context.Response.Write("Ok");
            }
        }
Exemplo n.º 2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            BulletinBll bll = new BulletinBll();

            if (context.Request.RequestType.ToUpper() == "GET")
            {
                int      id    = int.Parse(context.Request["Id"] ?? "0");
                Bulletin model = bll.GetModelById(id);                  //根据Id 获取数据
                System.Web.Script.Serialization.JavaScriptSerializer javaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();
                string jsonStr = javaScriptSerializer.Serialize(model); //将对象序列化成json
                context.Response.Write(jsonStr);
            }
            else
            {
                Bulletin model    = new Bulletin();
                string   title    = context.Request["editTitle"];
                string   content  = context.Request["editContent"];
                string   userName = context.Request["editUserName"];

                model.Id       = int.Parse(context.Request["EditId"] ?? "0");
                model.State    = context.Request["editselState"];
                model.TypeId   = int.Parse(context.Request["editTypeId"] ?? "0");
                model.UserName = userName;
                model.Content  = content;
                model.Title    = title;
                if (title == "" || title.Length < 1 || content.Length < 1 || content == "" || userName.Length < 1 || userName == "")
                {
                    context.Response.Write("No:内容或标题包或发布人不能为空!!!");
                    return;
                }
                SensitiveBll senstitiveBll = new SensitiveBll();
                if (senstitiveBll.CheckBanned(content) || senstitiveBll.CheckBanned(title))
                {
                    context.Response.Write("No:内容或标题包含禁用词!!!");
                    return;
                }
                else if (senstitiveBll.CheckMod(content) || senstitiveBll.CheckMod(title))
                {
                    //model.State = "待审核";
                    if (bll.Update(model))
                    {
                        context.Response.Write("Ok:内容或标题包含审核词,请等待审核!!!");
                    }
                }
                else
                {
                    if (bll.Update(model))
                    {
                        context.Response.Write("Ok:成功");
                    }
                }
            }
        }
Exemplo n.º 3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (!IsPostBack)
     {
         BulletinBll bb   = new BulletinBll();
         tb_Bulletin bull = bb.selOneBulletin(Convert.ToInt32(Request.Params["ID"]));
         lblTitle.Text   = bull.Title;
         lblDate.Text    = bull.Date.ToString();
         lblName.Text    = bull.Name;
         txtContent.Text = bull.Content;
     }
 }
Exemplo n.º 4
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            BulletinBll bll = new BulletinBll();
            //当前页码
            int    pageIndex = int.Parse(context.Request["pageIndex"] ?? "1");
            string typeId    = context.Request["typeId"];
            int    pageSize  = 5;              //每页显示数量
            int    total     = bll.GetCount(); //总数量
            //总页数
            int pageCount = Convert.ToInt32(Math.Ceiling(1.0 * total / pageSize));

            pageIndex = pageIndex < 1 ? 1 : pageIndex;
            pageIndex = pageIndex > pageCount ? pageCount : pageIndex;
            List <Bulletin> list        = new List <Bulletin>();
            string          pageNavHtml = "";

            if (string.IsNullOrEmpty(typeId))
            {
                //分页  获取 所有 数据
                list        = bll.GetPageList(pageIndex, pageSize);
                pageNavHtml = Common.PageNav.PageNavGenerate(pageIndex, pageSize, total);
            }
            else
            {
                //根据 类型 分页 获取  数据
                list        = bll.GetPageListByTypeId(pageIndex, pageSize, int.Parse(typeId ?? "0"));
                total       = bll.GetCount(int.Parse(typeId ?? "0"));
                pageNavHtml = Common.PageNav.PageNavGenerate(pageIndex, pageSize, total, int.Parse(typeId ?? "0"));
            }
            UserBll userBll = new UserBll();

            foreach (var b in list)
            {
                b.User = userBll.GetModelByUserName(b.UserName);
            }
            // 分页 html 代码
            //序列化成 json
            JavaScriptSerializer json = new JavaScriptSerializer();
            string jsonStr            = json.Serialize(new { NavHtml = pageNavHtml, List = list });

            //发送到前端
            context.Response.Write(jsonStr);
        }
Exemplo n.º 5
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            Bulletin     model         = new Bulletin();
            SensitiveBll senstitiveBll = new SensitiveBll();
            string       title         = context.Request["Title"];
            string       content       = context.Request["content"];
            string       userName      = context.Request["UserName"];

            model.TypeId   = int.Parse(context.Request["TypeId"] ?? "0");
            model.UserName = userName;
            model.Content  = content;
            model.Title    = title;
            BulletinBll bll = new BulletinBll();

            if (title == "" || title.Length < 1 || content.Length < 1 || content == "" || userName.Length < 1 || userName == "")
            {
                context.Response.Write("No:内容或标题包或发布人不能为空!!!");
                return;
            }

            if (senstitiveBll.CheckBanned(content) || senstitiveBll.CheckBanned(title))
            {//检查 内容中是否存在 禁用 敏感词
                context.Response.Write("No:内容或标题包含禁用词!!!");
                return;
            }
            else if (senstitiveBll.CheckMod(content) || senstitiveBll.CheckMod(title))
            {                       //检查 内容中是否存在 审查 敏感词
                model.State = "待审核";
                if (bll.Add(model)) //调用 业务逻辑层 方法将数据保存到数据库
                {
                    context.Response.Write("Ok:内容或标题包含审核词,请等待审核!!!");
                }
            }
            else
            {
                model.State = "审核通过";
                if (bll.Add(model))//调用 业务逻辑层 方法将数据保存到数据库
                {
                    context.Response.Write("Ok:成功");
                }
            }
        }