Exemplo n.º 1
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string json   = "{}";
            string action = context.Request.Form["Action"];

            if (action == "Show")
            {
                BBS.BLL.BBSTopic bll = new BBS.BLL.BBSTopic();
                DataSet          ds  = bll.GetList(10, "", "TClickCount"); //获取点击率最高的
                ds.Tables[0].TableName = "hotArticles";                    //修改数据表的名字


                DataSet dstop5 = bll.GetList(10, "", "TTime"); //获取最新的

                DataTable top5 = dstop5.Tables[0].Copy();      //获取数据表
                top5.TableName = "newArticles";                //改名
                ds.Tables.Add(top5);                           //把前5个用户的数据表,加到数据集ds中

                //返回列表
                json = Web.DataConvertJson.Dataset2Json(ds);//转换
            }

            context.Response.Write(json);
        }
Exemplo n.º 2
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();
        }