Exemplo n.º 1
0
 public BankAccountRepository(SpaceDbContext spaceDbContext,
                              IMapper mapper,
                              IHttpContextAccessor contextAccessor,
                              ITransactionBankRepository transactionBankRepository) :
     base(spaceDbContext, mapper, contextAccessor, transactionBankRepository)
 {
 }
 public BaseRepositoryWithHistory(SpaceDbContext spaceDbContext,
                                  IMapper mapper,
                                  IHttpContextAccessor contextAccessor,
                                  ITransactionBankRepository transactionBankRepository) : base(spaceDbContext)
 {
     _spaceDbContext            = spaceDbContext;
     _historyDbSet              = _spaceDbContext.Set <ModelHistoryType>();
     _mapper                    = mapper;
     _contextAccessor           = contextAccessor;
     _transactionBankRepository = transactionBankRepository;
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            DbContextOptionsBuilder dbContextOptionsBuilder = new DbContextOptionsBuilder();
            var connection = dbContextOptionsBuilder
                             .UseSqlServer("Server=(localdb)\\MSSQLLocalDB;Database=SpaceWeb;Trusted_Connection=True");

            SpaceDbContext spaceDbContext = new SpaceDbContext(connection.Options);
            ExchangeRateToUsdCurrentRepository exchangeRateToUsdCurrentRepository =
                new ExchangeRateToUsdCurrentRepository(spaceDbContext);
            ExchangeAccountHistoryRepository exchangeAccountHistoryRepository =
                new ExchangeAccountHistoryRepository(spaceDbContext);
            ExchangeRateToUsdHistoryRepository exchangeRateToUsdHistoryRepository =
                new ExchangeRateToUsdHistoryRepository(spaceDbContext);

            var configExpression    = new MapperConfigurationExpression();
            var mapperConfiguration = new MapperConfiguration(configExpression);
            var mapper = new Mapper(mapperConfiguration);

            var contextAccessor = new HttpContextAccessor();

            TransactionBankRepository transactionBankRepository = new TransactionBankRepository(spaceDbContext);
            var          bankAccountRepository = new BankAccountRepository(spaceDbContext, mapper, contextAccessor, transactionBankRepository);
            var          userRepository        = new UserRepository(spaceDbContext, bankAccountRepository);
            IUserService userService           = new UserService(userRepository, contextAccessor);



            var currencyService =
                new CurrencyService(userService,
                                    exchangeRateToUsdCurrentRepository,
                                    exchangeAccountHistoryRepository,
                                    exchangeRateToUsdHistoryRepository,
                                    mapper);

            var currentDate = DateTime.Now;

            while (true)
            {
                if ((currentDate.Minute % 3) == 0)
                {
                    currencyService.MoveCurrentExchangesDbToHistoryDb(exchangeRateToUsdCurrentRepository, exchangeRateToUsdHistoryRepository, mapper);
                    currencyService.DeleteCurrentExchRatesFromDb(exchangeRateToUsdCurrentRepository);
                    currencyService.PutCurrentExchangeRatesToDb(
                        exchangeRateToUsdCurrentRepository,
                        currencyService.GetExchangeRates());
                    Console.Write($"Current exchanges update for History DB at {currentDate}");
                    Thread.Sleep(3 * 59 * 1000); //  59 - because updating exchanges takes ~ 1 second and timer gets a displacement.
                }
                currentDate = DateTime.Now;
                currentDate = currentDate.AddSeconds(-currentDate.Second);
            }
        }
 public InsuranceTypeRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
 public ExchangeRateToUsdHistoryRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
Exemplo n.º 6
0
 public DepartmentRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
Exemplo n.º 7
0
 public BaseRepository(SpaceDbContext spaceDbContext)
 {
     _spaceDbContext = spaceDbContext;
     _dbSet          = _spaceDbContext.Set <ModelType>();
 }
Exemplo n.º 8
0
 public EmployeRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
Exemplo n.º 9
0
 public AdvImageRepository(SpaceDbContext spaceDbContext)
     : base(spaceDbContext)
 {
 }
 public QuestionaryRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
 public ExchangeAccountHistoryRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
Exemplo n.º 12
0
 public ShopRocketRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
 public TransactionBankRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
Exemplo n.º 14
0
 public OrderRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
 public BanksCardRepository(SpaceDbContext spaceDbContext) :
     base(spaceDbContext)
 {
 }
Exemplo n.º 16
0
 public ComfortRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
Exemplo n.º 17
0
 public RocketStageRepository(SpaceDbContext spaceDbContext)
 {
     _spaceDbContext = spaceDbContext;
 }
Exemplo n.º 18
0
 public UserRepository(SpaceDbContext spaceDbContext,
                       IBankAccountRepository bankAccountRepository)
     : base(spaceDbContext)
 {
     _bankAccountRepository = bankAccountRepository;
 }
Exemplo n.º 19
0
 public RelicRepository(SpaceDbContext spaceDbContext)
     : base(spaceDbContext)
 {
 }
Exemplo n.º 20
0
 public PaymentRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
 public ExchangeRateToUsdCurrentRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
Exemplo n.º 22
0
 public AccrualRepository(SpaceDbContext spaceDbContext) : base(spaceDbContext)
 {
 }
Exemplo n.º 23
0
 public AdditionRepository(SpaceDbContext spaceDbContext)
     : base(spaceDbContext)
 {
 }