注塑喷涂
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

158 lines
4.8 KiB

using MESClassLibrary.BLL.Injection;
using MESClassLibrary.EFModel;
using MESClassLibrary.Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Script.Serialization;
namespace MESWebSite.HttpHandlers
{
/// <summary>
/// InjectionDownRecordHandler 的摘要说明
/// </summary>
public class InjectionDownRecordHandler : 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 "QueryForComboboxByDownType":
QueryForComboboxByDownType();
break;
case "QueryForComboboxByDownReason":
QueryForComboboxByDownReason();
break;
case "updateRecord":
updateRecord();
break;
default:
break;
}
}
public bool IsReusable
{
get
{
return false;
}
}
void QueryList()
{
string page = Request.Params["page"];
string pagesize = Request.Params["rows"];
string StartTime = Request.Params["StartTime"];
string EndTime = Request.Params["EndTime"];
string stationID = Request.Params["StationID"];
if (string.IsNullOrEmpty(page))
{
page = "0";
}
if (string.IsNullOrEmpty(pagesize))
{
pagesize = "15";
}
InjectionDownRecordBLL bll = new InjectionDownRecordBLL();
Response.Write(bll.SearchInfoAll(page, pagesize, StartTime, EndTime, stationID));
Response.End();
}
void SaveInfo()
{
string ID = Request.Params["ID"];
string StationID = Request.Params["StationID"];
string StartTime = Request.Params["StartTime"];
string EndTime = Request.Params["EndTime"];
string DownType = Request.Params["DownType"];
string DownReason = Request.Params["DownReason"];
string Des = Request.Params["Des"];
string Remark1 = Request.Params["Remark1"];
InjectionDownRecordBLL bll = new InjectionDownRecordBLL();
tb_Injection_DownRecord md = new tb_Injection_DownRecord();
md.StationID = StationID;
md.StartTime = Convert.ToDateTime(StartTime);
md.EndTime = Convert.ToDateTime(EndTime);
md.DownType = DownType;
md.DownReason = DownReason;
md.Des = Des;
md.Remark1 = Remark1;
md.ID = ID;
//修改
Response.Write(bll.UpdateInfo(md) == true ? "true" : "false");
Response.End();
}
void DelInfo()
{
string ID = Request.Params["ID"];
InjectionDownRecordBLL bll = new InjectionDownRecordBLL();
//tb_Injection_Record md = new tb_Injection_Record();
//md.ID = ID;
//Response.Write(bll.DeleteInfo(md) == true ? "true" : "false");
Response.End();
}
void QueryForComboboxByDownType()
{
InjectionDownRecordBLL bll = new InjectionDownRecordBLL();
Response.Write(bll.GetComboboxDataByDownType());
Response.End();
}
void QueryForComboboxByDownReason()
{
InjectionDownRecordBLL bll = new InjectionDownRecordBLL();
Response.Write(bll.GetComboboxDataByDownReason());
Response.End();
}
void updateRecord()
{
string jsonData = Request.Params["datalistBill"];
string DownRecordID = Request.Params["DownRecordID"];
JavaScriptSerializer js = new JavaScriptSerializer(); //实例化一个能够序列化数据的类
List<DownRecordVO> dataList = js.Deserialize<List<DownRecordVO>>(jsonData); //将json数据转化为对象类型并赋值给list
InjectionDownRecordBLL bll = new InjectionDownRecordBLL();
Response.Write(bll.UpdateData(dataList, DownRecordID));
Response.End();
}
}
}