using System; using System.Collections.Generic; using System.Data; using System.Linq; using System.Web; namespace FangYar.WebUI.ashx { /// /// FireHandoverEquipHandler 的摘要说明 /// public class FireHandoverEquipHandler : IHttpHandler { private FangYar.BLL.FIRE.FIRE_HANDOVER_EQUIP bll = new FangYar.BLL.FIRE.FIRE_HANDOVER_EQUIP(); //FangYar.BLL.TBL_CARACCESS cabll = new BLL.TBL_CARACCESS(); public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string action = context.Request.Params["Action"]; string returnstr = ""; switch (action) { case "View": returnstr = View(context); break; } context.Response.Write(returnstr); } private string View(HttpContext context) { string returnstr = ""; string msg = ""; try { returnstr = "{\"code\":0,\"msg\":\"\","; string CarNum = context.Request.Params["CarNum"];//车辆id DataTable dt = new DataTable(); dt = bll.GetHandoverInfo(CarNum).Tables[0]; if (dt != null) { int count = dt.Rows.Count; returnstr += "\"count\":" + count + ",\"data\":"; if (count == 0) { returnstr += "[]"; } else { returnstr += FangYar.Common.JsonHelper.ToJson(dt); } } else { msg = "查看失败!"; } } catch { msg = "添加失败!"; } returnstr += "}"; //returnstr = "{\"msg\":\"" + msg + "\",\"data\":" + data + "}"; return returnstr; } public bool IsReusable { get { return false; } } } }