public void AddLearningDeliveryFam(LearningDeliveryFam learningDeliveryFam) { var fams = LearningDeliveryFams?.ToList() ?? new List <LearningDeliveryFam>(); fams.Add(learningDeliveryFam); LearningDeliveryFams = fams.ToArray(); }
private void BuildContractTypes(Table table) { for (var rowIndex = 0; rowIndex < table.RowCount; rowIndex++) { var famCode = new LearningDeliveryFam { FamCode = table.Rows[rowIndex]["contract type"] == "DAS" ? 1 : 2, StartDate = DateTime.Parse(table.Rows[rowIndex]["date from"]), EndDate = DateTime.Parse(table.Rows[rowIndex]["date to"]), FamType = "ACT" }; StepDefinitionsContext.ReferenceDataContext.AddLearningDeliveryFam(famCode); } }
private void BuildLearningSupportRecords(Table table) { for (var rowIndex = 0; rowIndex < table.RowCount; rowIndex++) { var famCode = new LearningDeliveryFam { FamCode = table.Rows[rowIndex].Value <int>("Learning support code"), StartDate = DateTime.Parse(table.Rows[rowIndex].Value <string>("date from")), EndDate = DateTime.Parse(table.Rows[rowIndex].Value <string>("date to")), FamType = "LSF" }; StepDefinitionsContext.ReferenceDataContext.AddLearningDeliveryFam(famCode); } }
protected void SetupContexLearners(Table table) { if (table.Header.Contains("Employment Status") && StepDefinitionsContext.ReferenceDataContext.EmploymentStatuses == null) { PopulateEmploymentStatuses(table); } for (var rowIndex = 0; rowIndex < table.RowCount; rowIndex++) { var provider = table.ContainsColumn("Provider") ? table.Rows[rowIndex]["Provider"] : "provider"; if (table.Header.Contains("LearnDelFAM") && !string.IsNullOrEmpty(table.Rows[rowIndex]["LearnDelFAM"])) { var famValue = table.Rows[rowIndex]["LearnDelFAM"]; var famCode = new LearningDeliveryFam { FamType = famValue.Substring(0, 3), FamCode = int.Parse(famValue.Substring(3)) }; StepDefinitionsContext.ReferenceDataContext.AddLearningDeliveryFam(famCode); } var learningDelivery = new LearningDelivery { LearningDeliveryFams = StepDefinitionsContext.ReferenceDataContext.LearningDeliveryFams, LearnerType = table.Header.Contains("learner type") ? GetLearnerType(table.Rows[rowIndex]["learner type"]) : LearnerType.ProgrammeOnlyDas, StartDate = DateTime.Parse(table.Rows[rowIndex]["start date"]), PlannedEndDate = table.Header.Contains("planned end date") ? DateTime.Parse(table.Rows[rowIndex]["planned end date"]) : DateTime.Parse(table.Rows[rowIndex]["start date"]).AddMonths(12), ActualEndDate = !table.Header.Contains("actual end date") || string.IsNullOrWhiteSpace(table.Rows[rowIndex]["actual end date"]) ? null : (DateTime?)DateTime.Parse(table.Rows[rowIndex]["actual end date"]), CompletionStatus = table.Header.Contains("completion status") ? IlrTranslator.TranslateCompletionStatus(table.Rows[rowIndex]["completion status"]) : CompletionStatus.Continuing, FrameworkCode = table.Rows[rowIndex].Value <int>("framework code") > 0 ? table.Rows[rowIndex].Value <int>("framework code") : IlrBuilder.Defaults.FrameworkCode, ProgrammeType = table.Rows[rowIndex].Value <int>("programme type") > 0 ? table.Rows[rowIndex].Value <int>("programme type") : IlrBuilder.Defaults.ProgrammeType, PathwayCode = table.Rows[rowIndex].Value <int>("pathway code") > 0 ? table.Rows[rowIndex].Value <int>("pathway code") : IlrBuilder.Defaults.PathwayCode, Type = table.Rows[rowIndex].Contains("aim type") ? GetAimType(table.Rows[rowIndex].Value <string>("aim type")) : Enums.AimType.Programme }; var standardCode = table.Rows[rowIndex].Value <int>("standard code") > 0 ? table.Rows[rowIndex].Value <int>("standard code") : IlrBuilder.Defaults.StandardCode; learningDelivery.StandardCode = learningDelivery.FrameworkCode > 0 && learningDelivery.PathwayCode > 0 && learningDelivery.ProgrammeType > 0 ? 0 : standardCode; var priceEpisodes = SetupPriceEpisodes(table, rowIndex, learningDelivery.StandardCode); learningDelivery.PriceEpisodes = priceEpisodes.ToArray(); Learner learner = null; if (table.Rows[rowIndex].ContainsKey("ULN")) { var learners = StepDefinitionsContext.GetProvider(provider).Learners; if (learners != null) { learner = learners.SingleOrDefault(x => x.Name == table.Rows[rowIndex]["ULN"]); } } if (learner == null) { learner = new Learner(); learner.Name = table.Rows[rowIndex].ContainsKey("ULN") ? table.Rows[rowIndex]["ULN"] : string.Empty; if (table.Rows[rowIndex].ContainsKey("ULN")) { learner.Uln = GetUln(learner.Name, table.Rows[rowIndex]["ULN"]); } else { learner.Uln = GetUln(learner.Name, string.Empty); } learner.LearnRefNumber = $"{StepDefinitionsContext.GetProvider(provider).Ukprn}-{rowIndex+1}"; learner.DateOfBirth = GetDateOfBirth(learningDelivery.LearnerType, learningDelivery.StartDate); learner.EmploymentStatuses = StepDefinitionsContext.ReferenceDataContext.EmploymentStatuses; StepDefinitionsContext.AddProviderLearner(provider, learner); } learner.LearningDeliveries.Add(learningDelivery); } }
private AimAndDeliverableModel GetAimAndDeliverableModel( LearnerDetails learnerDetails, Fm70LearningDelivery fm70Delivery, LarsLearningDeliveryModel larsDelivery, DpOutcome outcome, Fm70DpOutcome fm70Outcome, LearningDeliveryFam fam, IDictionary <LearnerMonitoringKey, ProviderSpecLearnerMonitoring> learnerMonitorings, IDictionary <DeliveryMonitoringKey, ProviderSpecDeliveryMonitoring> deliveryMonitorings, Fm70LearningDeliveryDeliverable deliverable = null, Fm70LearningDeliveryDeliverablePeriod period = null, FcsDeliverableCodeMapping fcsMapping = null, decimal?total = null) { var model = new AimAndDeliverableModel { LearnRefNumber = learnerDetails.LearnRefNumber, ULN = learnerDetails.Uln, AimSeqNumber = learnerDetails.AimSeqNumber, ConRefNumber = learnerDetails.ConRefNumber, DeliverableCode = deliverable?.DeliverableCode, DeliverableName = fcsMapping?.DeliverableName, LearnAimRef = learnerDetails.LearnAimRef, DeliverableUnitCost = deliverable?.DeliverableUnitCost, ApplicWeightFundRate = fm70Delivery?.ApplicWeightFundRate, AimValue = fm70Delivery?.AimValue, LearnAimRefTitle = larsDelivery?.LearnAimRefTitle, PMUKPRN = learnerDetails.Pmukprn, CampId = learnerDetails.CampId, ProvSpecLearnMonA = GetLearnerMonitoring(learnerMonitorings, learnerDetails.LearnRefNumber, "A"), ProvSpecLearnMonB = GetLearnerMonitoring(learnerMonitorings, learnerDetails.LearnRefNumber, "B"), SWSupAimId = learnerDetails.SwsupAimId, NotionalNVQLevelv2 = larsDelivery?.NotionalNVQLevelv2, SectorSubjectAreaTier2 = larsDelivery?.SectorSubjectAreaTier2, AdjustedAreaCostFactor = fm70Delivery?.AdjustedAreaCostFactor, AdjustedPremiumFactor = fm70Delivery?.AdjustedPremiumFactor, LearnStartDate = learnerDetails.LearnStartDate, LDESFEngagementStartDate = fm70Delivery?.LdEsfEngagementStartDate, LearnPlanEndDate = learnerDetails.LearnPlanEndDate, CompStatus = learnerDetails.CompStatus, LearnActEndDate = learnerDetails.LearnActEndDate, Outcome = learnerDetails.Outcome, AddHours = learnerDetails.AddHours, LearnDelFAMCode = fam?.LearnDelFamCode, ProvSpecDelMonA = GetDeliveryMonitoring(deliveryMonitorings, learnerDetails.LearnRefNumber, learnerDetails.AimSeqNumber, "A"), ProvSpecDelMonB = GetDeliveryMonitoring(deliveryMonitorings, learnerDetails.LearnRefNumber, learnerDetails.AimSeqNumber, "B"), ProvSpecDelMonC = GetDeliveryMonitoring(deliveryMonitorings, learnerDetails.LearnRefNumber, learnerDetails.AimSeqNumber, "C"), ProvSpecDelMonD = GetDeliveryMonitoring(deliveryMonitorings, learnerDetails.LearnRefNumber, learnerDetails.AimSeqNumber, "D"), PartnerUKPRN = learnerDetails.PartnerUkprn, DelLocPostCode = learnerDetails.DelLocPostCode, LatestPossibleStartDate = fm70Delivery?.LatestPossibleStartDate, EligibleProgressionOutomeStartDate = fm70Delivery?.EligibleProgressionOutomeStartDate, EligibleOutcomeEndDate = outcome?.OutEndDate, EligibleOutcomeCollectionDate = outcome?.OutCollDate, EligibleOutcomeDateProgressionLength = fm70Outcome?.OutcomeDateForProgression, EligibleProgressionOutcomeType = fm70Delivery?.EligibleProgressionOutcomeType, EligibleProgressionOutcomeCode = fm70Delivery?.EligibleProgressionOutcomeCode, Period = _reportMonths[period?.Period - 1 ?? 0], DeliverableVolume = period?.DeliverableVolume, StartEarnings = period?.StartEarnings, AchievementEarnings = period?.AchievementEarnings, AdditionalProgCostEarnings = period?.AdditionalProgCostEarnings, ProgressionEarnings = period?.ProgressionEarnings, TotalEarnings = total }; return(model); }