Example #1
0
        public DatabaseTreeNode(string connectionString)
        {
            Bamboo.Mssql.Database database = SqlSchemaReader.Read(connectionString);

            this.Text = database.Name;
            this.Tag  = database;

            this.ImageIndex         = Images.Database;
            this.SelectedImageIndex = Images.Database;

            TablesTreeNode tablesTreeNode = new TablesTreeNode(database.Tables);

            this.Nodes.Add(tablesTreeNode);

            ViewsTreeNode viewsTreeNode = new ViewsTreeNode(database.Views);

            this.Nodes.Add(viewsTreeNode);

            ProceduresTreeNode proceduresTreeNode = new ProceduresTreeNode(database.Procedures);

            this.Nodes.Add(proceduresTreeNode);
        }
Example #2
0
        private void sqlDatabaseTreeView_SelectionChanged(object sender, System.EventArgs e)
        {
            System.Windows.Forms.TreeNode selectedNode = this.sqlDatabaseTreeView.SelectedNode;
            if (selectedNode != null)
            {
                if (selectedNode is TablesTreeNode)
                {
                    this.listView.View = System.Windows.Forms.View.List;
                    this.listView.Columns.Clear();
                    this.listView.Clear();

                    TablesTreeNode tablesTreeNode       = (TablesTreeNode)selectedNode;
                    Bamboo.Mssql.TableCollection tables = (Bamboo.Mssql.TableCollection)tablesTreeNode.Tag;
                    this.ShowTables(tables);
                }
                else if (selectedNode is TableTreeNode)
                {
                    this.listView.View = System.Windows.Forms.View.List;
                    this.listView.Columns.Clear();
                    this.listView.Clear();

                    TableTreeNode      tableTreeNode = (TableTreeNode)selectedNode;
                    Bamboo.Mssql.Table table         = (Bamboo.Mssql.Table)tableTreeNode.Tag;
                    this.ShowTableColumns(table.Columns);
                }
                else if (selectedNode is ColumnsTreeNode)
                {
                    this.listView.View = System.Windows.Forms.View.List;
                    this.listView.Columns.Clear();
                    this.listView.Clear();

                    ColumnsTreeNode columnsTreeNode            = (ColumnsTreeNode)selectedNode;
                    Bamboo.Mssql.TableColumnCollection columns = (Bamboo.Mssql.TableColumnCollection)columnsTreeNode.Tag;
                    this.ShowTableColumns(columns);
                }
                else if (selectedNode is ColumnTreeNode)
                {
                    this.listView.Clear();
                    this.listView.View = System.Windows.Forms.View.Details;

                    ColumnTreeNode           columnTreeNode = (ColumnTreeNode)selectedNode;
                    Bamboo.Mssql.TableColumn column         = (Bamboo.Mssql.TableColumn)columnTreeNode.Tag;
                    this.ShowTableColumn(column);
                }
                else if (selectedNode is ViewsTreeNode)
                {
                    this.listView.View = System.Windows.Forms.View.List;
                    this.listView.Columns.Clear();
                    this.listView.Clear();

                    ViewsTreeNode viewsTreeNode       = (ViewsTreeNode)selectedNode;
                    Bamboo.Mssql.ViewCollection views = (Bamboo.Mssql.ViewCollection)viewsTreeNode.Tag;
                    this.ShowViews(views);
                }
                else if (selectedNode is ViewTreeNode)
                {
                    this.listView.View = System.Windows.Forms.View.List;
                    this.listView.Columns.Clear();
                    this.listView.Clear();

                    ViewTreeNode      viewTreeNode = (ViewTreeNode)selectedNode;
                    Bamboo.Mssql.View view         = (Bamboo.Mssql.View)viewTreeNode.Tag;
                    this.ShowViewColumns(view.Columns);
                }
                else if (selectedNode is ViewColumnsTreeNode)
                {
                    this.listView.View = System.Windows.Forms.View.List;
                    this.listView.Columns.Clear();
                    this.listView.Clear();

                    ViewColumnsTreeNode viewColumnsTreeNode   = (ViewColumnsTreeNode)selectedNode;
                    Bamboo.Mssql.ViewColumnCollection columns = (Bamboo.Mssql.ViewColumnCollection)viewColumnsTreeNode.Tag;
                    this.ShowViewColumns(columns);
                }
                else if (selectedNode is ViewColumnTreeNode)
                {
                    this.listView.Clear();
                    this.listView.View = System.Windows.Forms.View.Details;

                    ViewColumnTreeNode      viewColumnTreeNode = (ViewColumnTreeNode)selectedNode;
                    Bamboo.Mssql.ViewColumn column             = (Bamboo.Mssql.ViewColumn)viewColumnTreeNode.Tag;
                    this.ShowViewColumn(column);
                }
                else if (selectedNode is ProceduresTreeNode)
                {
                    this.listView.View = System.Windows.Forms.View.List;
                    this.listView.Columns.Clear();
                    this.listView.Clear();

                    ProceduresTreeNode proceduresTreeNode       = (ProceduresTreeNode)selectedNode;
                    Bamboo.Mssql.ProcedureCollection procedures = (Bamboo.Mssql.ProcedureCollection)proceduresTreeNode.Tag;
                    this.ShowProcudures(procedures);
                }
                else if (selectedNode is ProcedureTreeNode)
                {
                    this.listView.Clear();
                    this.listView.View = System.Windows.Forms.View.Details;

                    ProcedureTreeNode      procedureTreeNode = (ProcedureTreeNode)selectedNode;
                    Bamboo.Mssql.Procedure procedure         = (Bamboo.Mssql.Procedure)procedureTreeNode.Tag;
                    this.ShowProcudure(procedure);
                }
                else
                {
                    this.listView.Clear();
                }
            }
        }