private bool OpenManager(IDbConsoleProvider _Provider) { ConnectionStringForm _constrForm = new ConnectionStringForm(); _constrForm.ShowDialog(); if (!_constrForm.IsOk) { return(false); } m_Manager = new DbConsoleManager(_Provider); try { m_Manager.Open(_constrForm.ConnectionString); } catch (Exception ex) { ShowErrorMessage(ex.Message, "Open connection"); m_Manager = null; return(false); } ShowInformationMessage(string.Format("Connection with '{0}' completed.", _constrForm.ConnectionString), "Open connection"); ConnectionStatusLabel.Text = _constrForm.ConnectionString; BeginButton.Enabled = true; ValidateExecuteButtonState(); return(true); }
private bool OpenManager(IDbConsoleProvider _Provider) { MyConnectionStringForm _constrForm; if (m_provider.MySqlProvider) { _constrForm = new MySqlConnectionStringForm(); } else if (m_provider.PostgreSqlProvider) { _constrForm = new PostgreSqlConnectionStringForm(); } else { _constrForm = new ConnectionStringForm(); } _constrForm.ShowDialog(); if (!_constrForm.IsOk()) { return(false); } m_Manager = new DbConsoleManager(_Provider); try { m_Manager.Open(_constrForm.ConnectionString()); } catch (Exception ex) { ShowErrorMessage(ex.Message, "Открытие соединения"); m_Manager = null; return(false); } ShowInformationMessage(string.Format("Соединение с '{0}' выполнено.", _constrForm.ConnectionString()), "Открытие соединения"); ConnectionStatusLabel.Text = _constrForm.ConnectionString(); BeginButton.Enabled = true; ValidateExecuteButtonState(); return(true); }