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 CycleTime = Request.Params["CycleTime"]; string StationID = Request.Params["StationID"]; string IsBackup = Request.Params["IsBackup"]; string Weight = Request.Params["Weight"]; string OpenDebugTime = Request.Params["OpenDebugTime"]; PlasticBLL bll = new PlasticBLL(); tb_Plastic md = new tb_Plastic(); md.StockNo = StockNo; 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_; md.StationID = StationID; if (ID == "0") { //新增 Response.Write(bll.AddInfo(md) == true ? "true" : "false"); } else { //修改 Response.Write(bll.UpdateInfo(md) == true ? "true" : "false"); } Response.End(); } void DelInfo() { string StockNo = Request.Params["StockNo"]; PlasticBLL bll = new PlasticBLL(); tb_Plastic md = new tb_Plastic(); md.StockNo = StockNo; 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(); } } }