Exemplo n.º 1
0
        private void BindControls()
        {
            CodeGenerateControl codeGenerate = new CodeGenerateControl();

            this.lblCurrentServerValue.Text = codeGenerate.GetServerName();

            BindDatabases(codeGenerate);

            //codeGenerate.GetTablesInDatabase();
        }
Exemplo n.º 2
0
        private void BindListBox(CodeGenerateControl codeGenerate, string dataBaseName)
        {
            List <string> tableNameList = codeGenerate.GetTableNamesInDatabase(dataBaseName);

            if (this.ltbSourceTable.Items.Count > 0 || this.ltbSelTables.Items.Count > 0)
            {
                this.ltbSourceTable.Items.Clear();
                this.ltbSelTables.Items.Clear();
            }

            tableNameList.ForEach(each => this.ltbSourceTable.Items.Add(each));
        }
Exemplo n.º 3
0
        private void btnGenerate_Click(object sender, EventArgs e)
        {
            frmMsgBox msg = new frmMsgBox("信息", "确定要生成代码吗?", MsgboxButtonStyle.YesNoCancel, MsgboxIconStyle.Information);

            if (DialogResult.Yes == msg.ShowDialog())
            {
                GenerateCode        gc        = new GenerateCode();
                CodeGenerateControl cgc       = new CodeGenerateControl();
                List <DataTable>    tableList = cgc.GetTablesInDatabase(GetTableNameList());
                if (string.IsNullOrWhiteSpace(txtFolder.Text) || string.IsNullOrWhiteSpace(txtNameSpace.Text))
                {
                    MessageBox.Show("文件夹或命名空间不能为空");
                    return;
                }

                gc.GenerateClassCode(tableList, txtNameSpace.Text, txtFolder.Text);
            }
        }
Exemplo n.º 4
0
        private void cmbDatabase_SelectedIndexChanged(object sender, EventArgs e)
        {
            CodeGenerateControl codeGenerate = new CodeGenerateControl();

            BindListBox(codeGenerate, this.cmbDatabase.Text);
        }
Exemplo n.º 5
0
 private void BindDatabases(CodeGenerateControl codeGenerate)
 {
     this.cmbDatabase.ValueMember   = "Id";
     this.cmbDatabase.DisplayMember = "Name";
     this.cmbDatabase.DataSource    = codeGenerate.GetDatabases();
 }