| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- <%@ WebHandler Language="C#" Class="getFunction" %>
- using System;
- using System.Web;
- using System.Web.SessionState;
- using System.Data;
- using System.Text;
- using System.Collections;
- using System.Collections.Generic;
- using Newtonsoft.Json;
- using Newtonsoft.Json.Linq;
- using Curtain.DataAccess;
- using DK.XuWei.WebMes;
- public class getFunction : IHttpHandler, IReadOnlySessionState
- {
- public void ProcessRequest(HttpContext context)
- {
- context.Response.ContentType = "text/plain";
- using(IDataAccess conn = DataAccess.Create())
- {
- DataTable dt = conn.ExecuteDatatable(@"
- SELECT
- FUNCTIONCODE AS id,
- FUNCTIONLEVEL AS code,
- FUNCTIONNAME AS text,
- URL AS url
- FROM
- TP_SYS_FUNCTION
- WHERE
- IS_WEB = '1'
- ORDER BY
- FUNCTIONLEVEL,
- FUNCTIONCODE
- ");
- string rootId = dt.Rows[0]["id"].ToString();
- string rootCode = dt.Rows[0]["code"].ToString();
- string rootText = dt.Rows[0]["text"].ToString();
- string children = Easyui.TableToEasyUITree(dt, rootCode);
- string jsonStr = "[{\"id\":\"" + rootId + "\",\"text\":\"" + rootText + "\"" + children + "}]";
- context.Response.Write(jsonStr);
- }
- }
- public bool IsReusable
- {
- get
- {
- return false;
- }
- }
- }
|