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.
118 lines
3.0 KiB
118 lines
3.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using MESClassLibrary.BLL.BasicInfo;
|
|
using MESClassLibrary.EFModel;
|
|
|
|
namespace MESWebSite.HttpHandlers
|
|
{
|
|
/// <summary>
|
|
/// LocationHandler 的摘要说明
|
|
/// </summary>
|
|
public class LocationHandler : 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;
|
|
default:
|
|
break;
|
|
|
|
}
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
|
|
void QueryList()
|
|
{
|
|
string page = Request.Params["page"];
|
|
string pagesize = Request.Params["rows"];
|
|
string Location = Request.Params["Location"];
|
|
|
|
|
|
if (string.IsNullOrEmpty(page))
|
|
{
|
|
page = "0";
|
|
}
|
|
if (string.IsNullOrEmpty(pagesize))
|
|
{
|
|
pagesize = "15";
|
|
}
|
|
LocationBLL bll = new LocationBLL();
|
|
Response.Write(bll.SearchInfo(page, pagesize, Location));
|
|
Response.End();
|
|
}
|
|
|
|
void SaveInfo()
|
|
{
|
|
string ID = Request.Params["ID"];
|
|
string Location = Request.Params["Location"];
|
|
|
|
LocationBLL bll = new LocationBLL();
|
|
tb_Location md = new tb_Location();
|
|
|
|
md.Location = Location;
|
|
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"];
|
|
|
|
LocationBLL bll = new LocationBLL();
|
|
tb_Location md = new tb_Location();
|
|
md.ID = ID;
|
|
Response.Write(bll.DelInfo(md) == true ? "true" : "false");
|
|
Response.End();
|
|
|
|
}
|
|
|
|
void QueryForCombobox()
|
|
{
|
|
LocationBLL bll = new LocationBLL();
|
|
Response.Write(bll.GetComboboxData());
|
|
Response.End();
|
|
|
|
}
|
|
}
|
|
}
|