private void OnCloseAccountScreen(string obj)
 {
     AccountDetails.Clear();
     if (_currentOperationRequest != null)
     {
         _currentOperationRequest.Publish(new AccountData(SelectedAccount));
     }
 }
예제 #2
0
        private void DisplayTransactions()
        {
            var transactionData = _accountService.GetAccountTransactionSummary(SelectedAccount, _applicationState.CurrentWorkPeriod);

            AccountDetails.Clear();
            AccountDetails.AddRange(transactionData.Transactions);
            AccountSummaries.Clear();
            AccountSummaries.AddRange(transactionData.Summaries);

            RaisePropertyChanged(() => TotalBalance);
        }
        private void DisplayTransactions()
        {
            AccountDetails.Clear();
            AccountSummaries.Clear();

            var transactions = Dao.Query(GetCurrentRange(x => x.AccountId == SelectedAccount.Id)).OrderBy(x => x.Date);

            AccountDetails.AddRange(transactions.Select(x => new AccountDetailViewModel(x, SelectedAccount)));

            if (FilterType != Resources.All)
            {
                var pastDebit    = Dao.Sum(x => x.Debit, GetPastRange(x => x.AccountId == SelectedAccount.Id));
                var pastCredit   = Dao.Sum(x => x.Credit, GetPastRange(x => x.AccountId == SelectedAccount.Id));
                var pastExchange = Dao.Sum(x => x.Exchange, GetPastRange(x => x.AccountId == SelectedAccount.Id));
                if (pastCredit > 0 || pastDebit > 0)
                {
                    AccountSummaries.Add(new AccountSummaryViewModel(Resources.Total, AccountDetails.Sum(x => x.Debit), AccountDetails.Sum(x => x.Credit)));
                    var detailValue =
                        new AccountDetailViewModel(new AccountTransactionValue
                    {
                        Name     = Resources.PastTransactions,
                        Credit   = pastCredit,
                        Debit    = pastDebit,
                        Exchange = pastExchange
                    }, SelectedAccount);
                    AccountDetails.Insert(0, detailValue);
                    detailValue.IsBold = true;
                }
            }

            AccountSummaries.Add(new AccountSummaryViewModel(Resources.GrandTotal, AccountDetails.Sum(x => x.Debit), AccountDetails.Sum(x => x.Credit)));

            for (var i = 0; i < AccountDetails.Count; i++)
            {
                AccountDetails[i].Balance = (AccountDetails[i].Debit - AccountDetails[i].Credit);
                if (i > 0)
                {
                    (AccountDetails[i].Balance) += (AccountDetails[i - 1].Balance);
                }
            }

            RaisePropertyChanged(() => TotalBalance);
        }
        private void DisplayTransactions()
        {
            if (FilterType != Resources.Default)
            {
                var dateRange = _accountService.GetDateRange(FilterType, _applicationState.CurrentWorkPeriod);
                Start = dateRange.Start;
                End   = dateRange.End;
            }

            var transactionData = _accountService.GetAccountTransactionSummary(SelectedAccount, _applicationState.CurrentWorkPeriod, Start, End);

            Start = transactionData.Start;
            End   = transactionData.End != transactionData.Start ? transactionData.End : null;

            AccountDetails.Clear();
            AccountDetails.AddRange(transactionData.Transactions);
            AccountSummaries.Clear();
            AccountSummaries.AddRange(transactionData.Summaries);

            RaisePropertyChanged(() => TotalBalance);
        }