软测单独项目
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.
 
 
 
 
 
 

94 lines
3.3 KiB

using System.Web;
using System.Data;
using System;
using System.IO;
using System.Collections.Generic;
namespace FangYar.WebUI.Handle
{
/// <summary>
/// VISGDT 的摘要说明 根据人证机设备编号 获取部门、人员Tree
/// </summary>
public class VIShostDept : IHttpHandler
{
private FangYar.BLL.FIRE.FIRE_ORG dbll = new FangYar.BLL.FIRE.FIRE_ORG();
private FangYar.BLL.OA.TBL_EPUIP_ORG eobll = new FangYar.BLL.OA.TBL_EPUIP_ORG();
public void ProcessRequest(HttpContext context)
{
context.Response.ContentType = "text/plain";
string returnStr = "";
returnStr = ReceiveAlarmInfoPlate(context);
context.Response.Write(returnStr);
}
//硬件接口:
//根据人证机设备编号 获取Tree 本机构下-部门-员工(获取UID)
private string ReceiveAlarmInfoPlate(HttpContext context)
{
string returnstr = "";
try
{
string EpuId = context.Request.Params["deviceNumber"];
WriteLog("EpuId:"+ EpuId);
FangYar.Model.OA.TBL_EPUIP_ORG eoModel = eobll.EpuIdGetModel(EpuId);
if (eoModel.ORG_ID != null || eoModel.ORG_ID != "")
{
returnstr = "{\"code\":200,\"msg\":\"success\",\"data\":";
DataTable data = dbll.HardGetDeptListTreeByOrgId(eoModel.ORG_ID);
returnstr += FangYar.Common.JsonHelper.ToJson(data);
}
else
{
returnstr = "{\"code\":0,\"msg\":\"未查询到设备所属机构\",\"data\":[]}";
}
returnstr += "}";
}
catch
{
returnstr = "{\"code\":0,\"msg\":\"error\",\"count\":0,\"data\":[]}";
}
return returnstr;
}
/// <summary>
/// 记录日志
/// </summary>
/// <param name="msg"></param>
private void WriteLog(string msg)
{
FangYar.Common.MyLogHelper.WriteMsg(new FangYar.Common.LogInfoMo() { message = msg, msgType = FangYar.Common.EnumLogMsgTypeEnum.Error, path = "VIShostDept" });
//string path = AppDomain.CurrentDomain.BaseDirectory + "log\\VIShostDept\\";
//string filename = DateTime.Now.ToString("yyyyMMdd") + ".txt";
//if (Directory.Exists(path) == false)//如果不存在就创建文件夹
//{
// Directory.CreateDirectory(path);
//}
//FileInfo file = new FileInfo(path + filename);
//if (!file.Exists)
//{
// FileStream fs;
// fs = File.Create(path + filename);
// fs.Close();
//}
//using (FileStream fs = new FileStream(path + filename, FileMode.Append, FileAccess.Write))
//{
// using (StreamWriter sw = new StreamWriter(fs))
// {
// sw.WriteLine("时间:" + DateTime.Now.ToString() + " 信息:" + msg);
// }
//}
}
public bool IsReusable
{
get
{
return false;
}
}
}
}