public void Validate(ILearner objectToValidate)
        {
            foreach (var learningDelivery in objectToValidate.LearningDeliveries)
            {
                var dd18Date = _derivedData18.GetApprenticeshipStandardProgrammeStartDateFor(learningDelivery, objectToValidate.LearningDeliveries);

                if (dd18Date == null)
                {
                    continue;
                }

                if (ConditionMet(
                        learningDelivery.ProgTypeNullable,
                        learningDelivery.AimType,
                        learningDelivery.StdCodeNullable,
                        dd18Date.Value,
                        learningDelivery.LearningDeliveryFAMs))
                {
                    HandleValidationError(
                        objectToValidate.LearnRefNumber,
                        learningDelivery.AimSeqNumber,
                        BuildErrorMessageParameters(learningDelivery.StdCodeNullable));
                }
            }
        }
コード例 #2
0
        public void Validate(ILearner objectToValidate)
        {
            if (objectToValidate?.LearningDeliveries == null || !objectToValidate.DateOfBirthNullable.HasValue)
            {
                return;
            }

            var sixteenthBirthDate = objectToValidate.DateOfBirthNullable.Value.AddYears(16);
            var lastFridayInJuneForAcademicYear = _academicYearQueryService.LastFridayInJuneForDateInAcademicYear(sixteenthBirthDate);

            foreach (var learningDelivery in objectToValidate.LearningDeliveries)
            {
                DateTime?dd18Date = _derivedData18.GetApprenticeshipStandardProgrammeStartDateFor(learningDelivery, objectToValidate.LearningDeliveries);

                if (ConditionMet(
                        learningDelivery.ProgTypeNullable,
                        dd18Date,
                        lastFridayInJuneForAcademicYear))
                {
                    HandleValidationError(objectToValidate.LearnRefNumber, learningDelivery.AimSeqNumber);
                }
            }
        }
コード例 #3
0
 /// <summary>
 /// Gets the start for.
 /// </summary>
 /// <param name="thisDelivery">this delivery.</param>
 /// <param name="usingSources">using sources.</param>
 /// <returns>a start date for a standard apprecticehsip aim (or null for others)</returns>
 public DateTime?GetStartFor(ILearningDelivery thisDelivery, IReadOnlyCollection <ILearningDelivery> usingSources) =>
 _derivedData18.GetApprenticeshipStandardProgrammeStartDateFor(thisDelivery, usingSources);