using MESClassLibrary.BLL; using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// PlasticHandler 的摘要说明 /// public class PlasticHandler : 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 stockNo = Request.Params["StockNo"]; string partNo = Request.Params["PartNo"]; string StationID = Request.Params["StationID"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } PlasticBLL bll = new PlasticBLL(); Response.Write(bll.SearchInfoAll(page, pagesize, stockNo, partNo, StationID)); Response.End(); } void SaveInfo() { string ID = Request.Params["ID"]; string StockNo = Request.Params["StockNo"]; string PartNo = Request.Params["PartNo"]; string CycleTime = Request.Params["CycleTime"]; string StationID = Request.Params["StationID"]; string IsBackup = Request.Params["IsBackup"]; string Weight = Request.Params["Weight"]; string OpenDebugTime = Request.Params["OpenDebugTime"]; string PrinterNo = Request.Params["PrinterNo"]; PlasticBLL bll = new PlasticBLL(); tb_Plastic md = new tb_Plastic(); md.StockNo = StockNo; md.PartNo = PartNo; md.StationID = StationID; int CycleTime_ = 0; Int32.TryParse(CycleTime, out CycleTime_); md.CycleTime = CycleTime_; int IsBackup_ = 0; Int32.TryParse(IsBackup, out IsBackup_); md.IsBackup = IsBackup_; int Weight_ = 0; Int32.TryParse(Weight, out Weight_); md.Weight = Weight_; int OpenDebugTime_ = 0; Int32.TryParse(OpenDebugTime, out OpenDebugTime_); md.OpenDebugTime = OpenDebugTime_; int PrinterNo_ = 0; Int32.TryParse(PrinterNo, out PrinterNo_); md.PrinterNo = PrinterNo_; md.StationID = StationID; 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; Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); } Response.End(); } void DelInfo() { string ID = Request.Params["ID"]; PlasticBLL bll = new PlasticBLL(); tb_Plastic md = new tb_Plastic(); 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 QueryForCombobox() { string StationID = Request.Params["StationID"]; PlasticBLL bll = new PlasticBLL(); Response.Write(bll.QueryForCombobox(StationID)); Response.End(); } } }