Example #1
0
        public void BindData()
        {
            #region
            //if (!Context.User.Identity.IsAuthenticated)
            //{
            //    return;
            //}
            //AccountsPrincipal user = new AccountsPrincipal(Context.User.Identity.Name);
            //if (user.HasPermissionID(PermId_Modify))
            //{
            //    gridView.Columns[6].Visible = true;
            //}
            //if (user.HasPermissionID(PermId_Delete))
            //{
            //    gridView.Columns[7].Visible = true;
            //}
            #endregion

            DataSet       ds       = new DataSet();
            StringBuilder strWhere = new StringBuilder();
            if (txtKeyword.Text.Trim() != "")
            {
                #warning 代码生成警告:请修改 keywordField 为需要匹配查询的真实字段名称
                //strWhere.AppendFormat("keywordField like '%{0}%'", txtKeyword.Text.Trim());
            }
            ds = bll.GetList(strWhere.ToString());
            gridView.DataSource = ds;
            gridView.DataBind();
        }
Example #2
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string json   = "{}";
            string action = context.Request.Form["Action"];

            if (action == "Show")
            {
                BBS.BLL.BBSSection bll = new BBS.BLL.BBSSection();
                DataSet            ds  = bll.GetList(""); //获取版块列表
                ds.Tables[0].TableName = "CategoryList";  //修改数据表的名字


                //返回列表
                json = Web.DataConvertJson.DataTable2Json(ds.Tables[0]);//转换
            }

            context.Response.Write(json);
        }
Example #3
0
        public void ProcessRequest(HttpContext context)
        {
            //  context.Response.ContentType = "text/plain";

            context.Response.ContentType = "text/html";
            string action = context.Request.Form["Action"];
            string json   = "{\"info\":\"已登录\"}";

            if (action == "Load")
            {
                if (context.Session["ID"] == null)
                {
                    json = "{\"info\":\"未登录\"}";
                }
                else
                {
                    BBS.BLL.BBSSection bll0 = new BBS.BLL.BBSSection();
                    DataSet            ds   = bll0.GetList("");
                    ds.Tables[0].TableName = "BBSSection";
                    string json1 = Web.DataConvertJson.DataTable2Json(ds.Tables[0]);
                    json = "{\"info\":\"已登录\"," + json1.Substring(1);
                }
            }
            else if (action == "Add")
            {
                json = "{\"info\":\"发表失败\"}";

                string content = context.Request.Form["Content"];        //保存文本框对象,提高效率
                content = HttpContext.Current.Server.UrlDecode(content); //反编码



                int      tsid        = int.Parse(context.Request.Form["section"]);
                int      tuid        = int.Parse(context.Session["ID"].ToString());
                int      treplycount = 0;
                string   TTopic      = context.Request.Form["title"];
                string   TContents   = content;
                DateTime TTime       = DateTime.Now;
                int      TClickCount = 0;
                DateTime TLastClickT = DateTime.Now;

                BBS.Model.BBSTopic model = new BBS.Model.BBSTopic();
                model.tsid        = tsid;
                model.tuid        = tuid;
                model.treplycount = treplycount;
                model.TTopic      = TTopic;
                model.TContents   = TContents;
                model.TTime       = TTime;
                model.TClickCount = TClickCount;
                model.TLastClickT = TLastClickT;

                BBS.BLL.BBSTopic bll = new BBS.BLL.BBSTopic();
                int n = bll.Add(model);
                //返回单个文字信息
                if (n > 0)
                {
                    json = "{\"info\":\"增加数据成功\",\"UID\":\"" + tuid + "\"}";
                }
            }

            context.Response.Write(json);
        }