using System; using System.Collections.Generic; using System.Linq; using System.Web; using MESClassLibrary.BLL.BasicInfo; using MESClassLibrary.BLL.Injection; using MESWebSite.Manage; namespace MESWebSite.HttpHandlers { /// /// BarCodeReportnHandler 的摘要说明 /// public class BarCodeReportnHandler : 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 "QueryList1": QueryList1(); break; } } void QueryList() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string StationID = Request.Params["StationID"]; string barcode = Request.Params["barcode"]; string startTime = Request.Params["startTime"]; string endTime = Request.Params["endTime"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } if (string.IsNullOrEmpty(startTime)) { startTime = DateTime.Now.ToString("yyyy-MM-dd") + " 00:00:00"; endTime = DateTime.Now.ToString("yyyy-MM-dd") + " 23:59:59"; } BarCodeRecordBLL bll = new BarCodeRecordBLL(); Response.Write(bll.SearchInfoAll(page, pagesize, StationID, barcode, startTime, endTime)); Response.End(); } void QueryList1() { string page = Request.Params["page"]; string pagesize = Request.Params["rows"]; string startTime = Request.Params["startTime"]; string endTime = Request.Params["endTime"]; if (string.IsNullOrEmpty(page)) { page = "0"; } if (string.IsNullOrEmpty(pagesize)) { pagesize = "15"; } if (string.IsNullOrEmpty(startTime)) { if (DateTime.Now.Hour >= 8 && DateTime.Now.Hour <= 23) { startTime = DateTime.Now.ToString("yyyy-MM-dd") + " 08:00:00"; endTime = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd") + " 08:00:00"; } else if (DateTime.Now.Hour >= 0 && DateTime.Now.Hour <= 7) { startTime = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd") + " 08:00:00"; endTime = DateTime.Now.ToString("yyyy-MM-dd") + " 08:00:00"; } } BarCodeRecordBLL bll = new BarCodeRecordBLL(); Response.Write(bll.SearchInfoByRepeat(page, pagesize, startTime, endTime)); Response.End(); } public bool IsReusable { get { return false; } } } }