/// <summary> /// SQLServer创建文件按钮 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SqlServerBtnCreateFile_Click(object sender, EventArgs e) { try { SqlServerBtnCreateFile.Text = "生成中...."; SqlServerBtnCreateFile.Enabled = false; SqlServerBLL _bll = new SqlServerBLL(); SqlServerDAL.connectionString = string.Format("Data Source={0};Initial Catalog={1};Persist Security Info=True;User ID={2};Password={3}", SqlServerTextAddress.Text, SqlServerTextName.Text, SqlServerTextAccount.Text, SqlServerTextPassword.Text); SqlServerBLL.ProjectName = SqlServerTextProjectName.Text.Trim(); List <SqlServerTableModel> listM = _bll.GetUserCreateTableInfo(); string path = SqlServerTextCreatePath.Text; IOManager.DeleteDirectory(path); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } DirectoryInfo di = new DirectoryInfo(path); if (SqlServerCheckCSharp.Checked) { _bll.CreateModelFilesByCSharp(listM, di); } if (SqlServerCheckTypeScript.Checked) { _bll.CreateModelFilesByTypeScript(listM, di); } if (SqlServerCheckAngular.Checked) { _bll.CreateModelFilesByAngular(listM, di); } MessageBox.Show("生成成功"); IOManager.OpenExplorer(path); } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { SqlServerBtnCreateFile.Enabled = true; SqlServerBtnCreateFile.Text = "生成"; } }
public DBBLLTests() { SqlServerDAL.connectionString = "Data Source=127.0.0.1;Initial Catalog=DZ_MAS;Persist Security Info=True;User ID=sa;Password=123456"; _bll = new SqlServerBLL(); }