private void menuViewStoreProcedure_Click(object sender, EventArgs e) { Model.Database database = tvDatabase.SelectedNode.Parent.Parent.Tag as Model.Database; string text = CodeUtility.SpInfo.GetSpInfo(database, tvDatabase.SelectedNode.Text); FormCodeView frm = new FormCodeView(tvDatabase.SelectedNode.Text, text, "TSQL"); frm.Show(FormMain.dp); }
private void menuHelpTopic_Click(object sender, EventArgs e) { StreamReader sr = new StreamReader(System.Windows.Forms.Application.StartupPath + "\\Resources\\Readme.txt", Encoding.Default); string code = sr.ReadToEnd(); sr.Close(); FormCodeView frm = new FormCodeView("帮助", code, "C#"); frm.Show(dp); }
private void menuViewPageHelper_Click(object sender, EventArgs e) { StreamReader sr = new StreamReader(System.Windows.Forms.Application.StartupPath + "\\Template\\DBUtility\\PageHelper.cs", Encoding.Default); string code = sr.ReadToEnd(); sr.Close(); FormCodeView frm = new FormCodeView("PageHelper", code, "C#"); frm.Show(dp); }
public void menuCreateStoreProcedure_Click(object sender, EventArgs e) { if (tvDatabase.SelectedNode != null && tvDatabase.SelectedNode.Level == 2 && tvDatabase.SelectedNode.Parent.Index == 0) { FormCodeView frm = new FormCodeView(tvDatabase.SelectedNode.Text + "的存储过程", Codes.Sp.GetSpCode(tvDatabase.SelectedNode.Tag as Model.Table), "TSQL"); frm.Show(FormMain.dp); } else { FormMain.ShowMessage("请先选择一个表"); } }
public void menuCreateStoreProcedure_Click(object sender, EventArgs e) { if (tvDatabase.SelectedNode != null && tvDatabase.SelectedNode.Level == 2 && tvDatabase.SelectedNode.Parent.Index != 2) { Model.Table table = tvDatabase.SelectedNode.Tag as Model.Table; if (!table.HasConditonRow) { FormMain.ShowMessage("该表不存在任何字段,无法生成!"); return; } string storeProcedure; switch ((tvDatabase.SelectedNode.Parent.Parent.Tag as Model.Database).Type) { case Model.Database.DatabaseType.Sql2000: case Model.Database.DatabaseType.Sql2005: storeProcedure = Codes.SqlStoredProcedureCode.GetSqlStoredProcedureCode(table); break; case Model.Database.DatabaseType.MySql: storeProcedure = Codes.MySqlStoreProcedureCode.GetMySqlStoreProcedureCode(table); break; case Model.Database.DatabaseType.Access: default: MessageBox.Show("该数据库不支持存储过程!"); return; } FormCodeView frm = new FormCodeView(_cms, tvDatabase.SelectedNode.Text + "的存储过程", storeProcedure, "TSQL"); frm.Show(FormMain.dockPanel); } else { FormMain.ShowMessage("请先选择一个表"); } }