using System; using System.Collections.Generic; using System.Text; using System.Web; using TP.BizCom; namespace TP.WebCore.Handler { public class GetAjaxData : BaseHandler, IHttpHandler { public void ProcessRequest(HttpContext context) { context.Response.ContentType = "application/jason"; string msg = ""; if (CurrentUser == null) { ReturnLoginMsg("请先登录!"); return; } if (UrlParmsCheck("pType")) { string pType = GetString("pType").ToLower(); try { switch (pType) { case "hotarea": { if (UrlParmsCheck("code")) { string code=GetString("code"); IList list = WebCache.GetHotArea(code); if (list.Count > 0) { StringBuilder str = new StringBuilder(); foreach (DicItem item in list) { str.Append("{"); str.AppendFormat("\"ID\":\"{0}\",\"Code\":\"{1}\",\"Name\":\"{2}\"", item.ID, item.Code, item.Name); str.Append("},"); } returnSuccess("[" + str.ToString().TrimEnd(',') + "]"); return; } returnSuccess("[]"); } break; } } if (successFlag) return; } catch (Exception ex) { SyLog.WriteLog(ex); } } returnErrorMsg(msg); } } }