Ejemplo n.º 1
0
        public static async Task DeleteTransaction(FinancialTransaction transaction, bool skipConfirmation = false)
        {
            if (skipConfirmation || await Utilities.IsDeletionConfirmed())
            {
                await CheckForRecurringTransaction(transaction,
                                                   () => RecurringTransactionLogic.Delete(transaction.RecurringTransaction));

                TransactionRepository.Delete(transaction);

                await AccountLogic.RemoveTransactionAmount(transaction);

                AccountLogic.RefreshRelatedTransactions();
                ServiceLocator.Current.GetInstance <BalanceViewModel>().UpdateBalance();
            }
        }
Ejemplo n.º 2
0
        public static async Task UpdateTransaction(FinancialTransaction transaction)
        {
            CheckIfRecurringWasRemoved(transaction);
            await AccountLogic.AddTransactionAmount(transaction);

            TransactionRepository.Save(transaction);

            RecurringTransaction recurringTransaction =
                RecurringTransactionLogic.GetRecurringFromFinancialTransaction(transaction);

            await
            CheckForRecurringTransaction(transaction,
                                         () => RecurringTransactionRepository.Save(recurringTransaction));

            AccountLogic.RefreshRelatedTransactions();
        }
Ejemplo n.º 3
0
        public static async Task SaveTransaction(FinancialTransaction transaction, bool refreshRelatedList = false,
                                                 bool skipRecurring = false)
        {
            if (transaction.IsRecurring && !skipRecurring)
            {
                RecurringTransaction recurringTransaction =
                    RecurringTransactionLogic.GetRecurringFromFinancialTransaction(transaction);
                RecurringTransactionRepository.Save(recurringTransaction);
                TransactionRepository.Save(transaction);
                transaction.RecurringTransaction = recurringTransaction;
            }

            TransactionRepository.Save(transaction);

            if (refreshRelatedList)
            {
                ServiceLocator.Current.GetInstance <TransactionListViewModel>()
                .SetRelatedTransactions(AccountRepository.Selected);
            }
            await AccountLogic.AddTransactionAmount(transaction);
        }