public FlightPriceController() { _pathMapper = new ServerPathMapper(); _flightPricesRepository = new FlightCsvRepository("prices", _pathMapper); _currencyRateRepository = new CurrencyRateCsvRepository("currencies", _defaultCurrency, _pathMapper); _dataSanitizer = new FlightDataSanitizer(); _priceRangeCalculator = new FlightDataCalculator(_dataSanitizer); }
public FlightPriceController(IPathMapper pathmapper, IFlightPricesRepository flightPricesRepository, ICurrencyRateRepository currencyRateRepository, IDataSanitizer <Flight> dataSanitizer, IPriceRangeCalculator <Flight> priceRangeCalculator) { _pathMapper = pathmapper; _flightPricesRepository = flightPricesRepository; _currencyRateRepository = currencyRateRepository; _dataSanitizer = dataSanitizer; _priceRangeCalculator = priceRangeCalculator; }
/// <summary> /// Tries to find currency rate for the specified currencies. /// </summary> /// <param name="repository"> /// The currency rates repository. /// </param> /// <param name="currencyCode"> /// The currency code. /// </param> /// <param name="targetCurrencyCode"> /// The target currency code. /// </param> /// <returns> /// The currency rate or <b>null</b> if a rate not found. /// </returns> private static CurrencyRate GetCurrencyRate( ICurrencyRateRepository repository, int currencyCode, int targetCurrencyCode) { return(repository.FirstOrDefault( r => r.Currency.Code == currencyCode && r.TargetCurrency.Code == targetCurrencyCode, r => r.Currency, r => r.TargetCurrency)); }
public CurrencyAppService( ICurrencyRepository currRepository, ICurrencyRateRepository currRateRepository, IBankApiService bankService, IUnitOfWork unitOfWork) { this.currRepository = currRepository; this.currRateRepository = currRateRepository; this.bankService = bankService; this.unitOfWork = unitOfWork; }
public MainWindowViewModel( ICurrencyCodeRepository currencyCodeRepository, ICurrencyRateRepository currencyRateRepository ) { this.currencyCodeRepository = currencyCodeRepository; this.currencyRateRepository = currencyRateRepository; CurrencyCodes = new ObservableCollection <CurrencyCode>(); CurrencyRates = new ObservableCollection <CurrencyRate>(); SearchResults = new ObservableCollection <SearchResult>(); LoadCurrencyCodesAsync(); LoadCurrencyRatesAsync(); }
public CurrencyRateService( ILogger <ICurrencyRateRepository> logger, ICurrencyRateRepository currencyRateRepository, IApiCurrencyRateRequestModelValidator currencyRateModelValidator, IBOLCurrencyRateMapper bolcurrencyRateMapper, IDALCurrencyRateMapper dalcurrencyRateMapper, IBOLSalesOrderHeaderMapper bolSalesOrderHeaderMapper, IDALSalesOrderHeaderMapper dalSalesOrderHeaderMapper) : base(logger, currencyRateRepository, currencyRateModelValidator, bolcurrencyRateMapper, dalcurrencyRateMapper, bolSalesOrderHeaderMapper, dalSalesOrderHeaderMapper) { }
public AbstractCurrencyRateService( ILogger logger, ICurrencyRateRepository currencyRateRepository, IApiCurrencyRateRequestModelValidator currencyRateModelValidator, IBOLCurrencyRateMapper bolCurrencyRateMapper, IDALCurrencyRateMapper dalCurrencyRateMapper, IBOLSalesOrderHeaderMapper bolSalesOrderHeaderMapper, IDALSalesOrderHeaderMapper dalSalesOrderHeaderMapper) : base() { this.currencyRateRepository = currencyRateRepository; this.currencyRateModelValidator = currencyRateModelValidator; this.bolCurrencyRateMapper = bolCurrencyRateMapper; this.dalCurrencyRateMapper = dalCurrencyRateMapper; this.bolSalesOrderHeaderMapper = bolSalesOrderHeaderMapper; this.dalSalesOrderHeaderMapper = dalSalesOrderHeaderMapper; this.logger = logger; }
/// <summary> /// Returns the album price in the specified currency and price level. /// </summary> /// <param name="albumPriceRepository"> /// The repository. /// </param> /// <param name="currencyRatesRepository"> /// The currency rates repository. /// </param> /// <param name="albumId"> /// The album id. /// </param> /// <param name="currencyCode"> /// The currency code. /// </param> /// <param name="priceLevelId"> /// The price level id. /// </param> /// <returns> /// The album price in the specified currency and price level or <b>null</b>. /// </returns> internal static PriceViewModel GetAlbumPrice( IAlbumPriceRepository albumPriceRepository, ICurrencyRateRepository currencyRatesRepository, int albumId, int currencyCode, int priceLevelId) { var price = albumPriceRepository.FirstOrDefault( p => p.AlbumId == albumId && p.PriceLevelId == priceLevelId && p.Currency.Code == currencyCode, p => p.Album, p => p.Currency, p => p.PriceLevel); // if price is not exist for the specified currency then we'll try to find price in any other currency if (price == null) { price = albumPriceRepository.FirstOrDefault( p => p.AlbumId == albumId && p.PriceLevelId == priceLevelId, p => p.Currency); if (price != null) { PriceViewModel targetPrice; if (TryConvertToTargetPrice( currencyRatesRepository, price.Price, price.Currency.Code, currencyCode, out targetPrice)) { return(targetPrice); } } } return(ModelsMapper.GetPriceViewModel(price)); }
/// <summary> /// Tries to convert price to price in the specified currency via a cross-cource. /// </summary> /// <param name="repository"> /// The currency rates repository. /// </param> /// <param name="amount"> /// The price amount. /// </param> /// <param name="currencyCode"> /// The currency code. /// </param> /// <param name="targetCurrencyCode"> /// The target currency code. /// </param> /// <param name="targetPrice"> /// The convertion result. /// </param> internal static bool TryConvertToTargetPrice( ICurrencyRateRepository repository, decimal amount, int currencyCode, int targetCurrencyCode, out PriceViewModel targetPrice) { var rate = GetCurrencyRate(repository, currencyCode, targetCurrencyCode); if (rate != null) { targetPrice = new PriceViewModel { // financial rounding to even Amount = Math.Round(rate.CrossCourse * amount, 2, MidpointRounding.ToEven), Currency = ModelsMapper.GetCurrencyViewModel(rate.TargetCurrency) }; return(true); } targetPrice = null; return(false); }
public EveryDayCurrencyRatesJob(ICurrencyRateRepository currencyRateRepository, IPrivat24Factory privat24Factory, ILogger <EveryDayCurrencyRatesJob> log) { _logger = log; _currencyRateRepository = currencyRateRepository; _privat24Api = privat24Factory.CreatePublicClient(); }
public CurrencyRateManager(ICurrencyRateRepository repo) { this._currencyRateRepository = repo; }
public ApiCurrencyRateRequestModelValidator(ICurrencyRateRepository currencyRateRepository) : base(currencyRateRepository) { }
public ConvertService(ICurrencyRateRepository currencyRateRepository) { this._currencyRateRepository = currencyRateRepository; }
public AbstractApiCurrencyRateRequestModelValidator(ICurrencyRateRepository currencyRateRepository) { this.currencyRateRepository = currencyRateRepository; }
public CurrencyManager(ICurrencyRepository currencyRepository, ICurrencyRateRepository currencyRateRepository) { _currencyRepository = currencyRepository ?? throw new ArgumentNullException(nameof(currencyRepository)); _currencyRateRepository = currencyRateRepository ?? throw new ArgumentNullException(nameof(currencyRateRepository)); }
public CurrencyRateController(ICurrencyRateRepository repository) => this.repository = repository;
public ExchangeProvider( ICurrencyRateRepository cacheRepository, ILogger <ExchangeProvider> logger) => (_cacheRepository, _logger) = (cacheRepository, logger);
public CurrencyConvertor(ICurrencyRateRepository currencyRateRepository) { m_oCurrencyRateRepository = currencyRateRepository; } // constructor
public CurrencyRateApplicationService(ILogger <CurrencyRateApplicationService> logger, ICurrencyRateRepository currencyRateRepository) { _logger = logger; _currencyRateRepository = currencyRateRepository; }
public CurrencyRateService(ICurrencyRateRepository currencyRateRepository) { _currencyRateRepository = currencyRateRepository; }
public CurrencyRateManager(ICurrencyRateRepository currencyRateRepository, ICurrencyRateCacher currencyRateCacher) { _currencyRateRepository = currencyRateRepository; _currencyRateCacher = currencyRateCacher; }