Esempio n. 1
0
        // *** Conditions for Provider DataLock ***
        // 1. ZPROG001 reference
        // 2. PriceEpisode.StartDate <= NextPayment.DueDate => PriceEpisode.EndDate
        // 3. Period.Period == NextPayment.CollectionPeriod
        // 4. Period.ApprenticeshipId == ApprenticeshipIncentive.ApprenticeshipId
        // 5. Period.IsPayable == false
        public static bool HasProviderDataLocks(this LearnerSubmissionDto data, Domain.ApprenticeshipIncentives.ApprenticeshipIncentive incentive)
        {
            if (incentive == null)
            {
                return(false);
            }
            var nextPayment = incentive.NextDuePayment;

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

            var hasLock = data
                          .PaymentsForApprenticeship(incentive.Apprenticeship.Id, nextPayment.DueDate)
                          .Any(p => p.Period == nextPayment.PeriodNumber && !p.IsPayable);

            return(hasLock);
        }
Esempio n. 2
0
        public static LearningFoundStatus LearningFound(this LearnerSubmissionDto data, Domain.ApprenticeshipIncentives.ApprenticeshipIncentive incentive)
        {
            if (data.Training == null || !data.Training.Any())
            {
                return(new LearningFoundStatus("No learning aims were found"));
            }

            if (data.Training.All(t => t.Reference != PROGRAM_REFERENCE))
            {
                return(new LearningFoundStatus("Learning aims were found for the ULN, but none of them had a reference of ZPROG001"));
            }

            if (!data.Training.Any(t => t.Reference == PROGRAM_REFERENCE && t.PriceEpisodes.Count > 0))
            {
                return(new LearningFoundStatus("A ZPROG001 aim was found, but it had no price episodes"));
            }

            if (!data.PaymentsForApprenticeship(incentive.Apprenticeship.Id).Any())
            {
                return(new LearningFoundStatus("A ZPROG001 aim was found, with price episodes, but with no periods with the apprenticeship id that matches the commitment"));
            }

            return(new LearningFoundStatus());
        }