using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// ModelInfoHandler 的摘要说明 /// public class ModelInfoHandler : 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 "QueryUpdateList": QueryUpdateList(); break; case "SaveUpdateInfo": SaveUpdateInfo(); break; case "DelUpdateInfo": DelUpdateInfo(); 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 ModelNo = Request.Params["ModelNo"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } ModelInfoBLL bll = new ModelInfoBLL(); Response.Write(bll.SearchInfoAll(page, pagesize, ModelNo)); Response.End(); } void SaveInfo() { string ID = Request.Params["ID"]; string ModelName = Request.Params["ModelName"]; string ModelNo = Request.Params["ModelNo"]; string PermanentAssetsNo = Request.Params["PermanentAssetsNo"]; string Tonnage = Request.Params["Tonnage"]; string ServiceLife = Request.Params["ServiceLife"]; string Supplier = Request.Params["Supplier"]; string PartWeight = Request.Params["PartWeight"]; string InjectionPeriod = Request.Params["InjectionPeriod"]; string LocatingRingSize = Request.Params["LocatingRingSize"]; string OutForm = Request.Params["OutForm"]; string ModelWeight = Request.Params["ModelWeight"]; string RunnerForm = Request.Params["RunnerForm"]; string ModelCavityNo = Request.Params["ModelCavityNo"]; string ModelSize = Request.Params["ModelSize"]; ModelInfoBLL bll = new ModelInfoBLL(); tb_ModelInfo md = new tb_ModelInfo(); md.ModelName = ModelName; md.ModelNo = ModelNo; md.PermanentAssetsNo = PermanentAssetsNo; md.Tonnage = Tonnage; md.ServiceLife = ServiceLife; md.Supplier = Supplier; md.PartWeight = PartWeight; md.InjectionPeriod = InjectionPeriod; md.LocatingRingSize = LocatingRingSize; md.OutForm = OutForm; md.ModelWeight = ModelWeight; md.RunnerForm = RunnerForm; md.ModelCavityNo = ModelCavityNo; md.ModelSize = ModelSize; 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"]; ModelInfoBLL bll = new ModelInfoBLL(); tb_ModelInfo md = new tb_ModelInfo(); md.ID = ID; Response.Write(bll.DeleteInfo(md) == true ? "true" : "false"); Response.End(); } void QueryUpdateList() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string ModelID = Request.Params["ModelID"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } ModelUpdateBLL bll = new ModelUpdateBLL(); Response.Write(bll.SearchInfoAll(page, pagesize, ModelID)); Response.End(); } void SaveUpdateInfo() { string ModelID = Request.Params["ModelID"]; string Purpose = Request.Params["Purpose"]; string State = Request.Params["State"]; string Supplier = Request.Params["Supplier_u"]; string Remarks = Request.Params["Remarks"]; string AddTime = Request.Params["AddTime"]; ModelUpdateBLL bll = new ModelUpdateBLL(); tb_Model_Update md = new tb_Model_Update(); md.ModelID = ModelID; md.Purpose = Purpose; md.State = State; md.Supplier = Supplier; md.Remarks = Remarks; md.AddTime = AddTime != null ? Convert.ToDateTime(AddTime) : DateTime.Now; //新增 md.ID = Guid.NewGuid().ToString(); Response.Write(bll.AddUpdateInfo(md) == true ? "true" : "false"); Response.End(); } void DelUpdateInfo() { string ID = Request.Params["ID"]; ModelUpdateBLL bll = new ModelUpdateBLL(); tb_Model_Update md = new tb_Model_Update(); md.ID = ID; Response.Write(bll.DeleteInfo(md) == true ? "true" : "false"); Response.End(); } void QueryForCombobox() { ModelInfoBLL bll = new ModelInfoBLL(); Response.Write(bll.GetComboboxData()); Response.End(); } } }