NameRule namerule = new NameRule();//类命名规则 public CodeMaker() { InitializeComponent(); list_KeyField.Height = 22; codeview = new UcCodeView(); tabPage2.Controls.Add(codeview); SetListViewMenu("colum"); CreatView(); SetFormConfig(); DbView dbviewfrm = (DbView)Application.OpenForms["DbView"]; if (dbviewfrm != null) { try { this.thread = new Thread(new ThreadStart(Showlistview)); this.thread.Start(); } catch { } } }
public DbBrowser() { InitializeComponent(); DbView dbviewfrm = (DbView)Application.OpenForms["DbView"]; SetListView(dbviewfrm); }
public void SetListView(DbView dbviewfrm) { #region 得到类型对象 TreeNode selectedNode = dbviewfrm.treeView1.SelectedNode; if (selectedNode == null) { return; } string key; switch (key = selectedNode.Tag.ToString()) { case "serverlist": case "server": this.servername = selectedNode.Text; break; case "db": this.servername = selectedNode.Parent.Text; this.dbname = selectedNode.Text; break; case "table": this.servername = selectedNode.Parent.Parent.Parent.Text; this.dbname = selectedNode.Parent.Parent.Text; this.tablename = selectedNode.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.SetListViewMenu("column"); this.BindlistViewCol(this.dbname, this.tablename); break; case "view": this.servername = selectedNode.Parent.Parent.Parent.Text; this.dbname = selectedNode.Parent.Parent.Text; this.tablename = selectedNode.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.SetListViewMenu("column"); this.BindlistViewCol(this.dbname, this.tablename); break; case "column": this.servername = selectedNode.Parent.Parent.Parent.Parent.Text; this.dbname = selectedNode.Parent.Parent.Parent.Text; this.tablename = selectedNode.Parent.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.SetListViewMenu("column"); this.BindlistViewCol(this.dbname, this.tablename); break; default: this.listView1.Items.Clear(); break; } IL_256: this.SetCodeBuilders(); this.SetFormConfig(this.servername); #endregion }
public void SetListView(DbView dbviewfrm) { #region 得到类型对象 TreeNode SelNode = dbviewfrm.treeView1.SelectedNode; if (SelNode == null) { return; } switch (SelNode.Tag.ToString()) { case "table": { servername = SelNode.Parent.Parent.Parent.Text; dbname = SelNode.Parent.Parent.Text; tablename = SelNode.Text; dbobj = ObjHelper.CreatDbObj(servername); SetListViewMenu("column"); BindlistViewCol(dbname, tablename); } break; case "view": { servername = SelNode.Parent.Parent.Parent.Text; dbname = SelNode.Parent.Parent.Text; tablename = SelNode.Text; dbobj = ObjHelper.CreatDbObj(servername); SetListViewMenu("column"); BindlistViewCol(dbname, tablename); } break; case "column": { servername = SelNode.Parent.Parent.Parent.Parent.Text; dbname = SelNode.Parent.Parent.Parent.Text; tablename = SelNode.Parent.Text; dbobj = ObjHelper.CreatDbObj(servername); SetListViewMenu("column"); BindlistViewCol(dbname, tablename); } break; default: { this.listView1.Items.Clear(); } break; } if (dbobj != null) { cb = new CodeBuilders(dbobj); } #endregion }
/// <summary> /// 得到当前数据库浏览器选中的服务器名称 /// </summary> public static string GetDbViewSelServer() { if (Application.OpenForms["DbView"] == null) { return(""); } DbView dbviewfrm1 = (DbView)Application.OpenForms["DbView"]; TreeNode SelNode = dbviewfrm1.treeView1.SelectedNode; if (SelNode == null) { return(""); } string longservername = ""; switch (SelNode.Tag.ToString()) { case "serverlist": return(""); case "server": { longservername = SelNode.Text; } break; case "db": { longservername = SelNode.Parent.Text; } break; case "tableroot": case "viewroot": { longservername = SelNode.Parent.Parent.Text; } break; case "table": case "view": { longservername = SelNode.Parent.Parent.Parent.Text; } break; case "column": longservername = SelNode.Parent.Parent.Parent.Parent.Text; break; } return(longservername); }
private void Showlistview() { DbView dbView = (DbView)Application.OpenForms["DbView"]; if (dbView.treeView1.InvokeRequired) { CodeMakerTran.SetListCallback method = new CodeMakerTran.SetListCallback(this.Showlistview); dbView.Invoke(method, null); return; } this.SetListView(dbView); }
void Showlistview() { DbView dbviewfrm = (DbView)Application.OpenForms["DbView"]; if (dbviewfrm.treeView1.InvokeRequired) { SetListCallback d = new SetListCallback(Showlistview); dbviewfrm.Invoke(d, null); } else { SetListView(dbviewfrm); } }
public void SetListView(DbView dbviewfrm) { #region 得到类型对象 TreeNode selectedNode = dbviewfrm.treeView1.SelectedNode; if (selectedNode == null) { return; } this.objtype = selectedNode.Tag.ToString(); string a; if ((a = selectedNode.Tag.ToString()) != null) { if (a == "table" || a == "view") { this.servername = selectedNode.Parent.Parent.Parent.Text; this.dbname = selectedNode.Parent.Parent.Text; this.tablename = selectedNode.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.BindlistViewCol(this.dbname, this.tablename); goto IL_1B7; } if (a == "column") { this.servername = selectedNode.Parent.Parent.Parent.Parent.Text; this.dbname = selectedNode.Parent.Parent.Parent.Text; this.tablename = selectedNode.Parent.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.BindlistViewCol(this.dbname, this.tablename); goto IL_1B7; } if (a == "proc") { this.servername = selectedNode.Parent.Parent.Parent.Text; this.dbname = selectedNode.Parent.Parent.Text; this.tablename = selectedNode.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.BindlistProcCol(this.dbname, this.tablename); goto IL_1B7; } } this.listView1.Items.Clear(); IL_1B7: this.GetTableDesc(); if (this.servername != null && this.servername.Length > 1) { this.dbset = DbConfig.GetSetting(this.servername); } #endregion }
public CodeTemplate(Form mdiParentForm) { InitializeComponent(); this.codeview = new UcCodeView(); this.tabPage2.Controls.Add(this.codeview); this.mainfrm = (MainForm)mdiParentForm; this.CreatView(); this.mainfrm.toolBtn_Run.Visible = true; DbView dbView = (DbView)Application.OpenForms["DbView"]; if (dbView != null) { this.SetListView(dbView); } }
public static string GetDbViewSelServer() { if (Application.OpenForms["DbView"] == null) { return(""); } DbView dbView = (DbView)Application.OpenForms["DbView"]; TreeNode selectedNode = dbView.treeView1.SelectedNode; if (selectedNode == null) { return(""); } string result = ""; string key; switch (key = selectedNode.Tag.ToString()) { case "serverlist": return(""); case "server": result = selectedNode.Text; break; case "db": result = selectedNode.Parent.Text; break; case "tableroot": case "viewroot": result = selectedNode.Parent.Parent.Text; break; case "table": case "view": case "proc": result = selectedNode.Parent.Parent.Parent.Text; break; case "column": result = selectedNode.Parent.Parent.Parent.Parent.Text; break; } return(result); }
public CodeMaker() { InitializeComponent(); this.InitializeForm(); DbView dbView = (DbView)Application.OpenForms["DbView"]; if (dbView != null) { try { this.thread = new Thread(new ThreadStart(this.Showlistview)); this.thread.Start(); } catch { } } }
public CodeTemp(Form mdiParentForm) { InitializeComponent(); mainfrm = (MainForm)mdiParentForm; CreatView(); DbView dbviewfrm = (DbView)Application.OpenForms["DbView"]; if (dbviewfrm != null) { //SetListView(dbviewfrm); try { this.thread = new Thread(new ThreadStart(Showlistview)); this.thread.Start(); } catch { } } }
public CodeMakerTran(string Dbname) { InitializeComponent(); this.dbname = Dbname; this.codeview = new UcCodeView(); this.tabPage2.Controls.Add(this.codeview); this.CreatView(); DbView dbView = (DbView)Application.OpenForms["DbView"]; if (dbView != null) { try { this.thread = new Thread(new ThreadStart(this.Showlistview)); this.thread.Start(); } catch { } } }
private void lblAddServer_Click(object sender, EventArgs e) { DbView dbview = new DbView(mainfrm); dbview.backgroundWorkerReg.RunWorkerAsync(); }
public void SetListView(DbView dbviewfrm) { #region 得到类型对象 TreeNode SelNode = dbviewfrm.treeView1.SelectedNode; if (SelNode == null) { return; } string servername = ""; switch (SelNode.Tag.ToString()) { case "serverlist": return; case "server": { servername = SelNode.Text; CreatDbObj(servername); #region listView1 this.lblViewInfo.Text = " 服务器:" + servername; this.lblNum.Text = SelNode.Nodes.Count.ToString() + "项"; this.listView1.Columns.Clear(); this.listView1.Items.Clear(); this.listView1.LargeImageList = this.imglistDB; //this.listView1.SmallImageList = imglistView; this.listView1.View = View.LargeIcon; foreach (TreeNode node in SelNode.Nodes) { string dbname = node.Text; ListViewItem item1 = new ListViewItem(dbname, 0); item1.SubItems.Add(dbname); item1.ImageIndex = 0; listView1.Items.AddRange(new ListViewItem[] { item1 }); } SetListViewMenu("db"); #endregion } break; case "db": { servername = SelNode.Parent.Text; CreatDbObj(servername); #region this.lblViewInfo.Text = " 数据库:" + SelNode.Text; this.lblNum.Text = SelNode.Nodes.Count.ToString() + "项"; SetListViewMenu("table"); BindlistViewTab(SelNode.Text, SelNode.Tag.ToString()); #endregion } break; case "tableroot": case "viewroot": case "procroot": { servername = SelNode.Parent.Parent.Text; string dbname = SelNode.Parent.Text; CreatDbObj(servername); #region this.lblViewInfo.Text = " 数据库:" + dbname; this.lblNum.Text = SelNode.Nodes.Count.ToString() + "项"; SetListViewMenu("table"); BindlistViewTab(dbname, SelNode.Tag.ToString()); #endregion } break; case "table": case "view": { servername = SelNode.Parent.Parent.Parent.Text; string dbname = SelNode.Parent.Parent.Text; string tabname = SelNode.Text; CreatDbObj(servername); #region this.lblViewInfo.Text = " 表:" + tabname; this.lblNum.Text = SelNode.Nodes.Count.ToString() + "项"; SetListViewMenu("column"); BindlistViewCol(dbname, tabname); #endregion } break; case "proc": { servername = SelNode.Parent.Parent.Parent.Text; string dbname = SelNode.Parent.Parent.Text; string tabname = SelNode.Text; CreatDbObj(servername); #region this.lblViewInfo.Text = " 存储过程:" + tabname; this.lblNum.Text = SelNode.Nodes.Count.ToString() + "项"; //SetListViewMenu("column"); //BindlistViewCol(dbname, tabname); //this.listView1.Columns.Clear(); this.listView1.Items.Clear(); #endregion } break; case "column": servername = SelNode.Parent.Parent.Parent.Parent.Text; break; } #endregion }
public void SetListView(DbView dbviewfrm) { TreeNode selectedNode = dbviewfrm.treeView1.SelectedNode; if (selectedNode == null) { return; } string a; if ((a = selectedNode.Tag.ToString()) != null) { if (a == "server") { this.servername = selectedNode.Text; goto IL_1E6; } if (a == "table") { this.servername = selectedNode.Parent.Parent.Parent.Text; this.dbname = selectedNode.Parent.Parent.Text; this.tablename = selectedNode.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.BindTablist(this.dbname); goto IL_1E6; } if (a == "view") { this.servername = selectedNode.Parent.Parent.Parent.Text; this.dbname = selectedNode.Parent.Parent.Text; this.tablename = selectedNode.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.BindTablist(this.dbname); goto IL_1E6; } if (a == "column") { this.servername = selectedNode.Parent.Parent.Parent.Parent.Text; this.dbname = selectedNode.Parent.Parent.Parent.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.BindTablist(this.dbname); goto IL_1E6; } if (a == "db") { this.servername = selectedNode.Parent.Text; this.dbname = selectedNode.Text; this.dbobj = ObjHelper.CreatDbObj(this.servername); this.BindTablist(this.dbname); goto IL_1E6; } } this.listView1.Items.Clear(); IL_1E6: if (this.dbobj != null) { this.cb = new CodeBuilders(this.dbobj); DataTable tablesExProperty = this.dbobj.GetTablesExProperty(this.dbname); if (tablesExProperty != null) { try { DataRow[] array = tablesExProperty.Select("objname='" + this.tablename + "'"); if (array.Length > 0 && array[0]["value"] != null) { this.cb.TableDescription = array[0]["value"].ToString(); } } catch { } } } this.SetFormConfig(this.servername); }