public ITransactionManager CreateManager() { SchedulerDatabaseConnection connection = new SchedulerDatabaseConnection(_connectionString); if (connection.State != System.Data.ConnectionState.Open) { try { connection.Open(); } catch (Exception e) { throw new SchedulerException(SchedulerExceptionType.DatabaseConnectionFailed, e.Message); } } return(new TransactionManager(connection)); }
protected void SetConnection2Account(String accountName, bool isReadOnly = false) { if (isReadOnly) { //_databaseConnection = new SchedulerDatabaseConnection(ConfigurationManager.ConnectionStrings["IDSDatabaseRO"].ConnectionString); _databaseConnection = new SchedulerDatabaseConnection(GlobalContext.ApplicationSetting.CSRO); } if (_databaseConnection.State != System.Data.ConnectionState.Open) { try { _databaseConnection.Open(); } catch (Exception e) { throw new SchedulerException(SchedulerExceptionType.DatabaseConnectionFailed, e.Message); } } _databaseConnection.Connect2Account(accountName); _currentMode = ConnectionMode.Account; }