public FrameworkSummary MapToFrameworkSummary(FrameworkSearchResultsItem document) { var framework = new FrameworkSummary { Id = document.FrameworkId, Title = document.Title, Level = document.Level, FrameworkCode = document.FrameworkCode, FrameworkName = document.FrameworkName, PathwayCode = document.PathwayCode, PathwayName = document.PathwayName, ProgType = document.ProgType, Duration = document.Duration, FundingPeriods = document.FundingPeriods, CurrentFundingCap = _fundingCapCalculator.CalculateCurrentFundingBand(document), Ssa1 = document.SectorSubjectAreaTier1, Ssa2 = document.SectorSubjectAreaTier2, TypicalLength = new TypicalLength { From = document.Duration, To = document.Duration, Unit = "m" }, EffectiveFrom = document.EffectiveFrom, EffectiveTo = document.EffectiveTo, IsActiveFramework = _activeApprenticeshipChecker.CheckActiveFramework(document.FrameworkId, document.EffectiveFrom, document.EffectiveTo) }; return(framework); }
public Apprenticeship MapFrameworkToApprenticeship(FrameworkSummary frameworkSummary) { return(new Apprenticeship { Code = frameworkSummary.Id, Duration = frameworkSummary.Duration, Price = frameworkSummary.MaxFunding, Name = $"{frameworkSummary.Title} - Level {frameworkSummary.Level}" }); }
public FrameworkCodeSummary MapToFrameworkCodeSummary(FrameworkSummary frameworkSummary) { return(new FrameworkCodeSummary { FrameworkCode = frameworkSummary.FrameworkCode, Ssa1 = frameworkSummary.Ssa1, Ssa2 = frameworkSummary.Ssa2, Title = frameworkSummary.FrameworkName, EffectiveTo = frameworkSummary.EffectiveTo }); }
public ApprenticeshipSummary MapToApprenticeshipSummary(FrameworkSummary document) { return(new ApprenticeshipSummary { Id = document.Id, Uri = document.Uri, Title = document.Title, Duration = document.Duration, Level = document.Level, Ssa1 = document.Ssa1, Ssa2 = document.Ssa2, EffectiveFrom = document.EffectiveFrom, EffectiveTo = document.EffectiveTo, CurrentFundingCap = document.CurrentFundingCap, FundingPeriods = document.FundingPeriods }); }
public List <FrameworkSummary> AggregateFrameworks(List <Project> projects, bool includeTotal) { int total = 0; List <FrameworkSummary> frameworkSummary = new List <FrameworkSummary>(); foreach (Project project in projects) { project.FrameworkFamily = GetFrameworkFamily(project.Framework); if (project.Framework == null) { project.Framework = "(Unknown framework)"; } //Process each indvidual framework FrameworkSummary framework = frameworkSummary.Find(i => i.Framework == project.Framework); //If this framework isn't in the current list, create a new one if (framework == null) { frameworkSummary.Add(new FrameworkSummary { Framework = project.Framework, FrameworkFamily = project.FrameworkFamily, Count = 1 //it's the first time, start with a count of 1 }); } else { //There is an existing entry, increment the count framework.Count++; } total++; } List <FrameworkSummary> sortedFrameworks = frameworkSummary.OrderBy(o => o.Framework).ToList(); if (includeTotal == true) { sortedFrameworks.Add(new FrameworkSummary { Framework = "total frameworks", Count = total }); } return(sortedFrameworks); }
public FrameworkSummary MapToFrameworkSummary(FrameworkSearchResultsItem document) { var framework = new FrameworkSummary { Id = document.FrameworkId, Title = document.Title, Level = document.Level, FrameworkCode = document.FrameworkCode, FrameworkName = document.FrameworkName, PathwayCode = document.PathwayCode, PathwayName = document.PathwayName, ProgType = document.ProgType, Duration = document.Duration, MaxFunding = document.FundingCap, TypicalLength = new TypicalLength { From = document.Duration, To = document.Duration, Unit = "m" } }; return(framework); }
private static bool IsFrameworkActive(FrameworkSummary framework) { return(framework.EffectiveFrom.HasValue && framework.EffectiveFrom.Value.Date <= DateTime.UtcNow.Date && (!framework.EffectiveTo.HasValue || framework.EffectiveTo.Value.Date >= DateTime.UtcNow.Date)); }