using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// OperatorHandler 的摘要说明 /// public class OperatorHandler : 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; default: break; } } public bool IsReusable { get { return false; } } void QueryList() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string OperatorName = Request.Params["OperatorName"]; string StationID = Request.Params["StationID"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } OperatorBLL bll = new OperatorBLL(); Response.Write(bll.SearchInfo(page, pagesize, OperatorName, StationID)); Response.End(); } void SaveInfo() { string OperatorID = Request.Params["OperatorID"]; string StationID = Request.Params["StationID"]; string OperatorNo = Request.Params["OperatorNo"]; string OperatorName = Request.Params["OperatorName"]; string OperatorPsw = Request.Params["OperatorPsw"]; string Des = Request.Params["Des"]; OperatorBLL bll = new OperatorBLL(); tb_Operator md = new tb_Operator(); md.StationID = StationID; md.OperatorNo = OperatorNo; md.OperatorName = OperatorName; md.OperatorPsw = OperatorPsw; md.Des = Des; var info = Request.Cookies.Get("LoginUserInfo"); if (info != null) { md.UserID = info["UserID"].ToUpper(); } if (OperatorID == "0") { //新增 md.OperatorID = Guid.NewGuid().ToString(); Response.Write(bll.AddInfo(md) == true ? "true" : "false"); } else { //修改 md.OperatorID = OperatorID; Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); } Response.End(); } void DelInfo() { string OperatorID = Request.Params["OperatorID"]; OperatorBLL bll = new OperatorBLL(); tb_Operator md = new tb_Operator(); md.OperatorID = OperatorID; var info = Request.Cookies.Get("LoginUserInfo"); if (info != null) { md.UserID = info["UserID"].ToUpper(); } Response.Write(bll.DelInfo(md) == true ? "true" : "false"); Response.End(); } } }