예제 #1
0
        public Money Calculate(ClientQuenstionForm data)
        {
            var c = new BusinessRuleContext();

            foreach (var rule in Rules)
            {
                c.AddRuleResult(rule.Evaluate(data, c));
            }

            return(c.GetLastResult());
        }
예제 #2
0
        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);
        }
예제 #3
0
 public Money Evaluate(ClientQuenstionForm data, BusinessRuleContext context)
 {
     return(context.GetLastResult() + data.MonthlyLivingCosts * CredibilityPolicy.MaxCreditLengthInMonths);
 }
예제 #4
0
 public Money Evaluate(ClientQuenstionForm data, BusinessRuleContext context)
 {
     return(context.GetLastResult() + data.PeopleSupported * (int)(1 - 0.25 * (data.PeopleSupported - 1)));
 }