コード例 #1
0
        public JsonResult GetTreeNodeList(E_PageParameter ePageParameter)
        {
            DbObject db = new DbObject(ePageParameter.connstring);

            List <E_TreeNode> NodeList = new List <E_TreeNode>();
            var tables = db.GetTableViews(ePageParameter.dbname);

            foreach (var item in tables)
            {
                E_TreeNode nodetable = new E_TreeNode();
                nodetable.id       = 0;
                nodetable.name     = item;
                nodetable.nodetype = 1;
                List <ColumnInfo> ColumnList     = db.GetColumnInfoList(ePageParameter.dbname, item);
                List <E_TreeNode> columnnodelist = new List <E_TreeNode>();
                foreach (var columnitem in ColumnList)
                {
                    E_TreeNode nodecolumn = new E_TreeNode();
                    nodecolumn.id       = 0;
                    nodecolumn.name     = columnitem.ColumnName + "(" + columnitem.TypeName + ")" + columnitem.Description;
                    nodecolumn.children = null;
                    nodecolumn.nodetype = 2;
                    columnnodelist.Add(nodecolumn);
                }
                nodetable.children = columnnodelist;
                NodeList.Add(nodetable);
            }
            return(Json(NodeList, JsonRequestBehavior.AllowGet));
        }