using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// FactoryHandler 的摘要说明 /// public class FactoryHandler : 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 "QueryForCombobox": QueryForCombobox(); break; default: break; } } public bool IsReusable { get { return false; } } void QueryList() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string FactoryName = Request.Params["FactoryName"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } FactoryBLL bll = new FactoryBLL(); Response.Write(bll.SearchInfo(page, pagesize, FactoryName)); Response.End(); } void SaveInfo() { string FactoryID = Request.Params["FactoryID"]; string FactoryName = Request.Params["FactoryName"]; string Des = Request.Params["Des"]; FactoryBLL bll = new FactoryBLL(); tb_Factory md = new tb_Factory(); md.FactoryName = FactoryName; md.Des = Des; if (FactoryID == "0") { //新增 md.FactoryID = Guid.NewGuid().ToString(); Response.Write(bll.AddInfo(md) == true ? "true" : "false"); } else { //修改 md.FactoryID = FactoryID; Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); } Response.End(); } void DelInfo() { string FactoryID = Request.Params["FactoryID"]; FactoryBLL bll = new FactoryBLL(); tb_Factory md = new tb_Factory(); md.FactoryID = FactoryID; Response.Write(bll.DelInfo(md) == true ? "true" : "false"); Response.End(); } void QueryForCombobox() { FactoryBLL bll = new FactoryBLL(); Response.Write(bll.GetComboboxData()); Response.End(); } } }