public void Apply(IncomeOccurredEvent @event) { var holding = _Holdings[@event.Stock]; if (holding == null) { throw new NoSharesOwnedException("No shares owned"); } var incomeReceived = new IncomeReceived { Id = @event.TransactionId, Date = @event.Date, Stock = holding.Stock, Comment = @event.Comment, RecordDate = @event.RecordDate, FrankedAmount = @event.FrankedAmount, UnfrankedAmount = @event.UnfrankedAmount, FrankingCredits = @event.FrankingCredits, Interest = @event.Interest, TaxDeferred = @event.TaxDeferred, CreateCashTransaction = @event.CreateCashTransaction, DrpCashBalance = @event.DrpCashBalance }; var handler = _TransactionHandlers.GetService <IncomeReceived>(); handler.Apply(incomeReceived, holding, _CashAccount); _Transactions.Add(incomeReceived); }
public void IncomeReceived(Guid stockId, Date recordDate, Date paymentDate, decimal frankedAmount, decimal unfrankedAmount, decimal frankingCredits, decimal interest, decimal taxDeferred, decimal drpCashBalance, bool createCashTransaction, string comment, Guid transactionId) { var @event = new IncomeOccurredEvent(Id, Version, transactionId, paymentDate, stockId, comment) { RecordDate = recordDate, FrankedAmount = frankedAmount, UnfrankedAmount = unfrankedAmount, FrankingCredits = frankingCredits, Interest = interest, TaxDeferred = taxDeferred, CreateCashTransaction = createCashTransaction, DrpCashBalance = drpCashBalance }; Apply(@event); PublishEvent(@event); }