<%@ WebHandler Language="C#" Class="getAllMobile" %> using System; using System.Web; using System.Data; using System.Collections; public class getAllMobile : IHttpHandler { DbOperate dbo = null; public void ProcessRequest (HttpContext context) { if (context.Request.QueryString["menuid"] == null | context.Request.QueryString["menuid"].ToString() == "") { context.Response.End(); return; } string menuid = context.Request.QueryString["menuid"].ToString(); dbo = new DbOperate(); ArrayList result = new ArrayList(); if (menuid == "0") { result = getBMData(); } else { result = getRYData(menuid); } string nt = Newtonsoft.Json.JsonConvert.SerializeObject(result); context.Response.Write(nt); } private ArrayList getBMData() { ArrayList result = new ArrayList(); string sql = "select distinct(keshi_id), KeShiMing,xuhao from com_ksb where PCID is not null and IsEnabled =1 and zzdm='subdept' order by xuhao "; DataTable dt = dbo.ExecuteDataTable(sql); foreach (DataRow dr in dt.Rows) { Hashtable ht = new Hashtable(); ht.Add("keshiming", dr[1].ToString()); ht.Add("keshi_id", dr[0].ToString()); result.Add(ht); } return result; } private ArrayList getRYData(string menuid) { ArrayList result = new ArrayList(); string sqlWhere = " and 1 = 1 "; if (menuid == "10071") { sqlWhere = " and xingming <> '张嘉' "; } string sql = "select phone,xingming from com_yhb_zz a,com_yhb b where KeShi_ID = '" + menuid + "' and a.RenYuan_ID = b.ID and isrsyh<>0 and mrzz=1 and IsExpired=0 " + sqlWhere + " order by ganglevel desc,b.xh"; DataTable dt1 = dbo.ExecuteDataTable(sql); ArrayList list = new ArrayList(); foreach (DataRow dr1 in dt1.Rows) { string[] temp = { "", "" }; temp[0] = dr1[0].ToString(); temp[1] = dr1[1].ToString(); result.Add(temp); } return result; } public bool IsReusable { get { return false; } } }