public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; IList<Node> list = new List<Node>(); int currentpage = int.Parse(context.Request["page"]); int pagesize = int.Parse(context.Request["pagesize"]); CGZSceneryinfo ticket = new CGZSceneryinfo(); List<GZSceneryinfo> ticketlist = ticket.Query(currentpage, pagesize); var total = ticketlist.Count; var totalpage = (float)ticket.QueryRowCount("gzticket"); for (var i = 0; i < total; i++) { list.Add(new Node() { Id = ticketlist[i].ID, detIntroduction = ticketlist[i].DetIntroduction, }); } //声明一个var对象,把读取到的数据复制给它,用来传递给JSON, var gridData = new { Rows = list, Total = totalpage }; string json = JsonConvert.SerializeObject(gridData); context.Response.Write(json); context.Response.End(); }
public static string deleteTicketIntrodection(string id) { CGZSceneryinfo cscenery = new CGZSceneryinfo(); Boolean issucess = cscenery.Delete(id); if (issucess == true) { return "true"; } else { return "false"; } }
public static string updateTicketIntrodection(string Id, string context) { GZSceneryinfo scenery = new GZSceneryinfo(Id, context); CGZSceneryinfo cscenery = new CGZSceneryinfo(); Boolean issucess=cscenery.Modify(scenery); if (issucess == true) { return "true"; } else { return "false"; } }
public Boolean InsertIntroduction(string content) { try { GZSceneryinfo sceneryinfo = new GZSceneryinfo(null, content); CGZSceneryinfo cscenery = new CGZSceneryinfo(); Boolean issucess= cscenery.Insert(sceneryinfo); if (issucess==true) Response.Write("<script>alert('提交成功');</script>"); else Response.Write("<script>alert('提交失败');</script>"); }catch(Exception e) { Response.Write("<script>alert('提交失败');</script>"); return false; } return true; }