public Process_CreateDatabase_Timer(CreateDataBase_Form pForm) { m_CreateDataBase_Form = pForm; m_step = Process_CreateDatabase_ENUM.START; }
private void btn_CreateNewDatabase_Click(object sender, EventArgs e) { UpdateConData(); bool bAllreadyExist = false; switch (m_SQL_Connection.DBType) { case DBConnection.eDBType.MYSQL: if (GetMySQLDataBases(ref bAllreadyExist, this.txt_DataBaseName.Text)) { listBox_DataBaseNames.Enabled = true; if (bAllreadyExist) { MessageBox.Show(this,lngConn.s_DataBase.s + this.txt_DataBaseName.Text + lngConn.s_Already_exist.s, lngConn.s_Warning.s, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (txt_UserName.Text.Length > 0) { //Test Connection and rights to create new database CreateMySQLDataBase_Form CreateMySQLDataBaseDialog = new CreateMySQLDataBase_Form(ref m_SQL_Connection); CreateMySQLDataBaseDialog.TopMost = this.TopMost; DialogResult dRes; dRes = CreateMySQLDataBaseDialog.ShowDialog(); if (dRes == DialogResult.OK) { this.txt_DataBaseName.Text = m_SQL_Connection.DataBase; GetDataBaseList(); m_bNewDataBase = true; } } } } else { System.Windows.Forms.MessageBox.Show(this,lngConn.s_Not_EnoughPermissions_To_List_Databases.s, lngConn.s_Warning.s, MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; case DBConnection.eDBType.MSSQL: if (GetMicrosoftSQLDataBases(ref bAllreadyExist, this.txt_DataBaseName.Text)) { listBox_DataBaseNames.Enabled = true; if (bAllreadyExist) { MessageBox.Show(this,lngConn.s_DataBase.s + this.txt_DataBaseName.Text + lngConn.s_Already_exist.s, lngConn.s_Warning.s, MessageBoxButtons.OK, MessageBoxIcon.Warning); } else { if (m_SQL_Connection.WindowsAuthentication) { CreateDataBase_Form CreateDataBaseDialog = new CreateDataBase_Form(ref m_SQL_Connection); CreateDataBaseDialog.TopMost = this.TopMost; DialogResult dRes; dRes = CreateDataBaseDialog.ShowDialog(); if (dRes == DialogResult.OK) { this.txt_DataBaseName.Text = m_SQL_Connection.DataBase; GetDataBaseList(); m_bNewDataBase = true; } } else { if ((txt_UserName.Text.Length > 0) && (txt_Password.Text.Length > 0)) { //Test Connection and rights to create new database CreateDataBase_Form CreateDataBaseDialog = new CreateDataBase_Form(ref m_SQL_Connection); CreateDataBaseDialog.TopMost = this.TopMost; DialogResult dRes; dRes = CreateDataBaseDialog.ShowDialog(); if (dRes == DialogResult.OK) { this.txt_DataBaseName.Text = m_SQL_Connection.DataBase; GetDataBaseList(); } } else { if (txt_UserName.Text.Length == 0) { System.Windows.Forms.MessageBox.Show(this,lngConn.s_User_name_is_missing_Enter_User_Name.s, lngConn.s_Warning.s, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); } else if (txt_Password.Text.Length == 0) { System.Windows.Forms.MessageBox.Show(this,lngConn.s_Password_is_missing_Enter_Password.s, lngConn.s_Warning.s, System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Warning); } } } } } else { System.Windows.Forms.MessageBox.Show(this,lngConn.s_Not_EnoughPermissions_To_List_Databases.s, lngConn.s_Warning.s, MessageBoxButtons.OK, MessageBoxIcon.Warning); } break; } }