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.
307 lines
11 KiB
307 lines
11 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 FireWatSouHandler : IHttpHandler
|
|
{
|
|
private FangYar.BLL.FIRE.FIRE_WATER_SOURCE bll = new FangYar.BLL.FIRE.FIRE_WATER_SOURCE();
|
|
public void ProcessRequest(HttpContext context)
|
|
{
|
|
context.Response.ContentType = "text/plain";
|
|
string action = context.Request.Params["Action"];
|
|
string returnstr = "";
|
|
|
|
switch (action)
|
|
{
|
|
case "WatSouList":
|
|
returnstr = GetWatSouList(context);
|
|
break;
|
|
case "Add":
|
|
returnstr = AddWatSou(context);
|
|
break;
|
|
case "Edit":
|
|
returnstr = EditWatSou(context);
|
|
break;
|
|
case "Del":
|
|
returnstr = DelWatSou(context);
|
|
break;
|
|
}
|
|
context.Response.Write(returnstr);
|
|
}
|
|
|
|
|
|
//查询
|
|
private string GetWatSouList(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
try
|
|
{
|
|
string OrgId = context.Request.Params["OrgId"];
|
|
string keyword = context.Request.Params["keywords"];
|
|
string STATE = context.Request.Params["STATE"];
|
|
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 in (select org_id from fire_org, (SELECT get_Org_child_list('" + OrgId + "') cids) t where find_in_set(ORG_ID, cids))";
|
|
}
|
|
if (!string.IsNullOrEmpty(STATE))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += " STATE = '" + STATE + "' ";
|
|
}
|
|
if (!string.IsNullOrEmpty(keyword))
|
|
{
|
|
if (where != null)
|
|
{
|
|
where += " and ";
|
|
}
|
|
where += "( name like '%" + keyword + "%' or ADDR like '%" + keyword + "%')";
|
|
}
|
|
returnstr = "{\"code\":0,\"msg\":\"\",";
|
|
int count = bll.GetRecordCount(where);
|
|
returnstr += "\"count\":" + count + ",\"data\":";
|
|
if (count == 0)
|
|
{
|
|
returnstr += "[]";
|
|
}
|
|
else
|
|
{
|
|
List<FangYar.Model.FIRE.FIRE_WATER_SOURCE> list = bll.QueryList(pageIndex, pageSize, where, "");
|
|
returnstr += FangYar.Common.JsonHelper.ToJson(list);
|
|
}
|
|
returnstr += "}";
|
|
}
|
|
catch
|
|
{
|
|
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]";
|
|
}
|
|
return returnstr;
|
|
}
|
|
|
|
|
|
//添加消防装备
|
|
private string AddWatSou(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 SOU_NO = context.Request.Params["SOU_NO"];
|
|
string NAME = context.Request.Params["NAME"];
|
|
string SOU_TYPE = context.Request.Params["SOU_TYPE"];
|
|
string SOU_FORM = context.Request.Params["SOU_FORM"];
|
|
string ADDR = context.Request.Params["ADDR"];
|
|
string LON = context.Request.Params["LON"];
|
|
string LAT = context.Request.Params["LAT"];
|
|
string A_STATE = context.Request.Params["A_STATE"];
|
|
string CAPACITY = context.Request.Params["CAPACITY"];
|
|
string AREA = context.Request.Params["AREA"];
|
|
string QUALITY = context.Request.Params["QUALITY"];
|
|
string SEA_CHANGE = context.Request.Params["SEA_CHANGE"];
|
|
string IS_L_W = context.Request.Params["IS_L_W"];
|
|
string L_W_SPAN = context.Request.Params["L_W_SPAN"];
|
|
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 ORG_ID = context.Request.Params["ORG_ID"];
|
|
string CITY = context.Request.Params["CITY"];
|
|
string STATE = context.Request.Params["STATE"];
|
|
|
|
//天然水源表
|
|
FangYar.Model.FIRE.FIRE_WATER_SOURCE model = new Model.FIRE.FIRE_WATER_SOURCE();
|
|
model.ID = ID;
|
|
model.SOU_NO = SOU_NO;
|
|
model.NAME = NAME;
|
|
model.SOU_TYPE = SOU_TYPE;
|
|
model.SOU_FORM = SOU_FORM;
|
|
model.ADDR = ADDR;
|
|
model.LON = LON;
|
|
model.LAT = LAT;
|
|
model.A_STATE = A_STATE;
|
|
if (!string.IsNullOrEmpty(CAPACITY))
|
|
{
|
|
model.CAPACITY = int.Parse(CAPACITY);
|
|
}
|
|
if (!string.IsNullOrEmpty(AREA))
|
|
{
|
|
model.AREA = int.Parse(AREA);
|
|
}
|
|
model.QUALITY = QUALITY;
|
|
model.SEA_CHANGE = SEA_CHANGE;
|
|
model.IS_L_W = IS_L_W;
|
|
model.L_W_SPAN = L_W_SPAN;
|
|
model.R_PHOTO = R_PHOTO;
|
|
model.P_PHOTO = P_PHOTO;
|
|
model.FOUND_DATE = FOUND_DATE;
|
|
model.ORG_ID = ORG_ID;
|
|
model.CITY = CITY;
|
|
model.STATE = STATE;
|
|
model.A_PER = USER_ID;
|
|
|
|
if (bll.Add(model))
|
|
{
|
|
msg = "添加成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "添加失败!"; }
|
|
}
|
|
catch
|
|
{
|
|
msg = "添加失败";
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
return returnstr;
|
|
}
|
|
|
|
//修改消防装备
|
|
private string EditWatSou(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 SOU_NO = context.Request.Params["SOU_NO"];
|
|
string NAME = context.Request.Params["NAME"];
|
|
string SOU_TYPE = context.Request.Params["SOU_TYPE"];
|
|
string SOU_FORM = context.Request.Params["SOU_FORM"];
|
|
string ADDR = context.Request.Params["ADDR"];
|
|
string LON = context.Request.Params["LON"];
|
|
string LAT = context.Request.Params["LAT"];
|
|
string A_STATE = context.Request.Params["A_STATE"];
|
|
string CAPACITY = context.Request.Params["CAPACITY"];
|
|
string AREA = context.Request.Params["AREA"];
|
|
string QUALITY = context.Request.Params["QUALITY"];
|
|
string SEA_CHANGE = context.Request.Params["SEA_CHANGE"];
|
|
string IS_L_W = context.Request.Params["IS_L_W"];
|
|
string L_W_SPAN = context.Request.Params["L_W_SPAN"];
|
|
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 ORG_ID = context.Request.Params["ORG_ID"];
|
|
string CITY = context.Request.Params["CITY"];
|
|
string STATE = context.Request.Params["STATE"];
|
|
|
|
//天然水源表
|
|
FangYar.Model.FIRE.FIRE_WATER_SOURCE model = new Model.FIRE.FIRE_WATER_SOURCE();
|
|
model.ID = ID;
|
|
model.SOU_NO = SOU_NO;
|
|
model.NAME = NAME;
|
|
model.SOU_TYPE = SOU_TYPE;
|
|
model.SOU_FORM = SOU_FORM;
|
|
model.ADDR = ADDR;
|
|
model.LON = LON;
|
|
model.LAT = LAT;
|
|
model.A_STATE = A_STATE;
|
|
if (!string.IsNullOrEmpty(CAPACITY))
|
|
{
|
|
model.CAPACITY = int.Parse(CAPACITY);
|
|
}
|
|
if (!string.IsNullOrEmpty(AREA))
|
|
{
|
|
model.AREA = int.Parse(AREA);
|
|
}
|
|
model.QUALITY = QUALITY;
|
|
model.SEA_CHANGE = SEA_CHANGE;
|
|
model.IS_L_W = IS_L_W;
|
|
model.L_W_SPAN = L_W_SPAN;
|
|
model.R_PHOTO = R_PHOTO;
|
|
model.P_PHOTO = P_PHOTO;
|
|
model.FOUND_DATE = FOUND_DATE;
|
|
model.ORG_ID = ORG_ID;
|
|
model.CITY = CITY;
|
|
model.STATE = STATE;
|
|
model.U_PER = USER_ID;
|
|
|
|
if (bll.Update(model))
|
|
{
|
|
msg = "修改成功!";
|
|
code = 1;
|
|
}
|
|
else { msg = "修改失败!"; }
|
|
}
|
|
catch
|
|
{
|
|
msg = "修改失败!";
|
|
}
|
|
returnstr = "{\"msg\":\"" + msg + "\",\"code\":" + code + "}";
|
|
return returnstr;
|
|
}
|
|
|
|
//删除消防装备
|
|
private string DelWatSou(HttpContext context)
|
|
{
|
|
string returnstr = "";
|
|
int code = -1;
|
|
string msg = "";
|
|
try
|
|
{
|
|
string WatSouList = context.Request.Params["WatSouList"];
|
|
string[] WatSouArray = WatSouList.Split(',');
|
|
string WatSouListString = "";
|
|
for (int i = 0; i < WatSouArray.Length; i++)
|
|
{
|
|
if (i == 0)
|
|
{
|
|
WatSouListString = "'" + WatSouArray[i] + "'";
|
|
}
|
|
else
|
|
{
|
|
WatSouListString += ",'" + WatSouArray[i] + "'";
|
|
}
|
|
}
|
|
if (bll.DeleteList(WatSouListString))
|
|
{
|
|
msg = "删除成功!";
|
|
code = 1;
|
|
}
|
|
else
|
|
{
|
|
msg = "删除失败!";
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
msg = "删除失败!";
|
|
}
|
|
returnstr = "{\"code\":" + code + ",\"msg\":\"" + msg + "\"}";
|
|
return returnstr;
|
|
}
|
|
|
|
public bool IsReusable
|
|
{
|
|
get
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
}
|
|
}
|