/// <summary>
        /// Validates the specified object.
        /// </summary>
        /// <param name="objectToValidate">The object to validate.</param>
        public void Validate(ILearner objectToValidate)
        {
            It.IsNull(objectToValidate)
            .AsGuard <ArgumentNullException>(nameof(objectToValidate));

            var learnRefNumber = objectToValidate.LearnRefNumber;

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

            if (It.IsNull(qualifyingAim))
            {
                return;
            }

            var eligibilities = GetEligibilityRulesFor(qualifyingAim);

            if (It.IsEmpty(eligibilities))
            {
                return;
            }

            var fromEmployments = objectToValidate.LearnerEmploymentStatuses.AsSafeReadOnlyList();
            var employment      = _check.GetEmploymentStatusOn(qualifyingAim.LearnStartDate, fromEmployments);

            if (It.IsNull(employment))
            {
                return;
            }

            if (IsNotValid(eligibilities, employment))
            {
                RaiseValidationMessage(learnRefNumber, qualifyingAim, employment);
            }
        }
        /// <summary>
        /// In receipt of another state benefit.
        /// </summary>
        /// <param name="delivery">The delivery.</param>
        /// <param name="learner">The learner.</param>
        /// <returns>
        /// true if the learner is in receipt at the start of the learning aim
        /// </returns>
        public bool InReceiptOfAnotherStateBenefit(ILearningDelivery delivery, ILearner learner)
        {
            var candidate = _check.GetEmploymentStatusOn(delivery.LearnStartDate, learner.LearnerEmploymentStatuses);

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

            return(esms.SafeAny(InReceiptOfAnotherStateBenefit));
        }
Exemple #3
0
        /// <summary>
        /// Determines whether [is adult funded unemployed with other state benefits] [this delivery].
        /// </summary>
        /// <param name="thisDelivery">This delivery.</param>
        /// <param name="forThisCandidate">For this candidate.</param>
        /// <returns>
        ///   <c>true</c> if [is adult funded unemployed with other state benefits] [this delivery]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsAdultFundedUnemployedWithOtherStateBenefits(ILearningDelivery thisDelivery, ILearner forThisCandidate)
        {
            It.IsNull(thisDelivery)
            .AsGuard <ArgumentNullException>(nameof(thisDelivery));
            It.IsNull(forThisCandidate)
            .AsGuard <ArgumentNullException>(nameof(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 = _check.GetEmploymentStatusOn(thisDelivery.LearnStartDate, forThisCandidate.LearnerEmploymentStatuses);

            return(_check.HasQualifyingFunding(thisDelivery, TypeOfFunding.AdultSkills) &&
                   It.Has(employment) &&
                   IsNotEmployed(employment) &&
                   (InReceiptOfBenefits(employment) ||
                    (InReceiptOfCredits(employment) &&
                     (NotIsMonitored(thisDelivery.LearningDeliveryFAMs) ||
                      !MandatedToSkillsTraining(thisDelivery.LearningDeliveryFAMs)))));
        }
Exemple #4
0
        /// <summary>
        /// Determines whether [is adult skills unemployed with benefits] [this delivery].
        /// </summary>
        /// <param name="thisDelivery">This delivery.</param>
        /// <param name="forThisCandidate">For this candidate.</param>
        /// <returns>
        ///   <c>true</c> if [is adult skills unemployed with benefits] [this delivery]; otherwise, <c>false</c>.
        /// </returns>
        public bool IsAdultFundedUnemployedWithBenefits(ILearningDelivery thisDelivery, ILearner forThisCandidate)
        {
            It.IsNull(thisDelivery)
            .AsGuard <ArgumentNullException>(nameof(thisDelivery));
            It.IsNull(forThisCandidate)
            .AsGuard <ArgumentNullException>(nameof(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 = _check.GetEmploymentStatusOn(thisDelivery.LearnStartDate, forThisCandidate.LearnerEmploymentStatuses);

            return(_check.HasQualifyingFunding(thisDelivery, TypeOfFunding.AdultSkills) &&
                   It.Has(employment) &&
                   (IsValidWithEmploymentSupport(employment) ||
                    IsNotEmployedWithBenefits(employment) ||
                    IsEmployedWithSupport(employment)));
        }
 /// <summary>
 /// Gets the employment status on (this date) (from employments).
 /// </summary>
 /// <param name="thisDate">this date.</param>
 /// <param name="fromEmployments">from employments.</param>
 /// <returns>the closest learner employmentstatus for the learn start date</returns>
 public ILearnerEmploymentStatus GetEmploymentStatusOn(DateTime thisDate, IReadOnlyCollection <ILearnerEmploymentStatus> fromEmployments) =>
 _check.GetEmploymentStatusOn(thisDate, fromEmployments);
Exemple #6
0
        /// <summary>
        /// In receipt of benefits.
        /// </summary>
        /// <param name="learnerEmploymentStatus">The learner employment status.</param>
        /// <param name="startDate">The start date.</param>
        /// <returns>
        /// true, if on state benefits at start of learning aim
        /// </returns>
        public bool InReceiptOfBenefits(IReadOnlyCollection <ILearnerEmploymentStatus> learnerEmploymentStatus, DateTime startDate)
        {
            var candidate = _check.GetEmploymentStatusOn(startDate, learnerEmploymentStatus);

            return(InReceiptOfBenefits(candidate?.EmploymentStatusMonitorings));
        }