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.
370 lines
15 KiB
370 lines
15 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Web;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Collections;
|
|
using System.Reflection;
|
|
using System.Web.Script.Serialization;
|
|
using FangYar.Model;
|
|
using FangYar.BLL;
|
|
|
|
namespace FangYar.WebUI.ashx
|
|
{
|
|
/// <summary>
|
|
/// OaLeaveHandler 的摘要说明
|
|
/// </summary>
|
|
public class FirePoolHandler : IHttpHandler
|
|
{
|
|
private FangYar.BLL.FIRE.FIRE_POOL bll = new FangYar.BLL.FIRE.FIRE_POOL();
|
|
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 "poolList":
|
|
returnstr = poolList(context);
|
|
break;
|
|
case "Add":
|
|
returnstr = AddPool(context);
|
|
break;
|
|
case "Edit":
|
|
returnstr = EditPool(context);
|
|
break;
|
|
case "Del":
|
|
returnstr = DelPool(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
|
|
//查询
|
|
private string poolList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string is_content = context.Request.Params["is_content"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string A_STATE = context.Request.Params["A_STATE"];
|
|
string type = context.Request.Params["type"];
|
|
string page = context.Request.Params["page"];
|
|
string limit = context.Request.Params["limit"];
|
|
string treeID = context.Request.Params["treeID"];
|
|
|
|
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(treeID))
|
|
{
|
|
OrgId = treeID;
|
|
}
|
|
if (!string.IsNullOrEmpty(OrgId))
|
|
{
|
|
if (is_content == "1")
|
|
{
|
|
where += " and org_id in (select org_id from fire_org, (SELECT get_Org_child_list('" + OrgId + "') cids) t where find_in_set(ORG_ID, cids))";
|
|
|
|
}
|
|
else
|
|
{
|
|
where += " and org_id = '" + OrgId + "'";
|
|
}
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += "( name like '%" + keyword + "%' or ADDR like '%" + keyword + "%')";
|
|
}
|
|
if (!string.IsNullOrEmpty(A_STATE))
|
|
{
|
|
where += "and A_STATE = '" + A_STATE + "'";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.FIRE.FIRE_POOL> list = bll.QueryList(pageIndex, pageSize, where, "NAME");
|
|
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 AddPool(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string USER_ID = context.Request.Params["USER_ID"];
|
|
string ID = Guid.NewGuid().ToString("N");
|
|
string POOL_NO = context.Request.Params["POOL_NO"];
|
|
string NAME = context.Request.Params["NAME"];
|
|
string ADDR = context.Request.Params["ADDR"];
|
|
string ALL_CAPACITY = context.Request.Params["ALL_CAPACITY"];
|
|
string N_CAPACITY = context.Request.Params["N_CAPACITY"];
|
|
string LON = context.Request.Params["LON"];
|
|
string LAT = context.Request.Params["LAT"];
|
|
string A_STATE = context.Request.Params["A_STATE"];
|
|
string SUB_ROAD = context.Request.Params["SUB_ROAD"];
|
|
string I_FORM = context.Request.Params["I_FORM"];
|
|
string I_HEIGHT = context.Request.Params["I_HEIGHT"];
|
|
string WATER_DIFF = context.Request.Params["WATER_DIFF"];
|
|
string P_SPACE = context.Request.Params["P_SPACE"];
|
|
string P_NUM = context.Request.Params["P_NUM"];
|
|
string M_FORM = context.Request.Params["M_FORM"];
|
|
string FLOW_SIZE = context.Request.Params["FLOW_SIZE"];
|
|
string SUP_UNIT = context.Request.Params["SUP_UNIT"];
|
|
string R_PHOTO = context.Request.Params["R_PHOTO"];
|
|
string P_PHOTO = context.Request.Params["P_PHOTO"];
|
|
string FOUND_DATE = context.Request.Params["FOUND_DATE"];
|
|
string I_RECORD = context.Request.Params["I_RECORD"];
|
|
string ORG_ID = context.Request.Params["ORG_ID"];
|
|
string CITY = context.Request.Params["CITY"];
|
|
string STATE = context.Request.Params["STATE"];
|
|
string COORDINATE_TYPE = context.Request.Params["COORDINATE_TYPE"];
|
|
|
|
//string A_PER = context.Request.Params["A_PER"];
|
|
//string A_TIME = context.Request.Params["A_TIME"];
|
|
//string U_TIME = context.Request.Params["U_TIME"];
|
|
|
|
//水池
|
|
FangYar.Model.FIRE.FIRE_POOL model = new Model.FIRE.FIRE_POOL();
|
|
model.ID = ID;
|
|
model.POOL_NO = POOL_NO;
|
|
model.NAME = NAME;
|
|
model.ADDR = ADDR;
|
|
model.ALL_CAPACITY = ALL_CAPACITY;
|
|
model.N_CAPACITY = N_CAPACITY;
|
|
model.LON = LON;
|
|
model.LAT = LAT;
|
|
model.A_STATE = A_STATE;
|
|
model.SUB_ROAD = SUB_ROAD;
|
|
model.I_FORM = I_FORM;
|
|
if (!string.IsNullOrEmpty(I_HEIGHT))
|
|
{
|
|
model.I_HEIGHT = Convert.ToDecimal(I_HEIGHT);
|
|
}
|
|
model.WATER_DIFF = WATER_DIFF;
|
|
model.P_SPACE = P_SPACE;
|
|
if (!string.IsNullOrEmpty(P_NUM))
|
|
{
|
|
model.P_NUM = Convert.ToDecimal(P_NUM);
|
|
}
|
|
model.M_FORM = M_FORM;
|
|
model.FLOW_SIZE = FLOW_SIZE;
|
|
model.SUP_UNIT = SUP_UNIT;
|
|
model.R_PHOTO = R_PHOTO;
|
|
model.P_PHOTO = P_PHOTO;
|
|
model.FOUND_DATE = FOUND_DATE;
|
|
model.I_RECORD = I_RECORD;
|
|
model.ORG_ID = ORG_ID;
|
|
model.CITY = CITY;
|
|
model.STATE = STATE;
|
|
model.A_PER = USER_ID;
|
|
model.A_TIME = DateTime.Now.ToString();
|
|
//model.U_PER = USER_ID;
|
|
//model.U_TIME = DateTime.Now.ToString();
|
|
model.COORDINATE_TYPE = COORDINATE_TYPE;
|
|
if (bll.Add(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 EditPool(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string USER_ID = context.Request.Params["USER_ID"];
|
|
string ID = context.Request.Params["ID"];
|
|
string POOL_NO = context.Request.Params["POOL_NO"];
|
|
string NAME = context.Request.Params["NAME"];
|
|
string ADDR = context.Request.Params["ADDR"];
|
|
string ALL_CAPACITY = context.Request.Params["ALL_CAPACITY"];
|
|
string N_CAPACITY = context.Request.Params["N_CAPACITY"];
|
|
string LON = context.Request.Params["LON"];
|
|
string LAT = context.Request.Params["LAT"];
|
|
string A_STATE = context.Request.Params["A_STATE"];
|
|
string SUB_ROAD = context.Request.Params["SUB_ROAD"];
|
|
string I_FORM = context.Request.Params["I_FORM"];
|
|
string I_HEIGHT = context.Request.Params["I_HEIGHT"];
|
|
string WATER_DIFF = context.Request.Params["WATER_DIFF"];
|
|
string P_SPACE = context.Request.Params["P_SPACE"];
|
|
string P_NUM = context.Request.Params["P_NUM"];
|
|
string M_FORM = context.Request.Params["M_FORM"];
|
|
string FLOW_SIZE = context.Request.Params["FLOW_SIZE"];
|
|
string SUP_UNIT = context.Request.Params["SUP_UNIT"];
|
|
string R_PHOTO = context.Request.Params["R_PHOTO"];
|
|
string P_PHOTO = context.Request.Params["P_PHOTO"];
|
|
string FOUND_DATE = context.Request.Params["FOUND_DATE"];
|
|
string I_RECORD = context.Request.Params["I_RECORD"];
|
|
string ORG_ID = context.Request.Params["ORG_ID"];
|
|
string CITY = context.Request.Params["CITY"];
|
|
string STATE = context.Request.Params["STATE"];
|
|
string COORDINATE_TYPE = context.Request.Params["COORDINATE_TYPE"];
|
|
//string A_TIME = context.Request.Params["A_TIME"];
|
|
//string U_TIME = context.Request.Params["U_TIME"];
|
|
|
|
//水池
|
|
FangYar.Model.FIRE.FIRE_POOL model = new Model.FIRE.FIRE_POOL();
|
|
model.ID = ID;
|
|
model.POOL_NO = POOL_NO;
|
|
model.NAME = NAME;
|
|
model.ADDR = ADDR;
|
|
model.ALL_CAPACITY = ALL_CAPACITY;
|
|
model.N_CAPACITY = N_CAPACITY;
|
|
model.LON = LON;
|
|
model.LAT = LAT;
|
|
model.A_STATE = A_STATE;
|
|
model.SUB_ROAD = SUB_ROAD;
|
|
model.I_FORM = I_FORM;
|
|
if (!string.IsNullOrEmpty(I_HEIGHT))
|
|
{
|
|
model.I_HEIGHT = Convert.ToDecimal(I_HEIGHT);
|
|
}
|
|
model.WATER_DIFF = WATER_DIFF;
|
|
model.P_SPACE = P_SPACE;
|
|
if (!string.IsNullOrEmpty(P_NUM))
|
|
{
|
|
model.P_NUM = Convert.ToDecimal(P_NUM);
|
|
}
|
|
model.M_FORM = M_FORM;
|
|
model.FLOW_SIZE = FLOW_SIZE;
|
|
model.SUP_UNIT = SUP_UNIT;
|
|
model.R_PHOTO = R_PHOTO;
|
|
model.P_PHOTO = P_PHOTO;
|
|
model.FOUND_DATE = FOUND_DATE;
|
|
model.I_RECORD = I_RECORD;
|
|
model.ORG_ID = ORG_ID;
|
|
model.CITY = CITY;
|
|
model.STATE = STATE;
|
|
//model.A_PER = USER_ID;
|
|
//model.A_TIME = A_TIME;
|
|
model.U_PER = USER_ID;
|
|
model.COORDINATE_TYPE = COORDINATE_TYPE;
|
|
model.U_TIME = DateTime.Now.ToString();
|
|
|
|
|
|
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.Update, "消防水池操作请求", "修改消防装备");
|
|
return returnstr;
|
|
}
|
|
|
|
//删除
|
|
private string DelPool(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string PoolList = context.Request.Params["poolList"];
|
|
string[] PoolArray = PoolList.Split(',');
|
|
string PoolListString = "";
|
|
for (int i = 0; i < PoolArray.Length; i++)
|
|
{
|
|
if (i == 0)
|
|
{
|
|
PoolListString = "'" + PoolArray[i] + "'";
|
|
}
|
|
else
|
|
{
|
|
PoolListString += ",'" + PoolArray[i] + "'";
|
|
}
|
|
}
|
|
if (bll.DeleteList(PoolListString))
|
|
{
|
|
msg = "删除成功!";
|
|
code = 1;
|
|
}
|
|
else
|
|
{
|
|
msg = "删除失败!";
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
msg = "删除失败!";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "消防水池操作请求", "删除异常:" + e);
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
|
|
// 记录操作日志
|
|
BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Delete, "消防水池操作请求", "删除");
|
|
return returnstr;
|
|
}
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|