using MESClassLibrary.BLL.Keep; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// KeepItemsHandler 的摘要说明 /// public class KeepItemsHandler : IHttpHandler { HttpRequest Request = null; HttpResponse Response = null; public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; Request = context.Request; Response = context.Response; string method = Request.Params["method"]; switch (method) { case "QueryList": QueryList(); break; case "SaveInfo": SaveInfo(); break; case "DelInfo": DelInfo(); break; case "QueryContentList": QueryContentList(); break; default: break; } } public bool IsReusable { get { return false; } } void QueryList() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string KeepItems = Request.Params["KeepItems"]; string KeepLevelID = Request.Params["KeepLevelID"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } KeepItemsBLL bll = new KeepItemsBLL(); Response.Write(bll.SearchInfoAll(page, pagesize, KeepItems, KeepLevelID)); Response.End(); } void SaveInfo() { string ID = Request.Params["ID"]; string KeepLevelID = Request.Params["KeepLevelID"]; string KeepItems = Request.Params["KeepItems"]; string Des = Request.Params["Des"]; KeepItemsBLL bll = new KeepItemsBLL(); tb_KeepItems md = new tb_KeepItems(); md.KeepLevelID = KeepLevelID; md.KeepItems = KeepItems; md.Des = Des; var info = Request.Cookies.Get("LoginUserInfo"); if (info != null) { md.UserID = info["UserID"].ToUpper(); } if (ID == "0") { //新增 md.ID = Guid.NewGuid().ToString(); Response.Write(bll.AddInfo(md) == true ? "true" : "false"); } else { //修改 md.ID = ID; md.UpdateTime = DateTime.Now; Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); } Response.End(); } void DelInfo() { string ID = Request.Params["ID"]; KeepItemsBLL bll = new KeepItemsBLL(); tb_KeepItems md = new tb_KeepItems(); md.ID = ID; var info = Request.Cookies.Get("LoginUserInfo"); if (info != null) { md.UserID = info["UserID"].ToUpper(); } Response.Write(bll.DeleteInfo(md) == true ? "true" : "false"); Response.End(); } void QueryContentList() { KeepItemsBLL bll = new KeepItemsBLL(); Response.Write(bll.GetTreeData()); Response.End(); } } }