示例#1
0
        public ValidationResult Validate(Learner learner)
        {
            var result = new ValidationResult()
            {
                IsValid = true
            };

            var validLearningDeliveries = _r105PickLdFamACTTypes.Evaluate(learner);

            if (validLearningDeliveries == null)
            {
                return(result);
            }

            foreach (var learningDelivery in validLearningDeliveries)
            {
                if (!_learningDeliveryNoOverlappingDatesRule.Evaluate(learningDelivery))
                {
                    continue;
                }

                //if found a record that has overlapping dates then return false
                result.IsValid       = false;
                result.ErrorMessages = new List <string>()
                {
                    ErrorMessage
                };
                return(result);
            }

            return(result);
        }
示例#2
0
        public void Validate(MessageLearner learner)
        {
            var validLearningDeliveriesFAMs = _r105PickLdFamACTTypes.Evaluate(learner);

            if (validLearningDeliveriesFAMs == null)
            {
                return;
            }


            if (_learningDeliveryNoOverlappingDatesRule.Evaluate(validLearningDeliveriesFAMs))
            {
                //if found a record that has overlapping dates then return false
                _validationErrorHandler.Handle(learner, RuleNameConstants.R105);
                return;
            }
        }