一厂MES,含注塑,喷涂,冲孔
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.

153 lines
4.2 KiB

2 months ago
using MESClassLibrary.BLL.BasicInfo;
using MESClassLibrary.EFModel;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace MESWebSite.HttpHandlers
{
/// <summary>
/// CheckItemHandler 的摘要说明
/// </summary>
public class CheckItemHandler : 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 "QueryForCombobox":
QueryForCombobox();
break;
case "QueryContentList":
QueryContentList();
break;
default:
break;
}
}
public bool IsReusable
{
get
{
return false;
}
}
void QueryList()
{
string page = Request.Params["page"];
string pagesize = Request.Params["rows"];
string CheckContent = Request.Params["CheckContent"];
string DeviceID = Request.Params["DeviceID"];
if (string.IsNullOrEmpty(page))
{
page = "0";
}
if (string.IsNullOrEmpty(pagesize))
{
pagesize = "15";
}
CheckItemBLL bll = new CheckItemBLL();
Response.Write(bll.SearchInfo(page, pagesize, CheckContent, DeviceID));
Response.End();
}
void SaveInfo()
{
string ID = Request.Params["ID"];
string DeviceID = Request.Params["DeviceID"];
string CheckContent = Request.Params["CheckContent"];
string Standard = Request.Params["Standard"];
string Way = Request.Params["Way"];
string Cycle = Request.Params["Cycle"];
string CheckVersion = Request.Params["CheckVersion"];
CheckItemBLL bll = new CheckItemBLL();
tb_CheckItem md = new tb_CheckItem();
md.DeviceID = DeviceID;
md.CheckContent = CheckContent;
md.Standard = Standard;
md.Way = Way;
md.Cycle = Cycle;
md.CheckVersion = CheckVersion;
var info = Request.Cookies.Get("LoginUserInfo");
if (info != null)
{
md.UserID = info["UserID"].ToUpper();
}
if (ID == "0")
{
//新增
md.ID = Guid.NewGuid().ToString();
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"];
CheckItemBLL bll = new CheckItemBLL();
tb_CheckItem md = new tb_CheckItem();
md.ID = ID;
var info = Request.Cookies.Get("LoginUserInfo");
if (info != null)
{
md.UserID = info["UserID"].ToUpper();
}
Response.Write(bll.DelInfo(md) == true ? "true" : "false");
Response.End();
}
void QueryForCombobox()
{
CheckItemBLL bll = new CheckItemBLL();
Response.Write(bll.GetComboboxData());
Response.End();
}
void QueryContentList()
{
string deviceID = Request.Params["DeviceID"];
CheckItemBLL bll = new CheckItemBLL();
Response.Write(bll.GetTreeData(deviceID));
Response.End();
}
}
}