Exemplo n.º 1
0
        private void GetUnit(string gq)
        {
            IList <Hashtable> list = new List <Hashtable>();

            list = _pd.GetUnits(gq);

            string _tree_Info = "";

            if (list != null)
            {
                _tree_Info += "{id:'0',pId:'00',name:'风机对比',t:'风机对比', open:true},";
                foreach (Hashtable ht in list)
                {
                    _tree_Info += "{id:'" + ht["T_UNITID"] + "',pId:'0',name:'" + ht["T_UNITDESC"] + "',t:'" + ht["T_UNITDESC"] + "'},";
                }

                if (_tree_Info.Length > 0)
                {
                    _tree_Info = _tree_Info.Substring(0, _tree_Info.Length - 1);
                    _tree_Info = "[" + _tree_Info + "]";
                }
            }
            object obj = new
            {
                info = _tree_Info
            };

            result = JsonConvert.SerializeObject(obj);
            Response.Write(result);
            Response.End();
        }