BudgetAnalyser.Engine.Services.ReconciliationService.CreateLedgerTransaction C# (CSharp) Méthode

CreateLedgerTransaction() public méthode

public CreateLedgerTransaction ( LedgerEntryLine reconciliation, LedgerEntry ledgerEntry, decimal amount, string narrative ) : LedgerTransaction
reconciliation BudgetAnalyser.Engine.Ledger.LedgerEntryLine
ledgerEntry BudgetAnalyser.Engine.Ledger.LedgerEntry
amount decimal
narrative string
Résultat BudgetAnalyser.Engine.Ledger.LedgerTransaction
        public LedgerTransaction CreateLedgerTransaction(LedgerEntryLine reconciliation, LedgerEntry ledgerEntry,
                                                         decimal amount, string narrative)
        {
            if (reconciliation == null)
            {
                throw new ArgumentNullException(nameof(reconciliation));
            }

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

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

            LedgerTransaction newTransaction = new CreditLedgerTransaction();
            newTransaction.WithAmount(amount).WithNarrative(narrative);
            newTransaction.Date = reconciliation.Date;
            ledgerEntry.AddTransaction(newTransaction);
            return newTransaction;
        }