public bool Connect() { InitConnection(); if (string.IsNullOrEmpty(_view.ConnectionName) || _connMgr.NameExists(_view.ConnectionName)) { _view.ShowError(ResourceService.GetString("ERR_CONNECTION_NAME_EMPTY_OR_EXISTS")); return(false); } try { _conn.ConnectionString = string.Format("{0}={1};{2}={3};{4}={5};{6}={7}", _view.ServiceParameter, _view.Service, _view.UsernameParameter, _view.Username, _view.PasswordParameter, _view.Password, _view.DataStoreParameter, _view.SelectedDataStore); if (_conn.Open() == FdoConnectionState.Open) { _connMgr.AddConnection(_view.ConnectionName, _conn); return(true); } } catch (Exception ex) { _view.ShowError(ex.Message); } return(false); }
public bool CheckConnectionName() { return(!_connMgr.NameExists(_view.ConnectionName)); }