コード例 #1
0
        public void Validate(ILearner objectToValidate)
        {
            if (objectToValidate.LearningDeliveries == null ||
                LearnerConditionMet(objectToValidate.DateOfBirthNullable))
            {
                return;
            }

            foreach (var learningDelivery in objectToValidate.LearningDeliveries)
            {
                DateTime?dd04Date           = _dd04.Derive(objectToValidate.LearningDeliveries, learningDelivery);
                DateTime sixteenthBirthDate = _datetimeQueryService.DateAddYears((DateTime)objectToValidate.DateOfBirthNullable, 16);
                DateTime lastFridayInJuneForAcademicYear = _academicYearQueryService.LastFridayInJuneForDateInAcademicYear(sixteenthBirthDate);

                if (ConditionMet(learningDelivery.ProgTypeNullable, dd04Date, lastFridayInJuneForAcademicYear))
                {
                    HandleValidationError(objectToValidate.LearnRefNumber, learningDelivery.AimSeqNumber, BuildErrorMessageParameters(objectToValidate.DateOfBirthNullable, learningDelivery.LearnStartDate));
                }
            }
        }