public bool IsAdultFundedUnemployedWithOtherStateBenefits(ILearningDelivery thisDelivery, ILearner forThisCandidate)
        {
            /*
             * if
             *     // is adult skills
             *     LearningDelivery.FundModel = 35
             *
             *     //  is umemployed (not employed, seeking and available or otherwise)
             *     and     LearnerEmploymentStatus.EmpStat = 11 or 12 for the latest Employment Status on (or before) the LearningDelivery.LearnStartDate
             *
             *             // in receipt of another benefit.
             *     and     ((Monitoring.EmploymentStatus.ESMType = BSI and Monitoring.EmploymentStatus.ESMCode = 3)
             *             or
             *             // in receipt of universal credit.
             *             (Monitoring.EmploymentStatus.ESMType = BSI and Monitoring.EmploymentStatus.ESMCode = 4
             *             // is learning delivery monitored
             *             and LearningDeliveryFAM.LearnDelFAMType = LDM
             *             // and not mandated to skills training
             *             and LearningDeliveryFAM.LearnDelFAMCode <> 318))
             *
             *         set to Y,
             *         otherwise set to N
             */

            var employment = _learnerEmploymentStatusQueryService.LearnerEmploymentStatusForDate(forThisCandidate.LearnerEmploymentStatuses, thisDelivery.LearnStartDate);

            return(thisDelivery.FundModel == FundModels.AdultSkills &&
                   employment != null &&
                   IsNotEmployed(employment) &&
                   (InReceiptOfBenefits(employment) ||
                    (InReceiptOfCredits(employment) &&
                     (NotIsMonitored(thisDelivery.LearningDeliveryFAMs) ||
                      !MandatedToSkillsTraining(thisDelivery.LearningDeliveryFAMs)))));
        }
示例#2
0
        public bool IsAdultFundedUnemployedWithBenefits(ILearningDelivery thisDelivery, ILearner forThisCandidate)
        {
            /*
             *  if
             *      // is adult skills
             *      LearningDelivery.FundModel = 35
             *      // and has valid employment status
             *      and LearnerEmploymentStatus.EmpStat = 10, 11, 12 or 98
             *      // and in receipt of support at the time of starting the learning aim
             *      and (Monitoring.EmploymentStatus.ESMType = BSI and Monitoring.EmploymentStatus.ESMCode = 1 or 2)
             *          (for the learner's Employment status on the LearningDelivery.LearnStartDate of the learning aim)
             *  or
             *      // or is not employed, and in receipt of benefits
             *      LearnerEmploymentStatus.EmpStat = 11 or 12
             *      and (Monitoring.EmploymentStatus.ESMType = BSI and Monitoring.EmploymentStatus.ESMCode = 3 or 4)
             *  or
             *      // or is employed with workng short hours and in receipt of support
             *      LearnerEmploymentStatus.EmpStat = 10
             *      and (Monitoring.EmploymentStatus.ESMType = EII and Monitoring.EmploymentStatus.ESMCode = 2, 5 or 6)
             *      and (Monitoring.EmploymentStatus.ESMType = BSI and Monitoring.EmploymentStatus.ESMCode = 3 or 4)
             *          set to Y,
             *          otherwise set to N
             */

            var employment = _learnerEmploymentStatusQueryService.LearnerEmploymentStatusForDate(forThisCandidate.LearnerEmploymentStatuses, thisDelivery.LearnStartDate);

            return(thisDelivery.FundModel == FundModels.AdultSkills &&
                   employment != null &&
                   (IsValidWithEmploymentSupport(employment) ||
                    IsNotEmployedWithBenefits(employment) ||
                    IsEmployedWithSupport(employment)));
        }
        public void Validate(ILearner objectToValidate)
        {
            var learnRefNumber = objectToValidate.LearnRefNumber;

            var fromDeliveries = objectToValidate.LearningDeliveries.ToReadOnlyCollection();
            var qualifyingAim  = GetQualifyingdAimOn(fromDeliveries);

            if (qualifyingAim == null)
            {
                return;
            }

            var eligibilities = GetEligibilityRulesFor(qualifyingAim);

            if (eligibilities.IsNullOrEmpty())
            {
                return;
            }

            var fromEmployments = objectToValidate.LearnerEmploymentStatuses.ToReadOnlyCollection();
            var employment      = _learnerEmploymentStatusQueryService.LearnerEmploymentStatusForDate(fromEmployments, qualifyingAim.LearnStartDate);

            if (employment == null)
            {
                return;
            }

            if (IsNotValid(eligibilities, employment))
            {
                RaiseValidationMessage(learnRefNumber, qualifyingAim, employment);
            }
        }
示例#4
0
        public bool InReceiptOfAnotherStateBenefit(ILearningDelivery delivery, ILearner learner)
        {
            var candidate = _learnerEmploymentStatusQueryService.LearnerEmploymentStatusForDate(learner.LearnerEmploymentStatuses, delivery.LearnStartDate);

            var esms = candidate?.EmploymentStatusMonitorings.ToReadOnlyCollection();

            return(esms.NullSafeAny(InReceiptOfAnotherStateBenefit));
        }
示例#5
0
        public int?GetLengthOfUnemployment(
            ILearner learner,
            string conRefNumber)
        {
            var delivery = learner?.LearningDeliveries
                           ?.OrderByDescending(x => x.LearnStartDate)
                           .FirstOrDefault(ld => ld.LearnAimRef.CaseInsensitiveEquals(TypeOfAim.References.ESFLearnerStartandAssessment) &&
                                           ld.CompStatus == CompletionState.HasCompleted &&
                                           ld.ConRefNumber.CaseInsensitiveEquals(conRefNumber));

            if (delivery == null)
            {
                return(null);
            }

            var employmentStatusMonitoring = _learnerEmploymentStatusQueryService
                                             .LearnerEmploymentStatusForDate(learner.LearnerEmploymentStatuses, delivery.LearnStartDate)
                                             ?.EmploymentStatusMonitorings?.FirstOrDefault(esm => esm.ESMType.CaseInsensitiveEquals(Monitoring.EmploymentStatus.Types.LengthOfUnemployment));

            return(employmentStatusMonitoring?.ESMCode);
        }
示例#6
0
        public bool LearnerOnBenefitsAtStartOfCompletedZESF0001AimForContract(ILearner learner, string conRefNumber)
        {
            if (learner == null)
            {
                return(false);
            }

            var completedZESF0001AimForContract = GetCompletedZESF0001AimForContract(learner.LearningDeliveries, conRefNumber);

            if (completedZESF0001AimForContract == null)
            {
                return(false);
            }

            var learnerEmploymentStatusForLearnStartDate = _learnerEmploymentStatusQueryService.LearnerEmploymentStatusForDate(learner.LearnerEmploymentStatuses, completedZESF0001AimForContract.LearnStartDate);

            if (learnerEmploymentStatusForLearnStartDate == null)
            {
                return(false);
            }

            return(HasEmploymentStatusMonitoringForTypeBSI(learnerEmploymentStatusForLearnStartDate.EmploymentStatusMonitorings));
        }
示例#7
0
 public ILearnerEmploymentStatus GetEmploymentStatusOn(DateTime thisDate, IReadOnlyCollection <ILearnerEmploymentStatus> fromEmployments) =>
 _learnerEmploymentStatusQueryService.LearnerEmploymentStatusForDate(fromEmployments, thisDate);
示例#8
0
 public bool EmpStatConditionMet(DateTime learnStartDate, IEnumerable <ILearnerEmploymentStatus> learnerEmploymentStatuses)
 {
     return(_learnerEmploymentStatusQueryService.LearnerEmploymentStatusForDate(learnerEmploymentStatuses, learnStartDate)?.EmpStat != EmploymentStatusEmpStats.InPaidEmployment);
 }
示例#9
0
        public bool InReceiptOfBenefits(IReadOnlyCollection <ILearnerEmploymentStatus> learnerEmploymentStatus, DateTime startDate)
        {
            var candidate = _learnerEmploymentStatusQueryService.LearnerEmploymentStatusForDate(learnerEmploymentStatus, startDate);

            return(InReceiptOfBenefits(candidate?.EmploymentStatusMonitorings));
        }
 public bool LearnerNotEmployedOnDate(IEnumerable <ILearnerEmploymentStatus> learnerEmploymentStatuses, DateTime?learningDeliveryFamDateFrom)
 {
     return(learningDeliveryFamDateFrom.HasValue &&
            _learnerEmploymentStatusQueryService.LearnerEmploymentStatusForDate(learnerEmploymentStatuses, learningDeliveryFamDateFrom.Value)?.EmpStat != TypeOfEmploymentStatus.InPaidEmployment);
 }