BalanceAdjustment() 개인적인 메소드

private BalanceAdjustment ( decimal adjustment, string narrative, Account account ) : BankBalanceAdjustmentTransaction
adjustment decimal
narrative string
account Account
리턴 BankBalanceAdjustmentTransaction
        public LedgerTransaction CreateBalanceAdjustment(LedgerEntryLine entryLine, decimal amount, string narrative,
                                                         Account account)
        {
            if (entryLine == null)
            {
                throw new ArgumentNullException(nameof(entryLine));
            }

            if (narrative == null)
            {
                throw new ArgumentNullException(nameof(narrative));
            }

            if (account == null)
            {
                throw new ArgumentNullException(nameof(account));
            }

            var adjustmentTransaction = entryLine.BalanceAdjustment(amount, narrative, account);
            adjustmentTransaction.Date = entryLine.Date;
            return adjustmentTransaction;
        }
        private void PerformBankTransfer(TransferFundsCommand transferDetails, LedgerEntryLine ledgerEntryLine)
        {
            var sourceTransaction = new CreditLedgerTransaction
            {
                Amount = -transferDetails.TransferAmount,
                AutoMatchingReference = transferDetails.AutoMatchingReference,
                Date = ledgerEntryLine.Date,
                Narrative = transferDetails.Narrative
            };

            var destinationTransaction = new CreditLedgerTransaction
            {
                Amount = transferDetails.TransferAmount,
                AutoMatchingReference = transferDetails.AutoMatchingReference,
                Date = ledgerEntryLine.Date,
                Narrative = transferDetails.Narrative
            };

            if (transferDetails.BankTransferRequired)
            {
                ledgerEntryLine.BalanceAdjustment(-transferDetails.TransferAmount, transferDetails.Narrative,
                    transferDetails.FromLedger.StoredInAccount);
                ledgerEntryLine.BalanceAdjustment(transferDetails.TransferAmount, transferDetails.Narrative,
                    transferDetails.ToLedger.StoredInAccount);
                this.transactionRuleService.CreateNewSingleUseRule(
                    transferDetails.FromLedger.BudgetBucket.Code,
                    null,
                    new[] { transferDetails.AutoMatchingReference },
                    null,
                    -transferDetails.TransferAmount,
                    true);
                this.transactionRuleService.CreateNewSingleUseRule(
                    transferDetails.ToLedger.BudgetBucket.Code,
                    null,
                    new[] { transferDetails.AutoMatchingReference },
                    null,
                    transferDetails.TransferAmount,
                    true);
            }

            // No need for a source transaction for surplus ledger.
            if (!(transferDetails.FromLedger.BudgetBucket is SurplusBucket))
            {
                var ledgerEntry = ledgerEntryLine.Entries.Single(e => e.LedgerBucket == transferDetails.FromLedger);
                ledgerEntry.AddTransaction(sourceTransaction);
            }

            // No need for a destination transaction for surplus ledger.
            if (!(transferDetails.ToLedger.BudgetBucket is SurplusBucket))
            {
                var ledgerEntry = ledgerEntryLine.Entries.Single(e => e.LedgerBucket == transferDetails.ToLedger);
                ledgerEntry.AddTransaction(destinationTransaction);
            }
        }