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.
253 lines
10 KiB
253 lines
10 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Web;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// FireShiftsAddrHandler 的摘要说明
|
|
/// </summary>
|
|
public class FireShiftsAddrHandler : IHttpHandler
|
|
{
|
|
private FangYar.BLL.FIRE.FIRE_SHIFTSADDR bll = new FangYar.BLL.FIRE.FIRE_SHIFTSADDR();
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Other, "岗哨地点操作请求", "");
|
|
|
|
context.Response.ContentType = "text/plain";
|
|
string action = context.Request.Params["Action"];
|
|
string returnstr = "";
|
|
|
|
switch (action)
|
|
{
|
|
case "List":
|
|
returnstr = List(context);
|
|
break;
|
|
case "Add":
|
|
returnstr = Add(context);
|
|
break;
|
|
case "Edit":
|
|
returnstr = Edit(context);
|
|
break;
|
|
case "Del":
|
|
returnstr = Del(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
|
|
//查询
|
|
private string List(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
int pageIndex = 1;
|
|
int pageSize = 10;
|
|
if (!string.IsNullOrEmpty(page)) { pageIndex = int.Parse(page); }
|
|
if (!string.IsNullOrEmpty(limit)) { pageSize = int.Parse(limit); }
|
|
string where = " 1=1 ";
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
where += " and (ORG_ID ='" + OrgId + "' or ORG_ID in (select o.org_id from fire_org o where o.pid = '" + OrgId + "') )";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.FIRE.FIRE_SHIFTSADDR> list = bll.QueryList(pageIndex, pageSize, where, "");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "岗哨地点操作请求", "查询异常:" + e);
|
|
}
|
|
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Query, "岗哨地点操作请求", "查询");
|
|
return returnstr;
|
|
}
|
|
|
|
//添加岗哨地点
|
|
private string Add(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string ADDR_ID = Guid.NewGuid().ToString("N");
|
|
string ADDR_NAME = context.Request.Params["ADDR_NAME"];
|
|
string ADDR_POINT = context.Request.Params["ADDR_POINT"];
|
|
string ADDR_STATE = context.Request.Params["ADDR_STATE"];
|
|
string IFID = context.Request.Params["IFID"];
|
|
string EXTENDCODE1 = context.Request.Params["EXTENDCODE1"];
|
|
string EXTENDCODE2 = context.Request.Params["EXTENDCODE2"];
|
|
string EXTENDCODE3 = context.Request.Params["EXTENDCODE3"];
|
|
string EXTENDCODE4 = context.Request.Params["EXTENDCODE4"];
|
|
string EXTENDCODE5 = context.Request.Params["EXTENDCODE5"];
|
|
string EXTENDCODE6 = context.Request.Params["EXTENDCODE6"];
|
|
string ORG_ID = context.Request.Params["ORG_ID"];
|
|
string ORG_NAME = context.Request.Params["ORG_NAME"];
|
|
|
|
//岗哨地点
|
|
FangYar.Model.FIRE.FIRE_SHIFTSADDR model = new Model.FIRE.FIRE_SHIFTSADDR();
|
|
model.ADDR_ID = ADDR_ID;
|
|
model.ADDR_NAME = ADDR_NAME;
|
|
model.ADDR_POINT = ADDR_POINT;
|
|
model.ADDR_STATE = ADDR_STATE;
|
|
model.IFID = IFID;
|
|
model.EXTENDCODE1 = EXTENDCODE1;
|
|
model.EXTENDCODE2 = EXTENDCODE2;
|
|
model.EXTENDCODE3 = EXTENDCODE3;
|
|
model.EXTENDCODE4 = EXTENDCODE4;
|
|
model.EXTENDCODE5 = EXTENDCODE5;
|
|
model.EXTENDCODE6 = EXTENDCODE6;
|
|
model.ORG_ID = ORG_ID;
|
|
model.ORG_NAME = ORG_NAME;
|
|
|
|
if (bll.Add(model))
|
|
{
|
|
msg = "添加成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "添加失败!"; }
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "添加失败";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "岗哨地点操作请求", "添加岗哨地点异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "岗哨地点操作请求", "添加岗哨地点");
|
|
return returnstr;
|
|
}
|
|
|
|
//修改岗哨地点
|
|
private string Edit(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string ADDR_ID = context.Request.Params["ADDR_ID"];
|
|
string ADDR_NAME = context.Request.Params["ADDR_NAME"];
|
|
string ADDR_POINT = context.Request.Params["ADDR_POINT"];
|
|
string ADDR_STATE = context.Request.Params["ADDR_STATE"];
|
|
string IFID = context.Request.Params["IFID"];
|
|
string EXTENDCODE1 = context.Request.Params["EXTENDCODE1"];
|
|
string EXTENDCODE2 = context.Request.Params["EXTENDCODE2"];
|
|
string EXTENDCODE3 = context.Request.Params["EXTENDCODE3"];
|
|
string EXTENDCODE4 = context.Request.Params["EXTENDCODE4"];
|
|
string EXTENDCODE5 = context.Request.Params["EXTENDCODE5"];
|
|
string EXTENDCODE6 = context.Request.Params["EXTENDCODE6"];
|
|
string ORG_ID = context.Request.Params["ORG_ID"];
|
|
string ORG_NAME = context.Request.Params["ORG_NAME"];
|
|
|
|
//岗哨地点
|
|
FangYar.Model.FIRE.FIRE_SHIFTSADDR model = new Model.FIRE.FIRE_SHIFTSADDR();
|
|
model.ADDR_ID = ADDR_ID;
|
|
model.ADDR_NAME = ADDR_NAME;
|
|
model.ADDR_POINT = ADDR_POINT;
|
|
model.ADDR_STATE = ADDR_STATE;
|
|
model.IFID = IFID;
|
|
model.EXTENDCODE1 = EXTENDCODE1;
|
|
model.EXTENDCODE2 = EXTENDCODE2;
|
|
model.EXTENDCODE3 = EXTENDCODE3;
|
|
model.EXTENDCODE4 = EXTENDCODE4;
|
|
model.EXTENDCODE5 = EXTENDCODE5;
|
|
model.EXTENDCODE6 = EXTENDCODE6;
|
|
model.ORG_ID = ORG_ID;
|
|
model.ORG_NAME = ORG_NAME;
|
|
|
|
|
|
if (bll.Update(model))
|
|
{
|
|
msg = "修改成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "修改失败!"; }
|
|
}
|
|
|
|
catch (Exception e)
|
|
{
|
|
msg = "修改失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "岗哨地点操作请求", "添加岗哨地点异常:" + e);
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Add, "岗哨地点操作请求", "添加岗哨地点");
|
|
return returnstr;
|
|
}
|
|
|
|
//删除
|
|
private string Del(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string List = context.Request.Params["List"];
|
|
string[] Array = List.Split(',');
|
|
string ListString = "";
|
|
for (int i = 0; i < Array.Length; i++)
|
|
{
|
|
if (i == 0)
|
|
{
|
|
ListString = "'" + Array[i] + "'";
|
|
}
|
|
else
|
|
{
|
|
ListString += ",'" + Array[i] + "'";
|
|
}
|
|
}
|
|
if (bll.DeleteList(ListString))
|
|
{
|
|
msg = "删除成功!";
|
|
code = 1;
|
|
}
|
|
else
|
|
{
|
|
msg = "删除失败!";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "删除失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "岗哨地点操作请求", "删除");
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "岗哨地点操作请求", "删除");
|
|
return returnstr;
|
|
}
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|