示例#1
0
        private void CrearRamaRelaciones(TreeNode raiz)
        {
            if (raiz.GetNodeCount(false) == 0)
            {
                DBSchemaInfo s = (DBSchemaInfo)raiz.Parent.Tag;
                TipoRaiz     t = (TipoRaiz)raiz.Tag;
                Collection <DBRelationInfo> relations = new Collection <DBRelationInfo>();
                switch (t)
                {
                case TipoRaiz.RaizTablas:
                    relations = DBUtils.QueryTableCatalog(s);
                    break;

                case TipoRaiz.RaizVistas:
                    relations = DBUtils.QueryViewCatalog(s);
                    break;
                }
                foreach (DBRelationInfo r in relations)
                {
                    TreeNode RC = new TreeNode("Columnas");
                    RC.ContextMenuStrip = this.mColumnas;
                    RC.Tag = TipoRaiz.RaizColumnas;
                    TreeNode R = new TreeNode(r.Name);
                    R.ContextMenuStrip = this.mRelacion;
                    R.Tag = r;
                    R.Nodes.Add(RC);
                    raiz.Nodes.Add(R);
                }
            }
        }
示例#2
0
        void TvEsquemasNodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)
        {
            if (e.Node.Tag is TipoRaiz)
            {
                TipoRaiz t = (TipoRaiz)e.Node.Tag;
                switch (t)
                {
                case TipoRaiz.RaizEsquemas:
                    this.CrearRamaEsquemas(e.Node);
                    break;

                case TipoRaiz.RaizTablas:
                case TipoRaiz.RaizVistas:
                    this.CrearRamaRelaciones(e.Node);
                    break;

                case TipoRaiz.RaizColumnas:
                    this.CrearRamaColumnas(e.Node);
                    this.tvEsquemas.SelectedNode = e.Node;
                    break;
                }
            }
            else
            {
                this.tvEsquemas.SelectedNode = e.Node;
            }
        }