using MESClassLibrary.BLL.Inspection; using MESWebSite.CommonClass; using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; namespace MESWebSite.HttpHandlers { /// /// CommonlyInspectionHandler 的摘要说明 /// public class CommonlyInspectionHandler : IHttpHandler { public class parmQuery { public string ID { get; set; } } 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 "AddInfo": AddInfo(); break; case "EditInfo": EditInfo(); break; case "QueryCheckList": QueryCheckList(); break; } } void QueryList() { string DeviceID = Request.Params["DeviceID"];//查询条件 string CheckDate = Request.Params["CheckDate"];//查询条件 CommonlyInspectionBLL bll = new CommonlyInspectionBLL(); Response.Write(bll.SearchInfo(DeviceID, CheckDate)); Response.End(); } void QueryCheckList() { parmQuery queryparms = new parmQuery(); queryparms.ID = Request.Params["Cid"].ToString(); string sql = @"select InspectionContentID as id from tb_CommonlyInspection t1 left join tb_CommonlyInspectionVersion t2 on t1.versionID= t2.ID where t2.ID= @ID"; DataSet ds = SQLHelper.QueryDataSet(CommandType.Text, sql, SQLHelper.ModelToParameterList(queryparms).ToArray()); string jsonStr = JSONHelper.DataTableToJSON(ds.Tables[0]); Response.Write(jsonStr); Response.End(); } void AddInfo() { string CommonlyInspection = Request.Params["CommonlyInspection"]; string CheckUserID = Request.Params["CheckUserID"]; string ConfirmUserID = Request.Params["ConfirmUserID"]; string CheckDate = Request.Params["CheckDate"]; string CheckType = Request.Params["CheckType"]; string ErrMes = Request.Params["ErrMes"]; string UserID = Request.Params["UserID"]; CommonlyInspectionBLL bll = new CommonlyInspectionBLL(); Response.Write(bll.AddInfo(CommonlyInspection, CheckUserID, ConfirmUserID, UserID, CheckDate, CheckType, ErrMes) == true ? "true" : "false"); Response.End(); } void EditInfo() { string CommonlyInspection = Request.Params["CommonlyInspection"]; string CheckUserID = Request.Params["CheckUserID"]; string ConfirmUserID = Request.Params["ConfirmUserID"]; string CheckDate = Request.Params["CheckDate"]; string CheckType = Request.Params["CheckType"]; string ErrMes = Request.Params["ErrMes"]; string UserID = Request.Params["UserID"]; CommonlyInspectionBLL bll = new CommonlyInspectionBLL(); Response.Write(bll.UpdateInfo(CommonlyInspection, CheckUserID, ConfirmUserID, UserID, CheckDate, CheckType, ErrMes) == true ? "true" : "false"); Response.End(); } public bool IsReusable { get { return false; } } } }