示例#1
0
        public ReconcileBalanceViewModel(
            ILoggerFactory loggerFactory,
            IAccountService accountService,
            ICurrencyService currencyService,
            ITransactionService transactionService,
            IAccountLinkViewModelFactory accountLinkViewModelFactory,
            IForeignAmountViewService foreignAmountViewService,
            int accountId)
        {
            m_logger                      = loggerFactory.CreateLogger <ReconcileBalanceViewModel>();
            m_accountService              = accountService;
            m_currencyService             = currencyService;
            m_transactionService          = transactionService;
            m_accountLinkViewModelFactory = accountLinkViewModelFactory;
            m_foreignAmountViewService    = foreignAmountViewService;

            m_accountId           = accountId;
            m_primaryCurrencyCode = m_currencyService.GetPrimary().ShortName;
            m_accountCurrencyCode = m_accountService.Get(m_accountId).Currency.ShortName;

            m_openingBalance = m_targetBalance = m_accountService.GetBalance(m_accountId, true);
            m_at             = DateTime.Now;

            IEnumerable <AccountLink>           accountLinks          = m_accountService.GetAllAsLinks().Where(al => al.Type == AccountType.Income);
            IEnumerable <IAccountLinkViewModel> accountLinkViewModels =
                accountLinks.Select(al => m_accountLinkViewModelFactory.Create(al));

            Accounts = new ObservableCollection <IAccountLinkViewModel>(accountLinkViewModels.OrderBy(alvm => alvm.Name));
            m_selectedCreditAccount = Accounts.FirstOrDefault();
        }
示例#2
0
 public ReconcileBalanceViewModelFactory(
     ILoggerFactory loggerFactory,
     IAccountService accountService,
     ICurrencyService currencyService,
     ITransactionService transactionService,
     IAccountLinkViewModelFactory accountLinkViewModelFactory,
     IForeignAmountViewService foreignAmountViewService)
 {
     m_loggerFactory               = loggerFactory;
     m_accountService              = accountService;
     m_currencyService             = currencyService;
     m_transactionService          = transactionService;
     m_accountLinkViewModelFactory = accountLinkViewModelFactory;
     m_foreignAmountViewService    = foreignAmountViewService;
 }