コード例 #1
0
        public void Validate(ILearner learner)
        {
            if (learner?.LearningDeliveries == null)
            {
                return;
            }

            foreach (var learningDelivery in learner.LearningDeliveries)
            {
                var latestLearningStart = _derivedData22.GetLatestLearningStartForESFContract(learningDelivery, learner.LearningDeliveries);

                var localAuthorities = _fcsDataService.GetEligibilityRuleLocalAuthoritiesFor(learningDelivery.ConRefNumber);

                if (!localAuthorities.Any())
                {
                    break;
                }

                var allOnsPostCodes = _postcodeService.GetONSPostcodes(learningDelivery.DelLocPostCode);
                var onsPostcodesMatchinglocalAuthorities = allOnsPostCodes.Where(pc => localAuthorities.Any(la => la.Code.CaseInsensitiveEquals(pc.LocalAuthority)));

                if (ConditionMetDD22Exists(latestLearningStart) &&
                    ConditionMetStartDate(learningDelivery.LearnStartDate) &&
                    ConditionMetFundModel(learningDelivery.FundModel) &&
                    (ConditionMetONSPostcode(latestLearningStart, onsPostcodesMatchinglocalAuthorities) ||
                     ConditionMetLocalAuthority(localAuthorities, allOnsPostCodes)))
                {
                    HandleValidationError(
                        learner.LearnRefNumber,
                        learningDelivery.AimSeqNumber,
                        BuildErrorMessageParameters(learningDelivery));
                }
            }
        }
        public void Validate(ILearner learner)
        {
            if (learner?.LearnerEmploymentStatuses == null)
            {
                return;
            }

            if (learner?.LearningDeliveries == null)
            {
                return;
            }

            foreach (var learningDelivery in learner.LearningDeliveries)
            {
                if (learningDelivery.FundModel != FundModel)
                {
                    continue;
                }

                DateTime?latestLearningStart =
                    _derivedData22.GetLatestLearningStartForESFContract(learningDelivery, learner.LearningDeliveries);
                if (!latestLearningStart.HasValue)
                {
                    continue;
                }

                if (GetQualifyingEmploymentStatus(learner, latestLearningStart) == EmploymentStatusEmpStats.NotKnownProvided)
                {
                    HandleValidationError(
                        learner.LearnRefNumber,
                        learningDelivery.AimSeqNumber,
                        BuildErrorMessageParameters(latestLearningStart));
                }
            }
        }
コード例 #3
0
        public void Validate(ILearner learner)
        {
            if (learner?.LearningDeliveries == null)
            {
                return;
            }

            foreach (var learningDelivery in learner.LearningDeliveries)
            {
                var latestLearningStart = _derivedData22.GetLatestLearningStartForESFContract(learningDelivery, learner.LearningDeliveries);

                var partnerships = _fcsDataService.GetEligibilityRuleEnterprisePartnershipsFor(learningDelivery.ConRefNumber);

                if (!partnerships.Any())
                {
                    break;
                }

                var onsPostCode = _postcodeService.GetONSPostcodes(learningDelivery.DelLocPostCode);

                if (ConditionMetDD22Exists(latestLearningStart) &&
                    ConditionMetStartDate(learningDelivery.LearnStartDate) &&
                    ConditionMetFundModel(learningDelivery.FundModel) &&
                    ConditionMetLearnAimRef(learningDelivery.LearnAimRef) &&
                    ConditionMetTemporaryPostcode(learningDelivery.DelLocPostCode) &&
                    (ConditionMetONSPostcode(latestLearningStart, onsPostCode) ||
                     ConditionMetPartnership(partnerships, onsPostCode)))
                {
                    HandleValidationError(
                        learner.LearnRefNumber,
                        learningDelivery.AimSeqNumber,
                        BuildErrorMessageParameters(learningDelivery));
                }
            }
        }
コード例 #4
0
        public void Validate(ILearner learner)
        {
            if (learner?.LearningDeliveries == null)
            {
                return;
            }

            foreach (var learningDelivery in learner.LearningDeliveries)
            {
                if (learningDelivery.LearnStartDate > _ruleEndDate)
                {
                    continue;
                }

                if (learningDelivery.FundModel != FundModel ||
                    learningDelivery.LearnAimRef.CaseInsensitiveEquals(TypeOfAim.References.ESFLearnerStartandAssessment) ||
                    learningDelivery.DelLocPostCode.CaseInsensitiveEquals(ValidationConstants.TemporaryPostCode))
                {
                    continue;
                }

                var partnerships = _fcsDataService.GetEligibilityRuleEnterprisePartnershipsFor(learningDelivery.ConRefNumber);
                if (partnerships == null || partnerships.All(la => string.IsNullOrEmpty(la.Code?.Trim())))
                {
                    continue;
                }

                var onsPostCodes = _postcodeService.GetONSPostcodes(learningDelivery.DelLocPostCode);
                if ((onsPostCodes?.Count ?? 0) == 0)
                {
                    continue;
                }

                DateTime?latestLearningStart =
                    _derivedData22.GetLatestLearningStartForESFContract(learningDelivery, learner.LearningDeliveries);
                if (!latestLearningStart.HasValue)
                {
                    continue;
                }

                if (PostcodesContainValidPostcode(latestLearningStart, onsPostCodes))
                {
                    continue;
                }

                if (partnerships.Any(
                        eli => onsPostCodes.Any(pc => (pc.Lep1.CaseInsensitiveEquals(eli.Code) || pc.Lep2.CaseInsensitiveEquals(eli.Code)) &&
                                                CheckQualifyingPeriod(latestLearningStart, pc))))
                {
                    HandleValidationError(
                        learner.LearnRefNumber,
                        learningDelivery.AimSeqNumber,
                        BuildErrorMessageParameters(learningDelivery));
                }
            }
        }
コード例 #5
0
 public DateTime?GetStartFor(ILearningDelivery thisDelivery, IReadOnlyCollection <ILearningDelivery> usingSources) =>
 _derivedData22.GetLatestLearningStartForESFContract(thisDelivery, usingSources);
 /// <summary>
 /// Gets the contract completion date.
 /// </summary>
 /// <param name="delivery">The delivery.</param>
 /// <param name="usingSources">The using sources.</param>
 /// <returns>the latest completion date for the contract (if there is one)</returns>
 public DateTime?GetContractCompletionDate(ILearningDelivery delivery, IReadOnlyCollection <ILearningDelivery> usingSources) =>
 _derivedData22.GetLatestLearningStartForESFContract(delivery, usingSources);