public TransactionCreateViewModel( ILoggerFactory loggerFactory, IAccountService accountService, ITransactionService transactionService, IAccountLinkViewModelFactory accountLinkViewModelFactory, Transaction hint) : base(accountService, transactionService, accountLinkViewModelFactory, 0) { m_logger = loggerFactory.CreateLogger <TransactionCreateViewModel>(); if (hint != null) { m_selectedCreditAccount = Accounts.Single(a => a.AccountId == hint.CreditAccount.AccountId); m_selectedDebitAccount = Accounts.Single(a => a.AccountId == hint.DebitAccount.AccountId); } else { m_selectedCreditAccount = Accounts .FirstOrDefault(a => a.Type == AccountType.Capital || a.Type == AccountType.Income); m_selectedDebitAccount = Accounts .FirstOrDefault(a => a.Type == AccountType.Asset || a.Type == AccountType.Expense); } m_amount = 0m; m_at = DateTime.Now; }
public TransactionItemViewModelFactory( ILoggerFactory loggerFactory, IAccountLinkViewModelFactory accountLinkViewModelFactory) { m_loggerFactory = loggerFactory; m_accountLinkViewModelFactory = accountLinkViewModelFactory; }
public AccountRelationshipItemViewModelFactory( ILoggerFactory loggerFactory, IAccountLinkViewModelFactory accountLinkViewModelFactory) { m_loggerFactory = loggerFactory; m_accountLinkViewModelFactory = accountLinkViewModelFactory; }
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(); }
internal StubAccountRelationshipItemViewModel( IAccountLinkViewModelFactory accountLinkViewModelFactory, AccountRelationship accountRelationship) { m_accountRelationship = accountRelationship; m_sourceAccount = accountLinkViewModelFactory.Create(m_accountRelationship.SourceAccount); m_destinationAccount = accountLinkViewModelFactory.Create(m_accountRelationship.DestinationAccount); }
internal StubAccountTransactionItemViewModel( IAccountLinkViewModelFactory viewModelFactory, Transaction transaction) { m_transaction = transaction; m_balance = 0; m_creditAccount = viewModelFactory.Create(m_transaction.CreditAccount); m_debitAccount = viewModelFactory.Create(m_transaction.DebitAccount); }
public TransactionDetailsViewModelFactory( ILoggerFactory loggerFactory, IAccountService accountService, ITransactionService transactionService, IAccountLinkViewModelFactory accountLinkViewModelFactory) { m_loggerFactory = loggerFactory; m_accountService = accountService; m_transactionService = transactionService; m_accountLinkViewModelFactory = accountLinkViewModelFactory; }
public AccountRelationshipItemViewModel( ILoggerFactory loggerFactory, IAccountLinkViewModelFactory accountlinkViewModelFactory, AccountRelationship accountRelationship) { m_logger = loggerFactory.CreateLogger <AccountRelationshipItemViewModel>(); m_accountLinkViewModelFactory = accountlinkViewModelFactory; AccountRelationshipId = accountRelationship.AccountRelationshipId; SourceAccount = m_accountLinkViewModelFactory.Create(accountRelationship.SourceAccount); DestinationAccount = m_accountLinkViewModelFactory.Create(accountRelationship.DestinationAccount); Type = accountRelationship.Type; }
public TransactionItemViewModel( ILoggerFactory loggerFactory, IAccountLinkViewModelFactory accountLinkViewModelFactory, Transaction transaction) { m_logger = loggerFactory.CreateLogger <TransactionItemViewModel>(); m_accountLinkViewModelFactory = accountLinkViewModelFactory; TransactionId = transaction.TransactionId; CreditAccount = m_accountLinkViewModelFactory.Create(transaction.CreditAccount); DebitAccount = m_accountLinkViewModelFactory.Create(transaction.DebitAccount); At = transaction.At; Amount = transaction.Amount; }
public BudgetTransactionListViewModelFactory( ILoggerFactory loggerFactory, IAccountService accountService, IBudgetService budgetService, IAccountLinkViewModelFactory accountLinkViewModelFactory, IBudgetTransactionItemViewModelFactory budgetTransactionItemViewModelFactory, IDeleteConfirmationViewService deleteConfirmationViewService) { m_loggerFactory = loggerFactory; m_accountService = accountService; m_budgetService = budgetService; m_accountLinkViewModelFactory = accountLinkViewModelFactory; m_budgetTransactionItemViewModelFactory = budgetTransactionItemViewModelFactory; m_deleteConfirmationViewService = deleteConfirmationViewService; }
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; }
public TransactionEditViewModel( ILoggerFactory loggerFactory, IAccountService accountService, ITransactionService transactionService, IAccountLinkViewModelFactory accountLinkViewModelFactory, int transactionId) : base(accountService, transactionService, accountLinkViewModelFactory, transactionId) { m_logger = loggerFactory.CreateLogger <TransactionEditViewModel>(); Transaction transaction = m_transactionService.Get(m_transactionId); m_selectedCreditAccount = Accounts.Single(a => a.AccountId == transaction.CreditAccount.AccountId); m_selectedDebitAccount = Accounts.Single(a => a.AccountId == transaction.DebitAccount.AccountId); m_amount = transaction.Amount; m_at = transaction.At; }
protected TransactionDetailsBaseViewModel( IAccountService accountService, ITransactionService transactionService, IAccountLinkViewModelFactory accountLinkViewModelFactory, int transactionId) { m_accountService = accountService; m_transactionService = transactionService; m_accountLinkViewModelFactory = accountLinkViewModelFactory; m_transactionId = transactionId; IEnumerable <AccountLink> accountLinks = m_accountService.GetAllAsLinks(); IEnumerable <IAccountLinkViewModel> accountLinkViewModels = accountLinks.Select(al => m_accountLinkViewModelFactory.Create(al)); Accounts = new ObservableCollection <IAccountLinkViewModel>(accountLinkViewModels.OrderBy(alvm => alvm.Name)); }
public BudgetTransactionListViewModel( ILoggerFactory loggerFactory, IAccountService accountService, IBudgetService budgetService, IAccountLinkViewModelFactory accountLinkViewModelFactory, IBudgetTransactionItemViewModelFactory budgetTransactionItemViewModelFactory, IDeleteConfirmationViewService deleteConfirmationViewService, int budgetId) { m_logger = loggerFactory.CreateLogger <BudgetTransactionListViewModel>(); m_accountService = accountService; m_budgetService = budgetService; m_accountLinkViewModelFactory = accountLinkViewModelFactory; m_budgetTransactionItemViewModelFactory = budgetTransactionItemViewModelFactory; m_deleteConfirmationViewService = deleteConfirmationViewService; m_accountLinks = new ObservableCollection <IAccountLinkViewModel>( m_accountService .GetAllAsLinks() .OrderBy(al => al.Name) .Select(al => m_accountLinkViewModelFactory.Create(al))); m_budgetId = budgetId; if (m_budgetId == 0) { int firstIncomeAccountId = 0; int firstAssetAccountId = 0; int secondAssetAccountId = 0; IAccountLinkViewModel firstIncomeAccount = m_accountLinks.FirstOrDefault(al => al.Type == AccountType.Income); IAccountLinkViewModel firstAssetAccount = m_accountLinks.FirstOrDefault(al => al.Type == AccountType.Asset); IAccountLinkViewModel secondAssetAccount = m_accountLinks.Where(al => al.Type == AccountType.Asset) .ElementAtOrDefault(1); if (firstIncomeAccount != null) { firstIncomeAccountId = firstIncomeAccount.AccountId; } if (firstAssetAccount != null) { firstAssetAccountId = secondAssetAccount.AccountId; } if (secondAssetAccount != null) { secondAssetAccountId = secondAssetAccount.AccountId; } var transactions = new List <IBudgetTransactionItemViewModel>(); BudgetTransaction initialTransaction = new BudgetTransaction { CreditAccount = new AccountLink { AccountId = firstIncomeAccountId }, DebitAccount = new AccountLink { AccountId = firstAssetAccountId }, Amount = 0 }; BudgetTransaction surplusTransaction = new BudgetTransaction { CreditAccount = new AccountLink { AccountId = firstAssetAccountId }, DebitAccount = new AccountLink { AccountId = secondAssetAccountId }, Amount = 0 }; transactions.Add(CreateItemViewModel(initialTransaction, BudgetTransactionType.Initial)); transactions.Add(CreateItemViewModel(surplusTransaction, BudgetTransactionType.Surplus)); Transactions = new ObservableCollection <IBudgetTransactionItemViewModel>(transactions); } else { Budget budget = m_budgetService.Get(m_budgetId); var transactions = new List <IBudgetTransactionItemViewModel>(); transactions.Add(CreateItemViewModel(budget.InitialTransaction, BudgetTransactionType.Initial)); transactions.AddRange( budget.Transactions.Select(t => CreateItemViewModel(t, BudgetTransactionType.Regular)) ); transactions.Add(CreateItemViewModel(budget.SurplusTransaction, BudgetTransactionType.Surplus)); Transactions = new ObservableCollection <IBudgetTransactionItemViewModel>(transactions); } CalculateSurplusAmount(); }