public void BuildFunc(int investorID, long cashRequestID, RuleType ruleType) { Dictionary <int, InvestorRule> Rules = RulesDAL.GetRules(investorID, ruleType); if ((Rules == null) || Rules.Count == 0) { Func = delegate { return(true); }; return; } Func = ExressionBuilder.CompileRule <T1, T2>(investorID, cashRequestID, Rules); }
private void GetButton_OnClick(object sender, RoutedEventArgs e) { SetUpBL(); if (_rulesBL != null) { RuleAppliedInstance = _rulesBL.GetBaseRuleApplied(RuleAppliedId, _ruleTableSelected); } if (RuleAppliedInstance != null) { var codeIds = new List <int> { RuleAppliedInstance.CodeId }; if (RuleAppliedInstance.ConditionCodeId != null) { codeIds.Add(RuleAppliedInstance.ConditionCodeId.Value); } List <RuleCodeCache> codeMeta = RulesDAL.GetRuleCodeMetaData(codeIds); RulesDAL.GetRuleCode(codeMeta); RuleCodeCache codeCache = codeMeta.FirstOrDefault(c => c.RuleCodeId == RuleAppliedInstance.CodeId); if (codeCache != null) { CodeText = codeCache.CodeText; } if (RuleAppliedInstance.ConditionCodeId != null) { RuleCodeCache condCodeCache = codeMeta.FirstOrDefault(c => c.RuleCodeId == RuleAppliedInstance.ConditionCodeId.Value); if (condCodeCache != null) { CodeConditionText = condCodeCache.CodeText; } } } GUILogging.LogMessage(RuleAppliedInstance != null ? string.Format("RuleApplied {0} found", RuleAppliedInstance.RuleAppliedId) : string.Format("RuleApplied {0} not found", RuleAppliedId)); }