Esempio n. 1
0
 public ProcessingEngine(
     IPluginsContainer <ICommandImplementation> commandRepository,
     IPluginsContainer <ICommandObserver> commandObservers,
     ILogProvider logProvider,
     IPersistenceTransaction persistenceTransaction,
     IAuthorizationManager authorizationManager,
     XmlUtility xmlUtility,
     IUserInfo userInfo,
     ISqlUtility sqlUtility,
     ILocalizer localizer)
 {
     _commandRepository         = commandRepository;
     _commandObservers          = commandObservers;
     _logger                    = logProvider.GetLogger("ProcessingEngine");
     _performanceLogger         = logProvider.GetLogger("Performance");
     _requestLogger             = logProvider.GetLogger("ProcessingEngine Request");
     _commandsLogger            = logProvider.GetLogger("ProcessingEngine Commands");
     _commandsResultLogger      = logProvider.GetLogger("ProcessingEngine CommandsResult");
     _commandsClientErrorLogger = logProvider.GetLogger("ProcessingEngine CommandsWithClientError");
     _commandsServerErrorLogger = logProvider.GetLogger("ProcessingEngine CommandsWithServerError");
     _persistenceTransaction    = persistenceTransaction;
     _authorizationManager      = authorizationManager;
     _xmlUtility                = xmlUtility;
     _userInfo                  = userInfo;
     _sqlUtility                = sqlUtility;
     _localizer                 = localizer;
 }
Esempio n. 2
0
 public ProcessingEngine(
     IPluginsContainer<ICommandImplementation> commandRepository,
     IPluginsContainer<ICommandObserver> commandObservers,
     ILogProvider logProvider,
     IPersistenceTransaction persistenceTransaction,
     IAuthorizationManager authorizationManager,
     XmlUtility xmlUtility,
     IUserInfo userInfo,
     ISqlUtility sqlUtility,
     ILocalizer localizer)
 {
     _commandRepository = commandRepository;
     _commandObservers = commandObservers;
     _logger = logProvider.GetLogger("ProcessingEngine");
     _performanceLogger = logProvider.GetLogger("Performance");
     _requestLogger = logProvider.GetLogger("ProcessingEngine Request");
     _commandsLogger = logProvider.GetLogger("ProcessingEngine Commands");
     _commandsResultLogger = logProvider.GetLogger("ProcessingEngine CommandsResult");
     _persistenceTransaction = persistenceTransaction;
     _authorizationManager = authorizationManager;
     _xmlUtility = xmlUtility;
     _userInfo = userInfo;
     _sqlUtility = sqlUtility;
     _localizer = localizer;
 }
 public PrincipalWriter(
     ILogProvider logProvider,
     INamedPlugins <IRepository> repositories,
     GenericRepository <IPrincipal> principalGenericRepository,
     ISqlExecuter sqlExecuter,
     ISqlUtility sqlUtility)
 {
     _logger = logProvider.GetLogger(GetType().Name);
     _principalRepository        = (IQueryableRepository <IPrincipal>)repositories.GetPlugin("Common.Principal");
     _principalGenericRepository = principalGenericRepository;
     _sqlExecuter = sqlExecuter;
     _sqlUtility  = sqlUtility;
 }
Esempio n. 4
0
 public static void WriteToDatabase <TEntity>(
     IEnumerable <TEntity> insertedNew,
     IEnumerable <TEntity> updatedNew,
     IEnumerable <TEntity> deletedIds,
     IPersistenceStorage persistenceStorage,
     bool checkUserPermissions,
     ISqlUtility sqlUtility,
     out Exception saveException,
     out RhetosException interpretedException)
     where TEntity : class, IEntity
 {
     try
     {
         persistenceStorage.Save(insertedNew, updatedNew, deletedIds);
         saveException        = null;
         interpretedException = null;
     }
     catch (NonexistentRecordException nre)
     {
         saveException        = null;
         interpretedException = null;
         if (checkUserPermissions)
         {
             throw new ClientException(nre.Message);
         }
         else
         {
             ExceptionsUtility.Rethrow(nre);
         }
     }
     catch (SqlException e)
     {
         saveException        = e;
         interpretedException = sqlUtility.InterpretSqlException(saveException);
     }
 }
Esempio n. 5
0
        /// <param name="saveException">SqlException, or an exception that has SqlException as an inner exception (directly or indirectly).</param>
        public static void ThrowInterpretedException(bool checkUserPermissions, Exception saveException, RhetosException interpretedException, ISqlUtility sqlUtility, string tableName)
        {
            if (checkUserPermissions)
            {
                MsSqlUtility.ThrowIfPrimaryKeyErrorOnInsert(interpretedException, tableName);
            }
            if (interpretedException != null)
            {
                ExceptionsUtility.Rethrow(interpretedException);
            }
            var sqlException = sqlUtility.ExtractSqlException(saveException);

            if (sqlException != null)
            {
                ExceptionsUtility.Rethrow(sqlException);
            }
            ExceptionsUtility.Rethrow(saveException);
        }
Esempio n. 6
0
 public ProductHelper(IConfiguration configuration, ISqlUtility sqlUtility)
 {
     _configuration = configuration;
     _sqlUtility    = sqlUtility;
 }
 public EmployeeController(IConfiguration configuration, IWebHostEnvironment env, ISqlUtility sqlUtility)
 {
     _configuration = configuration;
     _env           = env;
     _sqlUtility    = sqlUtility;
 }
Esempio n. 8
0
 public DepartmentController(IConfiguration configuration, ISqlUtility sqlUtility)
 {
     _configuration = configuration;
     _sqlUtility    = sqlUtility;
 }