using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { public class PaintInfoHandler : 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 PaintCode = Request.Params["PaintCode"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } PaintInfoBLL bll = new PaintInfoBLL(); Response.Write(bll.SearchInfoAll(page, pagesize, PaintCode)); Response.End(); } void SaveInfo() { string ID = Request.Params["ID"]; string PaintCode = Request.Params["PaintCode"]; string PaintName = Request.Params["PaintName"]; string PaintModel = Request.Params["PaintModel"]; //string UnitCode = Request.Params["UnitCode"]; string CarModelCode = Request.Params["CarModelCode"]; string IsUsing = Request.Params["IsUsing"]; PaintInfoBLL bll = new PaintInfoBLL(); tb_PaintInfo md = new tb_PaintInfo(); md.PaintCode = PaintCode; md.PaintName = PaintName; md.PaintModel = PaintModel; //md.UnitCode = UnitCode; md.CarModelCode = CarModelCode; md.IsUsing = Convert.ToInt16(IsUsing); if (ID == "0") { //新增 md.ID = Guid.NewGuid().ToString(); md.CreateTime = DateTime.Now; 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"]; PaintInfoBLL bll = new PaintInfoBLL(); tb_PaintInfo md = new tb_PaintInfo(); md.ID = ID; Response.Write(bll.DeleteInfo(md) == true ? "true" : "false"); Response.End(); } void QueryForCombobox() { PaintInfoBLL bll = new PaintInfoBLL(); Response.Write(bll.GetComboboxData()); Response.End(); } } }