示例#1
0
        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);
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }
示例#4
0
 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("请先选择一个表");
     }
 }
示例#5
0
        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("请先选择一个表");
            }
        }