コード例 #1
0
        public string Tree1()
        {
            string msg;

            if (!Tools.CheckLogin(out msg) && !RoadFlow.Platform.WeiXin.Organize.CheckLogin())
            {
                return("");
            }
            RoadFlow.Platform.Dictionary dictionary1 = new RoadFlow.Platform.Dictionary();
            string str  = this.Request.QueryString["root"];
            int    num1 = "1" == this.Request.QueryString["ischild"] ? 1 : 0;
            Guid   test = Guid.Empty;

            if (!str.IsNullOrEmpty() && !str.IsGuid(out test))
            {
                RoadFlow.Data.Model.Dictionary byCode = dictionary1.GetByCode(str, false);
                if (byCode != null)
                {
                    test = byCode.ID;
                }
            }
            RoadFlow.Data.Model.Dictionary dictionary2 = test != Guid.Empty ? dictionary1.Get(test, false) : dictionary1.GetRoot();
            bool          flag          = dictionary1.HasChilds(dictionary2.ID);
            StringBuilder stringBuilder = new StringBuilder("[", 1000);

            stringBuilder.Append("{");
            stringBuilder.AppendFormat("\"id\":\"{0}\",", (object)dictionary2.ID);
            stringBuilder.AppendFormat("\"parentID\":\"{0}\",", (object)dictionary2.ParentID);
            stringBuilder.AppendFormat("\"title\":\"{0}\",", (object)dictionary2.Title);
            stringBuilder.AppendFormat("\"type\":\"{0}\",", flag ? (object)"0" : (object)"2");
            stringBuilder.AppendFormat("\"ico\":\"{0}\",", (object)this.Url.Content("~/images/ico/role.gif"));
            stringBuilder.AppendFormat("\"hasChilds\":\"{0}\",", flag ? (object)"1" : (object)"0");
            stringBuilder.Append("\"childs\":[");
            List <RoadFlow.Data.Model.Dictionary> childs = dictionary1.GetChilds(dictionary2.ID, false);
            int num2  = 0;
            int count = childs.Count;

            foreach (RoadFlow.Data.Model.Dictionary dictionary3 in childs)
            {
                stringBuilder.Append("{");
                stringBuilder.AppendFormat("\"id\":\"{0}\",", (object)dictionary3.ID);
                stringBuilder.AppendFormat("\"parentID\":\"{0}\",", (object)dictionary3.ParentID);
                stringBuilder.AppendFormat("\"title\":\"{0}\",", (object)dictionary3.Title);
                stringBuilder.AppendFormat("\"ico\":\"{0}\",", (object)"");
                stringBuilder.AppendFormat("\"hasChilds\":\"{0}\",", dictionary1.HasChilds(dictionary3.ID) ? (object)"1" : (object)"0");
                stringBuilder.Append("\"childs\":[");
                stringBuilder.Append("]");
                stringBuilder.Append("}");
                if (num2++ < count - 1)
                {
                    stringBuilder.Append(",");
                }
            }
            stringBuilder.Append("]");
            stringBuilder.Append("}");
            stringBuilder.Append("]");
            return(stringBuilder.ToString());
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string id = Request.QueryString["id"];

            this.Code.Attributes.Add("validate_url", "CheckCode.ashx?id=" + id);
            if (id.IsGuid())
            {
                dict = bdict.Get(id.ToGuid());
            }
            if (dict == null)
            {
                dict = bdict.GetRoot();
            }
            if (IsPostBack && dict != null)
            {
                string refreshID = dict.ParentID == Guid.Empty ? dict.ID.ToString() : dict.ParentID.ToString();
                //删除
                if (!Request.Form["Delete"].IsNullOrEmpty())
                {
                    int i = bdict.DeleteAndAllChilds(dict.ID);
                    bdict.RefreshCache();
                    RoadFlow.Platform.Log.Add("删除了数据字典及其下级共" + i.ToString() + "项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典);
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('删除成功!');parent.frames[0].reLoad('" + refreshID + "');window.location='Body.aspx?id=" + dict.ParentID.ToString() + "&appid=" + Request.QueryString["appid"] + "';", true);
                }
                //保存
                if (!Request.Form["Save"].IsNullOrEmpty())
                {
                    string title  = Request.Form["Title1"];
                    string code   = Request.Form["Code"];
                    string values = Request.Form["Values"];
                    string note   = Request.Form["Note"];
                    string other  = Request.Form["Other"];
                    string oldXML = dict.Serialize();

                    dict.Code  = code.IsNullOrEmpty() ? null : code.Trim();
                    dict.Note  = note.IsNullOrEmpty() ? null : note.Trim();
                    dict.Other = other.IsNullOrEmpty() ? null : other.Trim();
                    dict.Title = title.Trim();
                    dict.Value = values.IsNullOrEmpty() ? null : values.Trim();

                    bdict.Update(dict);
                    bdict.RefreshCache();
                    RoadFlow.Platform.Log.Add("修改了数据字典项", "", RoadFlow.Platform.Log.Types.数据字典, oldXML, dict.Serialize());
                    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!');parent.frames[0].reLoad('" + refreshID + "');", true);
                }
            }
            if (dict != null)
            {
                this.Title1.Value = dict.Title;
                this.Code.Value   = dict.Code;
                this.Values.Value = dict.Value;
                this.Note.Value   = dict.Note;
                this.Other.Value  = dict.Other;
            }
        }
コード例 #3
0
        public ActionResult Sort(FormCollection collection)
        {
            RoadFlow.Platform.Dictionary dictionary1 = new RoadFlow.Platform.Dictionary();
            string str1 = this.Request.QueryString["id"];
            string str2 = "";
            List <RoadFlow.Data.Model.Dictionary> dictionaryList = new List <RoadFlow.Data.Model.Dictionary>();
            Guid test1;

            if (str1.IsGuid(out test1))
            {
                RoadFlow.Data.Model.Dictionary dictionary2 = dictionary1.Get(test1, false);
                if (dictionary2 != null)
                {
                    dictionaryList = dictionary1.GetChilds(dictionary2.ParentID, false);
                    str2           = dictionary2.ParentID.ToString();
                }
            }
            if (collection != null)
            {
                string str3 = this.Request.Form["sort"];
                if (str3.IsNullOrEmpty())
                {
                    return((ActionResult)this.View((object)dictionaryList));
                }
                string[] strArray = str3.Split(',');
                int      num      = 1;
                foreach (string str4 in strArray)
                {
                    Guid test2;
                    if (str4.IsGuid(out test2))
                    {
                        dictionary1.UpdateSort(test2, num++);
                    }
                }
                dictionary1.RefreshCache();
                RoadFlow.Platform.Log.Add("保存了数据字典排序", "保存了ID为:" + str1 + "的同级排序", RoadFlow.Platform.Log.Types.数据字典, "", "", (RoadFlow.Data.Model.Users)null);
                // ISSUE: reference to a compiler-generated field
                if (DictController.\u003C\u003Eo__11.\u003C\u003Ep__0 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    DictController.\u003C\u003Eo__11.\u003C\u003Ep__0 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "Script", typeof(DictController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                    {
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                    }));
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                object obj = DictController.\u003C\u003Eo__11.\u003C\u003Ep__0.Target((CallSite)DictController.\u003C\u003Eo__11.\u003C\u003Ep__0, this.ViewBag, "parent.frames[0].reLoad('" + str2 + "');");
                dictionaryList = dictionary1.GetChilds(str2.ToGuid(), false);
            }
            return((ActionResult)this.View((object)dictionaryList));
        }
コード例 #4
0
        public ActionResult Body(FormCollection collection)
        {
            RoadFlow.Platform.Dictionary   bdict = new RoadFlow.Platform.Dictionary();
            RoadFlow.Data.Model.Dictionary dict  = null;
            string id = Request.QueryString["id"];

            if (id.IsGuid())
            {
                dict = bdict.Get(id.ToGuid());
            }
            if (dict == null)
            {
                dict = bdict.GetRoot();
            }

            if (collection != null)
            {
                string refreshID = dict.ParentID == Guid.Empty ? dict.ID.ToString() : dict.ParentID.ToString();
                //删除
                if (!Request.Form["Delete"].IsNullOrEmpty())
                {
                    int i = bdict.DeleteAndAllChilds(dict.ID);
                    bdict.RefreshCache();
                    RoadFlow.Platform.Log.Add("删除了数据字典及其下级共" + i.ToString() + "项", dict.Serialize(), RoadFlow.Platform.Log.Types.数据字典);
                    ViewBag.Script = "alert('删除成功!');parent.frames[0].reLoad('" + refreshID + "');window.location='Body?id=" + dict.ParentID.ToString() + "&appid=" + Request.QueryString["appid"] + "';";
                    return(View(dict));
                }

                string title  = Request.Form["Title"];
                string code   = Request.Form["Code"];
                string values = Request.Form["Values"];
                string note   = Request.Form["Note"];
                string other  = Request.Form["Other"];
                string oldXML = dict.Serialize();

                dict.Code  = code.IsNullOrEmpty() ? null : code.Trim();
                dict.Note  = note.IsNullOrEmpty() ? null : note.Trim();
                dict.Other = other.IsNullOrEmpty() ? null : other.Trim();
                dict.Title = title.Trim();
                dict.Value = values.IsNullOrEmpty() ? null : values.Trim();

                bdict.Update(dict);
                bdict.RefreshCache();
                RoadFlow.Platform.Log.Add("修改了数据字典项", "", RoadFlow.Platform.Log.Types.数据字典, oldXML, dict.Serialize());
                ViewBag.Script = "alert('保存成功!');parent.frames[0].reLoad('" + refreshID + "');";
            }

            return(View(dict));
        }
コード例 #5
0
        protected void Page_Load(object sender, EventArgs e)
        {
            string values = Request.QueryString["values"];

            RoadFlow.Platform.Dictionary Dict = new RoadFlow.Platform.Dictionary();
            System.Text.StringBuilder    sb   = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                var dict = Dict.Get(value.ToGuid(), true);
                if (dict != null)
                {
                    sb.Append(dict.Title);
                    sb.Append(',');
                }
            }
            Response.Write(sb.ToString().TrimEnd(','));
        }
コード例 #6
0
        public string GetNames()
        {
            string values = Request.QueryString["values"] ?? "";

            RoadFlow.Platform.Dictionary Dict = new RoadFlow.Platform.Dictionary();
            System.Text.StringBuilder    sb   = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                var dict = Dict.Get(value.ToGuid(), true);
                if (dict != null)
                {
                    sb.Append(dict.Title);
                    sb.Append(',');
                }
            }
            return(sb.ToString().TrimEnd(','));
        }
コード例 #7
0
        public ActionResult Sort(FormCollection collection)
        {
            RoadFlow.Platform.Dictionary BDict = new RoadFlow.Platform.Dictionary();
            string id        = Request.QueryString["id"];
            string refreshID = "";
            Guid   dictid;
            List <RoadFlow.Data.Model.Dictionary> dicts = new List <RoadFlow.Data.Model.Dictionary>();

            if (id.IsGuid(out dictid))
            {
                var dict = BDict.Get(dictid);
                if (dict != null)
                {
                    dicts     = BDict.GetChilds(dict.ParentID);
                    refreshID = dict.ParentID.ToString();
                }
            }

            if (collection != null)
            {
                string sortdict = Request.Form["sort"];
                if (sortdict.IsNullOrEmpty())
                {
                    return(View(dicts));
                }
                string[] sortArray = sortdict.Split(',');

                int i = 1;
                foreach (string id1 in sortArray)
                {
                    Guid gid;
                    if (id1.IsGuid(out gid))
                    {
                        BDict.UpdateSort(gid, i++);
                    }
                }
                BDict.RefreshCache();

                RoadFlow.Platform.Log.Add("保存了数据字典排序", "保存了ID为:" + id + "的同级排序", RoadFlow.Platform.Log.Types.数据字典);
                ViewBag.Script = "parent.frames[0].reLoad('" + refreshID + "');";
                dicts          = BDict.GetChilds(refreshID.ToGuid());
            }

            return(View(dicts));
        }
コード例 #8
0
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            string values = context.Request.QueryString["values"] ?? "";

            RoadFlow.Platform.Dictionary Dict = new RoadFlow.Platform.Dictionary();
            System.Text.StringBuilder    sb   = new System.Text.StringBuilder();
            foreach (string value in values.Split(','))
            {
                var dict = Dict.Get(value.ToGuid(), true);
                if (dict != null)
                {
                    sb.Append(dict.Title);
                    sb.Append(',');
                }
            }
            context.Response.Write(sb.ToString().TrimEnd(','));
        }
コード例 #9
0
        public string GetNames()
        {
            string obj = base.Request.QueryString["values"] ?? "";

            RoadFlow.Platform.Dictionary dictionary = new RoadFlow.Platform.Dictionary();
            StringBuilder stringBuilder             = new StringBuilder();

            string[] array = obj.Split(',');
            foreach (string text in array)
            {
                RoadFlow.Data.Model.Dictionary dictionary2 = dictionary.Get(MyExtensions.ToGuid(text), fromCache: true);
                if (dictionary2 != null)
                {
                    stringBuilder.Append(dictionary2.Title);
                    stringBuilder.Append(',');
                }
            }
            return(stringBuilder.ToString().TrimEnd(','));
        }
コード例 #10
0
        public string GetNames()
        {
            string str1 = this.Request.QueryString["values"] ?? "";

            RoadFlow.Platform.Dictionary dictionary1 = new RoadFlow.Platform.Dictionary();
            StringBuilder stringBuilder = new StringBuilder();

            char[] chArray = new char[1] {
                ','
            };
            foreach (string str2 in str1.Split(chArray))
            {
                RoadFlow.Data.Model.Dictionary dictionary2 = dictionary1.Get(str2.ToGuid(), true);
                if (dictionary2 != null)
                {
                    stringBuilder.Append(dictionary2.Title);
                    stringBuilder.Append(',');
                }
            }
            return(stringBuilder.ToString().TrimEnd(','));
        }
コード例 #11
0
ファイル: Sort.aspx.cs プロジェクト: zhibinyu/RoadFlow-2
        protected void Page_Load(object sender, EventArgs e)
        {
            RoadFlow.Platform.Dictionary BDict = new RoadFlow.Platform.Dictionary();
            string id        = Request.QueryString["id"];
            string refreshID = "";
            Guid   dictid;

            if (id.IsGuid(out dictid))
            {
                var dict = BDict.Get(dictid);
                if (dict != null)
                {
                    DictList  = BDict.GetChilds(dict.ParentID);
                    refreshID = dict.ParentID.ToString();
                }
            }

            if (IsPostBack)
            {
                string sortdict = Request.Form["sort"];
                if (sortdict.IsNullOrEmpty())
                {
                    return;
                }
                string[] sortArray = sortdict.Split(',');
                int      i         = 1;
                foreach (string id1 in sortArray)
                {
                    Guid gid;
                    if (id1.IsGuid(out gid))
                    {
                        BDict.UpdateSort(gid, i++);
                    }
                }
                BDict.RefreshCache();
                RoadFlow.Platform.Log.Add("保存了数据字典排序", "保存了ID为:" + id + "的同级排序", RoadFlow.Platform.Log.Types.数据字典);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + refreshID + "');", true);
                DictList = BDict.GetChilds(refreshID.ToGuid());
            }
        }
コード例 #12
0
        public string Tree1()
        {
            RoadFlow.Platform.Dictionary BDict = new RoadFlow.Platform.Dictionary();

            string rootid  = Request.QueryString["root"];
            bool   ischild = "1" == Request.QueryString["ischild"];//是否要加载下级节点
            Guid   rootID  = Guid.Empty;

            if (!rootid.IsNullOrEmpty())
            {
                if (!rootid.IsGuid(out rootID))
                {
                    var dict = BDict.GetByCode(rootid);
                    if (dict != null)
                    {
                        rootID = dict.ID;
                    }
                }
            }

            var root         = rootID != Guid.Empty ? BDict.Get(rootID) : BDict.GetRoot();
            var rootHasChild = BDict.HasChilds(root.ID);

            System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000);
            json.Append("{");
            json.AppendFormat("\"id\":\"{0}\",", root.ID);
            json.AppendFormat("\"parentID\":\"{0}\",", root.ParentID);
            json.AppendFormat("\"title\":\"{0}\",", root.Title);
            json.AppendFormat("\"type\":\"{0}\",", rootHasChild ? "0" : "2"); //类型:0根 1父 2子
            json.AppendFormat("\"ico\":\"{0}\",", Url.Content("~/images/ico/role.gif"));
            json.AppendFormat("\"hasChilds\":\"{0}\",", rootHasChild ? "1" : "0");
            json.Append("\"childs\":[");

            var childs = BDict.GetChilds(root.ID);
            int i      = 0;
            int count  = childs.Count;

            foreach (var child in childs)
            {
                var hasChild = ischild && BDict.HasChilds(child.ID);
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", child.ID);
                json.AppendFormat("\"parentID\":\"{0}\",", child.ParentID);
                json.AppendFormat("\"title\":\"{0}\",", child.Title);
                json.AppendFormat("\"type\":\"{0}\",", hasChild ? "1" : "2");
                json.AppendFormat("\"ico\":\"{0}\",", "");
                json.AppendFormat("\"hasChilds\":\"{0}\",", hasChild ? "1" : "0");
                json.Append("\"childs\":[");
                json.Append("]");
                json.Append("}");
                if (i++ < count - 1)
                {
                    json.Append(",");
                }
            }

            json.Append("]");
            json.Append("}");
            json.Append("]");
            return(json.ToString());
        }
コード例 #13
0
        public ActionResult Body(FormCollection collection)
        {
            RoadFlow.Platform.Dictionary   dictionary = new RoadFlow.Platform.Dictionary();
            RoadFlow.Data.Model.Dictionary model      = (RoadFlow.Data.Model.Dictionary)null;
            string str1 = this.Request.QueryString["id"];

            if (str1.IsGuid())
            {
                model = dictionary.Get(str1.ToGuid(), false);
            }
            if (model == null)
            {
                model = dictionary.GetRoot();
            }
            if (collection != null)
            {
                Guid   guid;
                string str2;
                if (!(model.ParentID == Guid.Empty))
                {
                    guid = model.ParentID;
                    str2 = guid.ToString();
                }
                else
                {
                    guid = model.ID;
                    str2 = guid.ToString();
                }
                string str3 = str2;
                if (!this.Request.Form["Delete"].IsNullOrEmpty())
                {
                    int num = dictionary.DeleteAndAllChilds(model.ID);
                    dictionary.RefreshCache();
                    RoadFlow.Platform.Log.Add("删除了数据字典及其下级共" + num.ToString() + "项", model.Serialize(), RoadFlow.Platform.Log.Types.数据字典, "", "", (RoadFlow.Data.Model.Users)null);
                    // ISSUE: reference to a compiler-generated field
                    if (DictController.\u003C\u003Eo__5.\u003C\u003Ep__0 == null)
                    {
                        // ISSUE: reference to a compiler-generated field
                        DictController.\u003C\u003Eo__5.\u003C\u003Ep__0 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "Script", typeof(DictController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                        {
                            CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                            CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                        }));
                    }
                    // ISSUE: reference to a compiler-generated field
                    Func <CallSite, object, string, object> target = DictController.\u003C\u003Eo__5.\u003C\u003Ep__0.Target;
                    // ISSUE: reference to a compiler-generated field
                    CallSite <Func <CallSite, object, string, object> > p0 = DictController.\u003C\u003Eo__5.\u003C\u003Ep__0;
                    object   viewBag  = this.ViewBag;
                    string[] strArray = new string[7] {
                        "alert('删除成功!');parent.frames[0].reLoad('", str3, "');window.location='Body?id=", null, null, null, null
                    };
                    int index = 3;
                    guid = model.ParentID;
                    string str4 = guid.ToString();
                    strArray[index] = str4;
                    strArray[4]     = "&appid=";
                    strArray[5]     = this.Request.QueryString["appid"];
                    strArray[6]     = "';";
                    string str5 = string.Concat(strArray);
                    object obj  = target((CallSite)p0, viewBag, str5);
                    return((ActionResult)this.View((object)model));
                }
                string str6   = this.Request.Form["Title"];
                string str7   = this.Request.Form["Code"];
                string str8   = this.Request.Form["Values"];
                string str9   = this.Request.Form["Note"];
                string str10  = this.Request.Form["Other"];
                string oldXML = model.Serialize();
                model.Code  = str7.IsNullOrEmpty() ? (string)null : str7.Trim();
                model.Note  = str9.IsNullOrEmpty() ? (string)null : str9.Trim();
                model.Other = str10.IsNullOrEmpty() ? (string)null : str10.Trim();
                model.Title = str6.Trim();
                model.Value = str8.IsNullOrEmpty() ? (string)null : str8.Trim();
                dictionary.Update(model);
                dictionary.RefreshCache();
                RoadFlow.Platform.Log.Add("修改了数据字典项", "", RoadFlow.Platform.Log.Types.数据字典, oldXML, model.Serialize(), (RoadFlow.Data.Model.Users)null);
                // ISSUE: reference to a compiler-generated field
                if (DictController.\u003C\u003Eo__5.\u003C\u003Ep__1 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    DictController.\u003C\u003Eo__5.\u003C\u003Ep__1 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "Script", typeof(DictController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                    {
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                    }));
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                object obj1 = DictController.\u003C\u003Eo__5.\u003C\u003Ep__1.Target((CallSite)DictController.\u003C\u003Eo__5.\u003C\u003Ep__1, this.ViewBag, "alert('保存成功!');parent.frames[0].reLoad('" + str3 + "');");
            }
            return((ActionResult)this.View((object)model));
        }
コード例 #14
0
ファイル: Tree1.ashx.cs プロジェクト: zhibinyu/RoadFlow-2
        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "text/plain";
            RoadFlow.Platform.Dictionary BDict = new RoadFlow.Platform.Dictionary();

            string rootid  = context.Request.QueryString["root"];
            bool   ischild = "1" == context.Request.QueryString["ischild"];//是否要加载下级节点

            Guid rootID = Guid.Empty;

            if (!rootid.IsGuid(out rootID))
            {
                if (!rootid.IsGuid(out rootID))
                {
                    var dict = BDict.GetByCode(rootid);
                    if (dict != null)
                    {
                        rootID = dict.ID;
                    }
                }
            }

            var root         = rootID != Guid.Empty ? BDict.Get(rootID) : BDict.GetRoot();
            var rootHasChild = BDict.HasChilds(root.ID);

            System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000);
            json.Append("{");
            json.AppendFormat("\"id\":\"{0}\",", root.ID);
            json.AppendFormat("\"parentID\":\"{0}\",", root.ParentID);
            json.AppendFormat("\"title\":\"{0}\",", root.Title);
            json.AppendFormat("\"type\":\"{0}\",", rootHasChild ? "0" : "2"); //类型:0根 1父 2子
            json.AppendFormat("\"ico\":\"{0}\",", Common.Tools.BaseUrl + "/images/ico/role.gif");
            json.AppendFormat("\"hasChilds\":\"{0}\",", rootHasChild ? "1" : "0");
            json.Append("\"childs\":[");

            var childs = BDict.GetChilds(root.ID);
            int i      = 0;
            int count  = childs.Count;

            foreach (var child in childs)
            {
                var hasChild = ischild && BDict.HasChilds(child.ID);
                json.Append("{");
                json.AppendFormat("\"id\":\"{0}\",", child.ID);
                json.AppendFormat("\"parentID\":\"{0}\",", child.ParentID);
                json.AppendFormat("\"title\":\"{0}\",", child.Title);
                json.AppendFormat("\"type\":\"{0}\",", hasChild ? "1" : "2");
                json.AppendFormat("\"ico\":\"{0}\",", "");
                json.AppendFormat("\"hasChilds\":\"{0}\",", hasChild ? "1" : "0");
                json.Append("\"childs\":[");
                json.Append("]");
                json.Append("}");
                if (i++ < count - 1)
                {
                    json.Append(",");
                }
            }

            json.Append("]");
            json.Append("}");
            json.Append("]");
            context.Response.Write(json.ToString());
        }