protected override void InitializationComplete() { // init _service = ServiceManager.ConfigureService <CurrencyService>(); _currencyExchangeRateService = ServiceManager.ConfigureService <CurrencyExchangeRateService>(); InitializeViewModel(); }
public ReportDataBuilder(int userId, ITransactionService transactionService, ICurrencyService currencyService, ICurrencyExchangeRateService currencyExchangeRateService, ICategoryService categoryService) { _userId = userId; _transactionService = transactionService; _currencyService = currencyService; _currencyExchangeRateService = currencyExchangeRateService; _categoryService = categoryService; _data = new ReportData(); _categoryLevelMapping = new List <CategoryLevelMapping>(); }
public CalendarDataBuilder(int userId, ITransactionService transactionService, ICurrencyService currencyService, ICurrencyExchangeRateService currencyExchangeRateService, IStorageService storageService, ILimitService limitService, ICategoryService categoryService) { _userId = userId; _transactionService = transactionService; _currencyService = currencyService; _currencyExchangeRateService = currencyExchangeRateService; _storageService = storageService; _limitService = limitService; _categoryService = categoryService; _data = new CalendarData(); }
protected override void InitializationComplete() { // init _service = ServiceManager.ConfigureService <TransactionService>(); _currencyService = ServiceManager.ConfigureService <CurrencyService>(); _storageService = ServiceManager.ConfigureService <StorageService>(); _currencyExchangeRateService = ServiceManager.ConfigureService <CurrencyExchangeRateService>(); _categoryService = ServiceManager.ConfigureService <CategoryService>(); _settingsService = ServiceManager.ConfigureService <ReportSettingService>(); _builder = new ReportDataBuilder(GlobalVariables.UserId, _service, _currencyService, _currencyExchangeRateService, _categoryService); _chartDataBuilder = new ChartDataBuilder(); // init comboboxes comboChartType.ItemsSource = MultiLangEnumHelper.ToCollection(typeof(ChartType)); comboDataType.ItemsSource = MultiLangEnumHelper.ToCollection(typeof(RecordType)); comboBarChartView.ItemsSource = MultiLangEnumHelper.ToCollection(typeof(BarChartView)); comboSorting.ItemsSource = MultiLangEnumHelper.ToCollection(typeof(Sorting)); comboBarChartSection.ItemsSource = MultiLangEnumHelper.ToCollection(typeof(BarChartSection)); // fill PeriodTypes. exclude custom period var values = new List <object>(); foreach (PeriodType enumItem in Enum.GetValues(typeof(PeriodType))) { if (enumItem != PeriodType.Custom) { values.Add(enumItem); } } comboBarChartPeriod.ItemsSource = MultiLangEnumHelper.ToCollection(typeof(PeriodType), values); // fill category levels source lowestCategoryLevel = _categoryService.GetLowestCategoryLevel(GlobalVariables.UserId); var categoryLevelDictionary = new Dictionary <int, string>(); // add variant "All" categoryLevelDictionary.Add(-1, MultiLangResourceManager.Instance[MultiLangResourceName.All]); for (int i = 0; i <= lowestCategoryLevel; i++) { categoryLevelDictionary.Add(i, (i + 1).ToString()); } comboCategoryLevel.ItemsSource = categoryLevelDictionary; InitializeViewModel(); }
internal static List <T> UpdateEventsExchangeRate <T>(ICurrencyExchangeRateService currencyExchangeRateService, List <T> events) where T : EventModel { var currencyExchangeRates = currencyExchangeRateService.GetList(events .Where(x => x.TakeExistingCurrencyExchangeRate && x.IsCurrencyExchangeRateRequired) .Select(x => new[] { x.CurrencyFromId, x.CurrencyToId }) .SelectMany(x => x) .ToList()); // update currency exchange rates for all events foreach (var evnt in events.Where(x => x.TakeExistingCurrencyExchangeRate && x.IsCurrencyExchangeRateRequired).ToList()) { evnt.CurrencyExchangeRate = currencyExchangeRates.FirstOrDefault(x => x.CurrencyFromId == evnt.CurrencyFromId && x.CurrencyToId == evnt.CurrencyToId)?.Rate ?? 1; } return(events); }
public CurrencyExchangeRateDetailsView(ICurrencyExchangeRateService service, CurrencyExchangeRateModel entity, bool isNew, IEnumerable <CurrencyModel> currencies, IEnumerable <CurrencyExchangeRateModel> currencyExchangeRates) : base(service, entity, isNew) { InitializeComponent(); // init _existingCurrencyExchangeRates = currencyExchangeRates; // initialize datacontexts IEnumerable <CurrencyModel> activeCurrencies = currencies.Where(_ => _.IsActive || _.Id == entity.CurrencyFromId || _.Id == entity.CurrencyToId); comboFromCurrencies.ItemsSource = activeCurrencies; comboToCurrencies.ItemsSource = activeCurrencies; // disable currency comboboxes for not new currency exchange rates comboFromCurrencies.IsEnabled = IsNew; comboToCurrencies.IsEnabled = IsNew; // set header and commands panel context LabelHeader.Content = ViewHeader; CommandsPanel.DataContext = Commands; }
public SimpleStorageSummary CalculateSingleCurrencySummary(CurrencyModel currency, ICurrencyExchangeRateService currencyExchangeRateService) { return(CalculateSingleCurrencySummary(currency, currencyExchangeRateService.GetList(_userId, currency.Id))); }
public SimpleStorageSummary CalculateMainCurrencySummary(ICurrencyService currencyService, ICurrencyExchangeRateService currencyExchangeRateService) { return(CalculateSingleCurrencySummary(currencyService.GetMain(_userId), currencyExchangeRateService)); }
public SimpleEventService(ApplicationDbContext context) : base(context) { _currencyExchangeRateService = new CurrencyExchangeRateService(context); }
public LimitService(ApplicationDbContext context) : base(context) { _transactionService = new TransactionService(context); _currencyExchangeRateService = new CurrencyExchangeRateService(context); }
public MoneyTransferEventService(ApplicationDbContext context) : base(context) { _currencyExchangeRateService = new CurrencyExchangeRateService(context); }