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 { /// /// OaLeaveHandler 的摘要说明 /// public class FireShiftsBasicHandler : IHttpHandler { 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 "getListByOrgId": returnstr = getListByOrgId(context); break; } context.Response.Write(returnstr); } //根据机构ID查询交接班配置表 private string getListByOrgId(HttpContext context) { string returnstr = ""; try { string findOrgId = context.Request.Params["orgId"]; if (string.IsNullOrEmpty(findOrgId)) { return "{\"code\":\"-1\",\"msg\":\"请求异常,请联系平台管理员。\",\"error\":\"orgId参数不能为空!\",\"data\":[]}"; } string sql = @"SELECT * FROM fire_shifts_basic where org_id = '" + findOrgId + "' order by sort "; DataTable dt = FangYar.Common.MySqlHelper.QueryTable(sql); returnstr = "{\"code\":\"200\",\"msg\":\"操作成功!\",\"data\":"; returnstr += FangYar.Common.JsonHelper.ToJson(dt); returnstr += "}"; } catch (Exception e) { returnstr = "{\"code\":\"-1\",\"msg\":\"请求异常,请联系平台管理员!\",\"error\":\"" + e.Message + "\",\"data\":[]}"; // 记录操作日志 BLL.SysOperationLogHelp.AddSysOperationLog(context, Common.EnumOperationLogType.Error, "交接班配置操作请求", "根据机构ID查询交接班配置表异常:" + e); } return returnstr; } public bool IsReusable { get { return false; } } } }