private EligibilityRuleSet buildFinalRuleSet(Eligibility_Ruleset ruleSetData) { var aggregator = convertAggregatorIdToEnum(ruleSetData); var eligibilityType = convertEligibilityTypeToEnum(ruleSetData); var finalRuleSet = new EligibilityRuleSet {Aggregator = aggregator, EligibilityType = eligibilityType, Id = ruleSetData.Eligibility_Ruleset_Id}; return finalRuleSet; }
private EligibilityRuleSet buildRuleSet(Eligibility_Ruleset ruleSetData) { if (ruleSetData == null) throw new ArgumentNullException(nameof(ruleSetData)); var finalRuleSet = buildFinalRuleSet(ruleSetData); var rules = _eligibilityRepository.GetRuleSetRules(ruleSetData.Eligibility_Ruleset_Id); addRulesToRuleSet(rules, finalRuleSet); var childRuleSets = _eligibilityRepository.GetChildRuleSets(ruleSetData.Eligibility_Ruleset_Id); addRuleSetsToRuleSet(childRuleSets, finalRuleSet); return finalRuleSet; }
private EligibilityTypeEnum convertEligibilityTypeToEnum(Eligibility_Ruleset ruleSetData) { EligibilityTypeEnum eligibilityType; Enum.TryParse(ruleSetData.Eligibility_Type_Id.ToString(), out eligibilityType); return eligibilityType; }
private EligibilityRuleSetAggregator convertAggregatorIdToEnum(Eligibility_Ruleset ruleSetData) { EligibilityRuleSetAggregator aggregator; Enum.TryParse(ruleSetData.Ruleset_Aggregator_Id.ToString(), out aggregator); return aggregator; }