private void AddQualificationsToFrameworks(LarsMetaData metaData) { foreach (var framework in metaData.Frameworks) { var frameworkAims = metaData.FrameworkAims.Where(x => x.FworkCode.Equals(framework.FworkCode) && x.ProgType.Equals(framework.ProgType) && x.PwayCode.Equals(framework.PwayCode)).ToList(); frameworkAims = frameworkAims.Where(x => x.EffectiveTo >= DateTime.Now || x.EffectiveTo == null || IsSpecialFramework($"{x.FworkCode}-{x.ProgType}-{x.PwayCode}")).ToList(); var qualifications = (from aim in frameworkAims join comp in metaData.FrameworkContentTypes on aim.ApprenticeshipComponentType equals comp.ApprenticeshipComponentType join ld in metaData.LearningDeliveries on aim.LearnAimRef equals ld.LearnAimRef select new FrameworkQualification { Title = ld.LearnAimRefTitle.Replace("(QCF)", string.Empty).Trim(), LearnAimRef = aim.LearnAimRef, CompetenceType = comp.ApprenticeshipComponentType, CompetenceDescription = comp.ApprenticeshipComponentTypeDesc }).ToList(); // Determine if the qualifications are funded or not by the apprenticeship scheme DetermineQualificationFundingStatus(qualifications, metaData.Fundings); // Only show funded qualifications qualifications = qualifications.Where(x => x.IsFunded).ToList(); var categorisedQualifications = GetCategorisedQualifications(qualifications); framework.CompetencyQualification = categorisedQualifications.Competency; framework.KnowledgeQualification = categorisedQualifications.Knowledge; framework.CombinedQualification = categorisedQualifications.Combined; } }
private void AddDurationAndFundingToFrameworks(LarsMetaData metaData) { foreach (var framework in metaData.Frameworks) { var fw = metaData.ApprenticeshipFundings.FirstOrDefault(fwk => fwk.ApprenticeshipType.ToLower() == "fwk" && fwk.ApprenticeshipCode == framework.FworkCode && fwk.ProgType == framework.ProgType && fwk.PwayCode == framework.PwayCode && fwk.EffectiveFrom.HasValue && fwk.EffectiveFrom.Value.Date <= DateTime.UtcNow.Date && (!fwk.EffectiveTo.HasValue || fwk.EffectiveTo.Value.Date >= DateTime.UtcNow.Date)); if (fw == null) { continue; } framework.Duration = fw.ReservedValue1; framework.FundingCap = fw.MaxEmployerLevyCap; } }
private void AddDurationAndFundingToStandards(ICollection <LarsStandard> standards, LarsMetaData metaData) { foreach (var std in standards) { var fundingBands = metaData.ApprenticeshipFundings.Where(stdrd => stdrd.ApprenticeshipType.ToLower() == "std" && stdrd.ApprenticeshipCode == std.Id && stdrd.EffectiveFrom.HasValue && stdrd.EffectiveFrom.Value.Date != DateTime.MinValue.Date).ToList(); if (!fundingBands.Any()) { continue; } std.Duration = fundingBands.First().ReservedValue1; std.FundingPeriods = new List <FundingPeriod>(); foreach (var apprenticeshipFundingMetaData in fundingBands) { var fundingPeriod = new FundingPeriod { FundingCap = apprenticeshipFundingMetaData.MaxEmployerLevyCap, EffectiveFrom = apprenticeshipFundingMetaData.EffectiveFrom, EffectiveTo = apprenticeshipFundingMetaData.EffectiveTo }; std.FundingPeriods.Add(fundingPeriod); } std.FundingCap = fundingBands.Last(x => x.EffectiveFrom <= DateTime.Today).MaxEmployerLevyCap; } }