Esempio n. 1
0
 protected override void InitializationComplete()
 {
     // init
     _service = ServiceManager.ConfigureService <CurrencyService>();
     _currencyExchangeRateService = ServiceManager.ConfigureService <CurrencyExchangeRateService>();
     InitializeViewModel();
 }
Esempio n. 2
0
 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>();
 }
Esempio n. 3
0
 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();
 }
Esempio n. 4
0
        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();
        }
Esempio n. 5
0
        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);
        }
Esempio n. 6
0
        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;
        }
Esempio n. 7
0
 public SimpleStorageSummary CalculateSingleCurrencySummary(CurrencyModel currency,
                                                            ICurrencyExchangeRateService currencyExchangeRateService)
 {
     return(CalculateSingleCurrencySummary(currency,
                                           currencyExchangeRateService.GetList(_userId, currency.Id)));
 }
Esempio n. 8
0
 public SimpleStorageSummary CalculateMainCurrencySummary(ICurrencyService currencyService,
                                                          ICurrencyExchangeRateService currencyExchangeRateService)
 {
     return(CalculateSingleCurrencySummary(currencyService.GetMain(_userId), currencyExchangeRateService));
 }
 public SimpleEventService(ApplicationDbContext context) : base(context)
 {
     _currencyExchangeRateService = new CurrencyExchangeRateService(context);
 }
Esempio n. 10
0
 public LimitService(ApplicationDbContext context) : base(context)
 {
     _transactionService          = new TransactionService(context);
     _currencyExchangeRateService = new CurrencyExchangeRateService(context);
 }
 public MoneyTransferEventService(ApplicationDbContext context) : base(context)
 {
     _currencyExchangeRateService = new CurrencyExchangeRateService(context);
 }