private static RuleDef AbsoluteMaxAmount(int amountLimit)
 {
     return
         ((
              from amount in Dsl.GetAmount <Unit>()
              select new Amount(Math.Min(amount, amountLimit))
              ).Apply());
 }
Exemple #2
0
 private static RuleExprAst <int> MaxTotalDebt(int debtLimit)
 {
     return
         (from amount in Dsl.GetAmount()
          from creditA in Dsl.GetValue("CreditA")
          from creditB in Dsl.GetValue("CreditB")
          let totalCredit = creditA + creditB
                            select totalCredit > debtLimit ? 0 : amount);
 }
 private static RuleDef MaxAmountPerApplicant(int amountLimit, int ageLimit)
 {
     return
         ((
              from amount in Dsl.GetAmount <string>()
              from age in Variables.Age.Value
              where age < ageLimit
              select new Amount(Math.Min(amount, amountLimit))
              ).Lift());
 }
 private static RuleDef MaxAmountForAge(int amountLimit, int ageLimit)
 {
     return
         ((
              from amount in Dsl.GetAmount <Unit>()
              from ages in Variables.Age.Values
              where ages.Max() < ageLimit
              select new Amount(Math.Min(amount, amountLimit))
              ).Apply());
 }
Exemple #5
0
 private static RuleExprAst <int> AbsoluteMaxAmount(int amountLimit)
 {
     return
         (from amount in Dsl.GetAmount()
          select Math.Min(amount, amountLimit));
 }