Exemple #1
0
 /// <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    = "生成";
     }
 }
Exemple #2
0
        public void GetUserCreateTableInfoTest()
        {
            List <SqlServerTableModel> listM = _bll.GetUserCreateTableInfo();

            Assert.IsTrue(listM != null && listM.Count > 0);
        }