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.
151 lines
4.1 KiB
151 lines
4.1 KiB
3 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>
|
||
|
/// StationHandler 的摘要说明
|
||
|
/// </summary>
|
||
|
public class StationHandler : 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 "QueryForComboboxByLineID":
|
||
|
QueryForComboboxByLineID();
|
||
|
break;
|
||
|
default:
|
||
|
break;
|
||
|
|
||
|
}
|
||
|
|
||
|
}
|
||
|
public bool IsReusable
|
||
|
{
|
||
|
get
|
||
|
{
|
||
|
return false;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
void QueryList()
|
||
|
{
|
||
|
string page = Request.Params["page"];
|
||
|
string pagesize = Request.Params["rows"];
|
||
|
string StationNo = Request.Params["StationNo"];
|
||
|
string LineID = Request.Params["LineID"];
|
||
|
|
||
|
|
||
|
if (string.IsNullOrEmpty(page))
|
||
|
{
|
||
|
page = "0";
|
||
|
}
|
||
|
if (string.IsNullOrEmpty(pagesize))
|
||
|
{
|
||
|
pagesize = "15";
|
||
|
}
|
||
|
StationBLL bll = new StationBLL();
|
||
|
Response.Write(bll.SearchInfo(page, pagesize, StationNo, LineID));
|
||
|
Response.End();
|
||
|
|
||
|
|
||
|
}
|
||
|
void SaveInfo()
|
||
|
{
|
||
|
string StationID = Request.Params["StationID"];
|
||
|
string LineID = Request.Params["LineID"];
|
||
|
string StationNo = Request.Params["StationNo"];
|
||
|
string Des = Request.Params["Des"];
|
||
|
string time = Request.Params["time"];
|
||
|
|
||
|
StationBLL bll = new StationBLL();
|
||
|
tb_Station md = new tb_Station();
|
||
|
|
||
|
md.LineID = LineID;
|
||
|
md.StationNo = StationNo;
|
||
|
md.Des = Des;
|
||
|
md.ChangeMould = Convert.ToInt32(time);
|
||
|
var info = Request.Cookies.Get("LoginUserInfo");
|
||
|
if (info != null)
|
||
|
{
|
||
|
md.UserID = info["UserID"].ToUpper();
|
||
|
}
|
||
|
if (StationID == "0")
|
||
|
{
|
||
|
//新增
|
||
|
md.StationID = Guid.NewGuid().ToString();
|
||
|
Response.Write(bll.AddInfo(md) == true ? "true" : "false");
|
||
|
}
|
||
|
else
|
||
|
{
|
||
|
//修改
|
||
|
md.StationID = StationID;
|
||
|
Response.Write(bll.UpdateInfo(md) == true ? "true" : "false");
|
||
|
}
|
||
|
Response.End();
|
||
|
}
|
||
|
void DelInfo()
|
||
|
{
|
||
|
string StationID = Request.Params["StationID"];
|
||
|
|
||
|
StationBLL bll = new StationBLL();
|
||
|
tb_Station md = new tb_Station();
|
||
|
md.StationID = StationID;
|
||
|
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()
|
||
|
{
|
||
|
string StationNo = Request.Params["StationNo"];
|
||
|
|
||
|
StationBLL bll = new StationBLL();
|
||
|
Response.Write(bll.GetComboboxData(StationNo));
|
||
|
Response.End();
|
||
|
|
||
|
}
|
||
|
|
||
|
void QueryForComboboxByLineID()
|
||
|
{
|
||
|
string LineID = "68dd1857-5e78-43f9-a065-6be76335e7fe";
|
||
|
|
||
|
StationBLL bll = new StationBLL();
|
||
|
Response.Write(bll.GetComboboxDataByLine(LineID));
|
||
|
Response.End();
|
||
|
|
||
|
}
|
||
|
}
|
||
|
}
|