using MESClassLibrary.BLL.Report; using MESClassLibrary.EFModel; using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// FiveScreenStandardHandler 的摘要说明 /// public class FiveScreenStandardHandler : 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"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } FiveScreenStandardBLL bll = new FiveScreenStandardBLL(); Response.Write(bll.SearchInfoAll(page, pagesize)); Response.End(); } void SaveInfo() { string ID = Request.Params["ID"]; string Name = Request.Params["Name"]; string LastYear = Request.Params["LastYear"]; string Jan = Request.Params["Jan"]; string Feb = Request.Params["Feb"]; string Mar = Request.Params["Mar"]; string Apr = Request.Params["Apr"]; string May = Request.Params["May"]; string Jun = Request.Params["Jun"]; string Jul = Request.Params["Jul"]; string Aug = Request.Params["Aug"]; string Sept = Request.Params["Sept"]; string Oct = Request.Params["Oct"]; string Nov = Request.Params["Nov"]; string Dec = Request.Params["Dec"]; FiveScreenStandardBLL bll = new FiveScreenStandardBLL(); tb_Report_FiveScreenStandard md = new tb_Report_FiveScreenStandard(); md.Name = Name; md.LastYear = Convert.ToDecimal(LastYear); md.Jan = Convert.ToDecimal(Jan); md.Feb = Convert.ToDecimal(Feb); md.Mar = Convert.ToDecimal(Mar); md.Apr = Convert.ToDecimal(Apr); md.May = Convert.ToDecimal(May); md.Jun = Convert.ToDecimal(Jun); md.Jul = Convert.ToDecimal(Jul); md.Aug = Convert.ToDecimal(Aug); md.Sept = Convert.ToDecimal(Sept); md.Oct = Convert.ToDecimal(Oct); md.Nov = Convert.ToDecimal(Nov); md.Dec = Convert.ToDecimal(Dec); 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"]; FiveScreenStandardBLL bll = new FiveScreenStandardBLL(); tb_Report_FiveScreenStandard md = new tb_Report_FiveScreenStandard(); md.ID = ID; Response.Write(bll.DeleteInfo(md) == true ? "true" : "false"); Response.End(); } } }