using MESClassLibrary.BLL.Injection; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// InjectionWasteRecordHandler 的摘要说明 /// public class InjectionWasteRecordHandler : 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; default: break; } } public bool IsReusable { get { return false; } } void QueryList() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string StartTime = Request.Params["StartTime"]; string EndTime = Request.Params["EndTime"]; string stationID = Request.Params["StationID"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } InjectionRecordBLL bll = new InjectionRecordBLL(); Response.Write(bll.SearchInfo(page, pagesize, StartTime, EndTime, stationID)); Response.End(); } void SaveInfo() { string ID = Request.Params["ID"]; string RealCycle = Request.Params["RealCycle"]; string JK_Weight = Request.Params["JK_Weight"]; string Waste_Weight = Request.Params["Waste_Weight"]; InjectionRecordBLL bll = new InjectionRecordBLL(); tb_Product_Injection_w md = new tb_Product_Injection_w(); md.ID = ID; decimal RealCycle_ = 0; Decimal.TryParse(RealCycle, out RealCycle_); md.RealCycle = RealCycle_; double JK_Weight_ = 0; Double.TryParse(JK_Weight, out JK_Weight_); md.JK_Weight = JK_Weight_; double Waste_Weight_ = 0; Double.TryParse(Waste_Weight, out Waste_Weight_); md.Waste_Weight = Waste_Weight_; Response.Write(bll.UpdateWasteInfo(md) == true ? "true" : "false"); Response.End(); } } }