main
1using solidware.financials.infrastructure;
2using solidware.financials.infrastructure.eventing;
3using solidware.financials.messages;
4using solidware.financials.windows.ui.events;
5using solidware.financials.windows.ui.model;
6
7namespace solidware.financials.windows.ui.presenters
8{
9 public class TaxSummaryPresenter : ObservablePresenter<TaxSummaryPresenter>, TabPresenter, EventSubscriber<IncomeMessage>, EventSubscriber<SelectedFamilyMember>
10 {
11 UICommandBuilder builder;
12 ServiceBus bus;
13
14 public TaxSummaryPresenter(UICommandBuilder builder, ServiceBus bus)
15 {
16 this.builder = builder;
17 this.bus = bus;
18 Family = new TaxesForFamily();
19 }
20
21 public string Header
22 {
23 get { return "Taxes"; }
24 }
25
26 public TaxesForIndividual Individual { get; set; }
27 public TaxesForFamily Family { get; set; }
28
29 public void present()
30 {
31 bus.publish<FindAllIncome>();
32 }
33
34 public void notify(IncomeMessage message)
35 {
36 Family.AddIncomeFor(message.PersonId, message.Amount);
37 update(x => x.Family);
38 }
39
40 public void notify(SelectedFamilyMember message)
41 {
42 Individual = Family.TaxesFor(message.id);
43 update(x => x.Individual);
44 }
45 }
46}