///<summary>Attempts to connect to the database (via Middle Tier if necessary). ///Returns true if connection settings are valid. Otherwise, false.</summary> private bool IsValidConnection() { SyncModelWithUI(); try { CentralConnections.TryToConnect(Model.CentralConnectionCur, Model.DbType, Model.ConnectionString, noShowOnStartup: (Model.NoShow == YN.Yes), Model.ListAdminCompNames, useDynamicMode: Model.UseDynamicMode, allowAutoLogin: Model.AllowAutoLogin); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } //A successful connection was made using the settings within the current choose database model. return(true); }
internal bool butOK_Click(object sender, EventArgs e) { ChooseDatabaseModel chooseDatabaseModel; _view.TryGetModelFromView(out chooseDatabaseModel); try { CentralConnections.TryToConnect(chooseDatabaseModel.CentralConnectionCur, chooseDatabaseModel.DbType, chooseDatabaseModel.ConnectionString , (chooseDatabaseModel.NoShow == YN.Yes), chooseDatabaseModel.ListAdminCompNames); } catch (Exception ex) { MessageBox.Show(ex.Message); return(false); } //A successful connection was made using the settings within the current choose database model. return(true); }