public void addCommission(Securities securities, int count, int expectedValue, CommissionType type) { Commission commisson = new Commission(securities.Name, count, expectedValue, type); if (type == CommissionType.Buy && money < commisson.value() ) { throw new NotEnoughMoneyException("Client hasn't got enough money to buy securities. (" + securities + ", count: " + count + ", expectedValue: " + expectedValue + ")." + this.ToString()); } this.commissions.Add(commisson); securities.bind(new ValueChangeHandler(this, commisson, securities)); }
public ValueChangeHandler(Client client, Commission commission, Securities securities) { this.client = client; this.commission = commission; this.securities = securities; }