コード例 #1
0
 private static RuleDef AbsoluteMaxAmount(int amountLimit)
 {
     return
         ((
              from amount in Dsl.GetAmount <Unit>()
              select new Amount(Math.Min(amount, amountLimit))
              ).Apply());
 }
コード例 #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);
 }
コード例 #3
0
 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());
 }
コード例 #4
0
 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());
 }
コード例 #5
0
 private static RuleExprAst <int> AbsoluteMaxAmount(int amountLimit)
 {
     return
         (from amount in Dsl.GetAmount()
          select Math.Min(amount, amountLimit));
 }