using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// Paint_BucketHandler 的摘要说明 /// public class Paint_BucketHandler : 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; default: break; } } public bool IsReusable { get { return false; } } void QueryList() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string PaintID = Request.Params["PaintID"]; string BucketID = Request.Params["BucketID"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } PaintInfoBLL bll = new PaintInfoBLL(); Response.Write(bll.SearchRelation(page, pagesize, PaintID, BucketID)); Response.End(); } void SaveInfo() { string ID = Request.Params["ID"]; string PaintID = Request.Params["PaintID"]; string BucketID = Request.Params["BucketID"]; PaintInfoBLL bll = new PaintInfoBLL(); tb_Paint_Bucket md = new tb_Paint_Bucket(); md.PaintID = PaintID; md.BucketID = BucketID; if (ID == "0") { //新增 md.ID = Guid.NewGuid().ToString(); Response.Write(bll.AddRelation(md) == true ? "true" : "false"); } else { //修改 md.ID = ID; Response.Write(bll.UpdateRelation(md) == true ? "true" : "false"); } Response.End(); } void DelInfo() { string ID = Request.Params["ID"]; PaintInfoBLL bll = new PaintInfoBLL(); tb_Paint_Bucket md = new tb_Paint_Bucket(); md.ID = ID; Response.Write(bll.DeleteRelation(md) == true ? "true" : "false"); Response.End(); } } }