示例#1
0
		private void addRuleSetsToRuleSet(IEnumerable<Eligibility_Ruleset> childRuleSetsData, EligibilityRuleSet finalRuleSet) {
			if (childRuleSetsData == null)
				return;

			var finalChildRuleSets = childRuleSetsData.Select(buildRuleSet); // NOTE: recursive call to buildRuleSet
			foreach (var finalChildRuleSet in finalChildRuleSets)
				finalRuleSet.ChildRuleSets.Add(finalChildRuleSet);
		}
示例#2
0
		private void addRulesToRuleSet(IEnumerable<Eligibility_Rule> rulesData, EligibilityRuleSet finalRuleSet) {
			if (rulesData == null)
				return;

			var eligibilityRules = rulesData.Select(_ruleBuilder.BuildRule);
			foreach (var eligibilityRule in eligibilityRules)
				finalRuleSet.Rules.Add(eligibilityRule);
		}
示例#3
0
		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;
		}
示例#4
0
		private Eligibility_Ruleset mapRuleSetToPoco(RuleContainer ruleContainer, SystemUser user, EligibilityRuleSet ruleSet, int? parentRuleSetId) {
			return new Eligibility_Ruleset {
				Eligibility_Type_Id = (int)ruleSet.EligibilityType,
				Rule_Container_Id = ruleContainer.Id,
				Created_By = user.Id,
				Date_Created = DateTime.Now,
				Is_Deleted = false,
				Ruleset_Aggregator_Id = (int)ruleSet.Aggregator,
				Parent_Ruleset_Id = parentRuleSetId
			};
		}
示例#5
0
		private void deleteRuleSet(EligibilityRuleSet ruleSet) {


			foreach (var rule in ruleSet.Rules) {
				deleteRule(rule);
			}

			foreach (var childRuleSet in ruleSet.ChildRuleSets) {
				deleteRuleSet(childRuleSet);
			}

			_eligibilityRepository.DeleteRuleSet(ruleSet.Id);

			
		}
示例#6
0
		private int saveRuleSet(RuleContainer customer, SystemUser user, EligibilityRuleSet ruleSet, int? parentRuleSetId) {

			var ruleSetPoco = mapRuleSetToPoco(customer, user, ruleSet, parentRuleSetId);
			var ruleSetId = _eligibilityRepository.CreateRuleSet(ruleSetPoco);

			foreach (var rule in ruleSet.Rules) {
				_ruleStorer.SaveRule(user, rule, ruleSetId);
			}

			foreach (var childRuleSet in ruleSet.ChildRuleSets) {
				saveRuleSet(customer, user, childRuleSet, ruleSetId);
			}
			
			return ruleSetId;
		}
示例#7
0
		public virtual int SaveRootRuleSet(RuleContainer customer, SystemUser user, EligibilityRuleSet ruleSet) {
			if (customer == null)
				throw new ArgumentNullException(nameof(customer));
			if (user == null)
				throw new ArgumentNullException(nameof(user));
			if (ruleSet == null)
				throw new ArgumentNullException(nameof(ruleSet));


			try {
				var ruleSetId = saveRuleSet(customer, user, ruleSet, null);
				return ruleSetId;
			}
			catch (Exception e) {
				Console.WriteLine(e);
				throw;
			}
		}
示例#8
0
		public virtual void DeleteRootRuleSet(EligibilityRuleSet ruleSet) {
			if (ruleSet == null)
				throw new ArgumentNullException(nameof(ruleSet));

			deleteRuleSet(ruleSet);
		}