using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// MachineHandler 的摘要说明 /// public class MachineHandler : 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 machineNo = Request.Params["MachineNo"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } MachineBLL bll = new MachineBLL(); Response.Write(bll.SearchInfoAll(page, pagesize, machineNo)); Response.End(); } void SaveInfo() { string MachineID = Request.Params["MachineID"]; string MachineNo = Request.Params["MachineNo"]; string Des = Request.Params["Des"]; MachineBLL bll = new MachineBLL(); tb_Machine md = new tb_Machine(); md.MachineNo = MachineNo; md.Des = Des; if (MachineID == "0") { //新增 md.MachineID = Guid.NewGuid().ToString(); Response.Write(bll.AddInfo(md) == true ? "true" : "false"); } else { //修改 md.MachineID = MachineID; Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); } Response.End(); } void DelInfo() { string MachineID = Request.Params["MachineID"]; MachineBLL bll = new MachineBLL(); tb_Machine md = new tb_Machine(); md.MachineID = MachineID; Response.Write(bll.DeleteInfo(md) == true ? "true" : "false"); Response.End(); } void QueryForCombobox() { MachineBLL bll = new MachineBLL(); Response.Write(bll.GetComboboxData()); Response.End(); } } }