public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //将修改的数据进行保存 //首先根据键值对获要更新的数据 TblArea tbl = new TblArea(); tbl.ContactId = int.Parse(context.Request.Form["hidenId"]); tbl.ContactName = context.Request.Form["txtName"]; tbl.CellPhone = context.Request.Form["txtPhone"]; tbl.Email = context.Request.Form["txtEmail"]; tbl.GroupId = new ContactGroup(); tbl.GroupId.GroupId = int.Parse(context.Request.Form["sel2"]); UserHandlerBLL bll = new UserHandlerBLL(); int rec = bll.UpdateData(tbl); context.Response.Clear(); if (rec > 0) { context.Response.Write("1"); } else { context.Response.Write("0"); } context.Response.End(); }
private void GetDataForBind() { int pageindex, pagesize, pagecount, recordcount; pageindex = string.IsNullOrEmpty(Context.Request.QueryString["pageindex"]) ? 1 : Convert.ToInt32(Context.Request.QueryString["pageindex"]); pagesize = string.IsNullOrEmpty(Context.Request.QueryString["pagesize"]) ? 3 : Convert.ToInt32(Context.Request.QueryString["pagesize"]); UserHandlerBLL bll = new UserHandlerBLL(); List <TblArea> list = bll.GetData(pageindex, pagesize, out pagecount, out recordcount); this.Repeater1.DataSource = list; this.Repeater1.DataBind(); this.Literal1.Text = PagerHelper.strPage(recordcount, pagesize, pagecount, pageindex, "WebForm1.aspx?pagesize=" + pagesize + "&pageindex="); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //获取下拉列表数据 UserHandlerBLL bll = new UserHandlerBLL(); List <ContactGroup> list = bll.GetList(); //转换为json字符串 JavaScriptSerializer jss = new JavaScriptSerializer(); string strJson = jss.Serialize(list); context.Response.Clear(); context.Response.Write(strJson); context.Response.End(); }
private void LoadContacts() { int pageindex, pagesize, pagecount, recordcount; string pIndex = Context.Request.QueryString["pageindex"]; pageindex = string.IsNullOrEmpty(pIndex) ? 1 : int.Parse(pIndex); pagesize = String.IsNullOrEmpty(Context.Request.QueryString["pagesize"]) ? 3 : int.Parse(Context.Request.QueryString["pagesize"]); UserHandlerBLL bll = new UserHandlerBLL(); List <TblArea> area = bll.GetData(pageindex, pagesize, out pagecount, out recordcount); this.Repeater1.DataSource = area; this.Repeater1.DataBind(); this.Literal1.Text = PagerHelper.strPage(recordcount, pagesize, pagecount, pageindex, "Repeater.aspx?pagesize=" + pagesize + "&pageindex="); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //根据id获取用户要编辑的内容 并显示到前端 int id = int.Parse(context.Request.QueryString["id"]); UserHandlerBLL bll = new UserHandlerBLL(); TblArea area = bll.GetDataById(id); //转换为json字符串 JavaScriptSerializer jss = new JavaScriptSerializer(); string strJson = jss.Serialize(area); context.Response.Clear(); context.Response.Write(strJson); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //获取用户发送过来的数据 TblArea area = new TblArea(); area.ContactName = context.Request.Form["txtName"]; area.CellPhone = context.Request.Form["txtPhone"]; area.Email = context.Request.Form["txtEmail"]; area.GroupId = new ContactGroup(); area.GroupId.GroupId = int.Parse(context.Request.Form["sel1"]); UserHandlerBLL bll = new UserHandlerBLL(); int rec = bll.InsertData(area); context.Response.Clear(); context.Response.Write(rec); context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; //接收用户传过来的id,执行删除语句 int id = int.Parse(context.Request.QueryString["id"]); UserHandlerBLL bll = new UserHandlerBLL(); int rec = bll.DeleteData(id); context.Response.Clear(); if (rec > 0) { context.Response.Write("1"); } else { context.Response.Write("0"); } context.Response.End(); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; int pageindex, pagesize, pagecount, recordcount; string pIndex = context.Request.QueryString["pageindex"]; string pSize = context.Request.QueryString["pagesize"]; pageindex = String.IsNullOrEmpty(pIndex) ? 1 : int.Parse(pIndex); pagesize = String.IsNullOrEmpty(pSize) ? 3 : int.Parse(pSize); UserHandlerBLL bll = new UserHandlerBLL(); List <TblArea> list = bll.GetData(pageindex, pagesize, out pagecount, out recordcount); string strIndex = PagerHelper.strPage(recordcount, pagesize, pagecount, pageindex, "UsersHandler.ashx?pagesize=" + pagesize + "&pageindex="); var sendData = new { _pageData = list, _pageIndex = strIndex }; //序列化为json格式 JavaScriptSerializer jss = new JavaScriptSerializer(); string strJson = jss.Serialize(sendData); context.Response.Clear(); context.Response.Write(strJson); context.Response.End(); }