示例#1
0
 /// <summary>
 /// Processes a specific transaction if the transaction needs to be processed.
 /// </summary>
 /// <param name="transaction">The transaction.</param>
 public void ProcessIfNeeded(TransactionEntity transaction)
 {
     if (transaction.NeedsProcessing())
     {
         this.Process(transaction);
     }
 }
示例#2
0
        /// <summary>
        /// Processes a category change for a transaction.
        /// This does not alter account balances and does not send an update to Splitwise.
        /// </summary>
        /// <param name="transaction">The transaction.</param>
        /// <param name="newCategoryId">The new category identifier.</param>
        public void ChangeCategory(TransactionEntity transaction, int newCategoryId)
        {
            var personalAmount = transaction.PersonalAmount;

            if (transaction.Processed)
            {
                this.RevertBudgets(transaction.CategoryId.Value, transaction.Date, personalAmount);
            }

            if (transaction.NeedsProcessing())
            {
                this.ProcessBudgets(newCategoryId, transaction.Date, personalAmount);
            }

            transaction.CategoryId = newCategoryId;
        }