public Money Calculate(ClientQuenstionForm data) { var c = new BusinessRuleContext(); foreach (var rule in Rules) { c.AddRuleResult(rule.Evaluate(data, c)); } return(c.GetLastResult()); }
public Money Calculate(ClientQuenstionForm data) { Money m = 0; // Rule 1 - income m += data.MonthlyIncome * MaxCreditLengthInMonths; // Rule 2 - car costs m -= data.MonthlyCarCosts * MaxCreditLengthInMonths; // Rule 3 - living costs m -= data.MonthlyLivingCosts * MaxCreditLengthInMonths; // Rule 4 - people supported m *= (1 - 0.25m * (data.PeopleSupported - 1)); return(m); }
public Money Evaluate(ClientQuenstionForm data, BusinessRuleContext context) { return(context.GetLastResult() + data.MonthlyLivingCosts * CredibilityPolicy.MaxCreditLengthInMonths); }
public Money Evaluate(ClientQuenstionForm data, BusinessRuleContext context) { return(context.GetLastResult() + data.PeopleSupported * (int)(1 - 0.25 * (data.PeopleSupported - 1))); }