//Handles the loan LoanElectedWithHoldsEvent by firing a work item to WFM private void HandleLoanElectedWithHoldsEvent(PaymentEvent paymentEvent) { Trace.WriteLine("Handlinge LoanElectedWithHoldsEvent..."); workforceClient.PublishWorkItem(paymentEvent); paymentEvent.MarkAsHandled(); dbContext.SaveChanges(); }
//Handles the PaymentCreatedEvent by starting eligibility. private void HandlePaymentCreatedEvent(PaymentEvent paymentEvent) { Trace.WriteLine("Handling PaymentCreatedEvent..."); var payment = dbContext .Payments .Where(x=>x.PaymentId == paymentEvent.PaymentId) .First(); var loan = new Loan(true); payment.ElectLoan(loan); paymentEvent.MarkAsHandled(); dbContext.SaveChanges(); }
//Handles the EligiblePaymentEvent by forwarding it out over the service bus. private void HandlePaymentEligibleEvent(PaymentEvent paymentEvent) { Trace.WriteLine("Handlinge PaymentEligibleEvent..."); serviceBusClient.Publish(paymentEvent); paymentEvent.MarkAsHandled(); dbContext.SaveChanges(); }