Ejemplo n.º 1
0
        private LearnerType GetLearnerType(string learnerType)
        {
            LearnerType result = LearnerType.ProgrammeOnlyDas;

            switch (learnerType.Replace(" ", string.Empty).ToLowerInvariant())
            {
            case "programmeonlynon-das":
                result = LearnerType.ProgrammeOnlyNonDas;
                break;

            case "programmeonlydas":
                result = LearnerType.ProgrammeOnlyDas;
                break;

            case "16-18programmeonlydas":
                result = LearnerType.ProgrammeOnlyDas16To18;
                break;

            case "16-18programmeonlynon-das":
                result = LearnerType.ProgrammeOnlyNonDas16To18;
                break;

            case "19-24programmeonlynon-das":
                result = LearnerType.ProgrammeOnlyNonDas19To24;
                break;

            case "19-24programmeonlydas":
                result = LearnerType.ProgrammeOnlyDas19To24;
                break;
            }
            return(result);
        }
Ejemplo n.º 2
0
 private static bool IsLearnerTypeLevy(LearnerType learnerType)
 {
     if (learnerType == LearnerType.ProgrammeOnlyDas ||
         learnerType == LearnerType.ProgrammeOnlyDas1618 ||
         learnerType == LearnerType.ProgrammeOnlyDas1924)
     {
         return(true);
     }
     return(false);
 }
Ejemplo n.º 3
0
 private static DateTime GetDateOfBirthBasedOnLearnerType(LearnerType learnerType)
 {
     if (learnerType == LearnerType.ProgrammeOnlyDas1618 || learnerType == LearnerType.ProgrammeOnlyNonDas1618)
     {
         return(DateTime.Today.AddYears(-17));
     }
     if (learnerType == LearnerType.ProgrammeOnlyDas1924 || learnerType == LearnerType.ProgrammeOnlyNonDas1924)
     {
         return(DateTime.Today.AddYears(-20));
     }
     return(DateTime.Today.AddYears(-25));
 }
Ejemplo n.º 4
0
 private DateTime GetDateOfBirth(LearnerType learnerType, DateTime startDate)
 {
     if (learnerType == LearnerType.ProgrammeOnlyDas16To18 || learnerType == LearnerType.ProgrammeOnlyNonDas16To18)
     {
         return(startDate.AddYears(-17));
     }
     else if (learnerType == LearnerType.ProgrammeOnlyDas19To24 || learnerType == LearnerType.ProgrammeOnlyNonDas19To24)
     {
         return(startDate.AddYears(-21));
     }
     else
     {
         return(new DateTime(1985, 10, 10));
     }
 }
Ejemplo n.º 5
0
        private short GetActFamCode(LearnerType learnerType)
        {
            short result = 1;

            switch (learnerType)
            {
            case LearnerType.ProgrammeOnlyDas:
            case LearnerType.ProgrammeOnlyDas16To18:
            case LearnerType.ProgrammeOnlyDas19To24:
                result = 1;
                break;

            default:
                result = 2;
                break;
            }

            return(result);
        }
Ejemplo n.º 6
0
 private static LearningDeliveryFamRecord[] BuildActFamCodes(LearnerType learnerType, DateTime learningStart, DateTime learningEnd, List <ContractTypeReferenceData> contractTypes)
 {
     if (contractTypes.Any())
     {
         return(contractTypes.Select(x => new LearningDeliveryFamRecord
         {
             FamType = FamCodeAct,
             Code = x.ContractType == ContractType.ContractWithEmployer ? FamCodeActDasValue : FamCodeActNonDasValue,
             From = x.DateFrom,
             To = x.DateTo
         }).ToArray());
     }
     return(new[]
     {
         new LearningDeliveryFamRecord
         {
             FamType = FamCodeAct,
             Code = IsLearnerTypeLevy(learnerType) ? FamCodeActDasValue : FamCodeActNonDasValue,
             From = learningStart,
             To = learningEnd
         }
     });
 }
Ejemplo n.º 7
0
        public void SetEmployerLearnersType(string employerName, LearnerType learnersType)
        {
            var employer = Employers.Single(e => e.Name == employerName);

            employer.LearnersType = learnersType;
        }
        private void VerifyEmployerCofinancePayments(long ukprn, long?uln, string periodName, DateTime periodDate, long accountId,
                                                     int colIndex, TableRow employerCofundRow, LearnerType learnersType)
        {
            if (employerCofundRow == null)
            {
                return;
            }

            var employerPaymentDate = periodDate.AddMonths(-1);

            var cofinancePayments = PaymentsDataHelper.GetAccountPaymentsForPeriod(
                ukprn,
                learnersType == LearnerType.ProgrammeOnlyNonDas ?  (long?)null : accountId,
                uln,
                employerPaymentDate.Year,
                employerPaymentDate.Month,
                FundingSource.CoInvestedEmployer,
                learnersType == LearnerType.ProgrammeOnlyNonDas ? ContractType.ContractWithSfa : ContractType.ContractWithEmployer,
                EnvironmentVariables)
                                    ?? new PaymentEntity[0];

            var actualEmployerPayment   = cofinancePayments.Sum(p => p.Amount);
            var expectedEmployerPayment = decimal.Parse(employerCofundRow[colIndex]);

            Assert.AreEqual(expectedEmployerPayment, Math.Round(actualEmployerPayment, 2), $"Expected a employer co-finance payment of {expectedEmployerPayment} but made a payment of {actualEmployerPayment} for {periodName}");
        }