コード例 #1
0
        private void GenerateEntityXmlClick(object o, EventArgs e)
        {
            TableNode tn = (TableNode)this.SelectedNode;

            if (tn == null)
            {
                return;
            }
            CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings();

            Generator.GenerateEntityXmlFromTable(tn.Table, folder.EntityFullPath, "Johnny.CMS", "Access");
        }
コード例 #2
0
        private void GenerateTextXmlClick(object o, EventArgs e)
        {
            TableNode tn = (TableNode)this.SelectedNode;

            if (tn == null)
            {
                return;
            }
            CodeGeneratorSettingsInfo folder = ConfigCtrl.GetCodeGeneratorSettings();

            Generator.GenerateTextXmlFromTable(tn.Table, @"D:\WorkSpace\Projects_GitHub\CodeGenerator\Dev\Src\CodeGenerator\");
        }
コード例 #3
0
        private void OpenCodeGeneratorClick(object o, EventArgs e)
        {
            TableNodeClickEventArgs te = new TableNodeClickEventArgs();
            TableNode    tn            = (TableNode)this.SelectedNode;
            DatabaseNode dn            = (DatabaseNode)tn.Parent.Parent;
            ServerNode   sn            = (ServerNode)tn.Parent.Parent.Parent;

            te.ConnectionString = sn.Server.ConnectionString + "Database=" + dn.Text + ";";
            te.Server           = sn.Server.ServerName;
            te.Database         = dn.Text;
            te.Table            = tn.Text;
            OnTableNodeClick(te);
        }
コード例 #4
0
ファイル: DatabaseTree.cs プロジェクト: jojozhuang/Projects
        private void OnBeforeExpand(object o, System.Windows.Forms.TreeViewCancelEventArgs e)
        {
            if (DoubleClicked)
            {
                e.Cancel = true;
                DoubleClicked = false;
                e.Node.Collapse();
            }
            else
            {
                DatabaseNode dbn = e.Node as DatabaseNode;
                if (dbn != null)
                {
                    if (dbn.Nodes.Count == 1)
                    { 
                        HiddenNode hn = dbn.Nodes[0] as HiddenNode;
                        if (hn != null)
                        {
                            dbn.Nodes.Clear();

                            // build tables
                            TablesNode TableRoot = new TablesNode("Tables");

                            Collection<TableInfo> tables = DatabaseCtrl.GetTables(dbn.DbInfo);

                            foreach (TableInfo tbl in tables)
                            {
                                TableNode tNode = new TableNode(tbl);
                                foreach (ColumnInfo column in tbl.Columns)
                                {
                                    ColumnNode cNode = new ColumnNode(column.ColumnName);
                                    tNode.Nodes.Add(cNode);
                                }
                                TableRoot.Nodes.Add(tNode);
                            }

                            dbn.Nodes.Add(TableRoot);

                            // build views
                            TableRoot = new TablesNode("Views");

                            Collection<ViewInfo> views = DatabaseCtrl.GetViews(dbn.DbInfo);

                            foreach (ViewInfo view in views)
                            {
                                ViewNode vNode = new ViewNode(view.ViewName);
                                foreach (ColumnInfo column in view.Columns)
                                {
                                    ColumnNode cNode = new ColumnNode(column.ColumnName);
                                    vNode.Nodes.Add(cNode);
                                }
                                TableRoot.Nodes.Add(vNode);
                            }

                            dbn.Nodes.Add(TableRoot);
                        }
                    }
                }                
            }
        }