/// <summary> /// Determines whether the specified candidate identifier is current. /// </summary> /// <param name="candidateID">The candidate identifier.</param> /// <param name="referenceDate">The reference date.</param> /// <returns> /// <c>true</c> if the specified candidate identifier is current; otherwise, <c>false</c>. /// </returns> public bool IsCurrent(string candidateID, DateTime referenceDate) { var organisation = Fetch(candidateID); return(It.Has(organisation) && It.IsBetween(referenceDate, organisation.EffectiveFrom, organisation.EffectiveTo)); }
/// <summary> /// Determines whether [is basic skills learner] [the specified delivery]. /// </summary> /// <param name="delivery">The delivery.</param> /// <returns> /// <c>true</c> if [is basic skills learner] [the specified delivery]; otherwise, <c>false</c>. /// </returns> public bool IsBasicSkillsLearner(ILearningDelivery delivery) { var deliveries = _larsData.GetDeliveriesFor(delivery.LearnAimRef) .Where(x => It.IsBetween(delivery.LearnStartDate, x.EffectiveFrom, x.EffectiveTo ?? DateTime.MaxValue)) .AsSafeReadOnlyList(); return deliveries .SelectMany(x => x.AnnualValues.AsSafeReadOnlyList()) .Any(IsBasicSkillsLearner); }
public static int MaximumViableAge => 99; // years (old..) /// <summary> /// Determines whether [is within viable age group] [the specified candidate]. /// </summary> /// <param name="candidate">The candidate.</param> /// <param name="reference">The reference.</param> /// <returns> /// <c>true</c> if [is within viable age group] [the specified candidate]; otherwise, <c>false</c>. /// </returns> public bool WithinViableAgeGroup(DateTime candidate, DateTime reference) => It.IsBetween(candidate, reference.AddYears(-MaximumViableAge), reference.AddYears(-MinimumViableAge));
/// <summary> /// Determines whether the specified candidate is current. /// this caters for and evaluates if funding has been withdrawn /// </summary> /// <param name="source">The source.</param> /// <param name="candidate">The candidate.</param> /// <param name="optionalEnding">The optional ending.</param> /// <returns> /// <c>true</c> if the specified candidate is current; otherwise, <c>false</c>. /// </returns> public static bool IsCurrent(this ISupportFundingWithdrawal source, DateTime candidate, DateTime?optionalEnding = null) => It.Has(source) && !source.IsWithdrawn() && It.IsBetween(candidate, source.StartDate, optionalEnding ?? source.EndDate ?? DateTime.MaxValue);
/// <summary> /// In valid start range. /// </summary> /// <param name="validity">The validity.</param> /// <param name="delivery">The delivery.</param> /// <returns> /// <c>true</c> if [in valid start range] [the specified delivery]; otherwise, <c>false</c>. /// </returns> public bool InValidStartRange(ILARSValidity validity, ILearningDelivery delivery) => It.IsBetween(delivery.LearnStartDate, validity.StartDate, validity.LastNewStartDate ?? DateTime.MaxValue);
/// <summary> /// Determines whether [in qualifying period] [the specified delivery]. /// TODO: needs to cater for 'termination' but this is currently a string of indeterminate quality /// It.IsBetween(delivery.LearnStartDate, onsPostcode.EffectiveFrom, onsPostcode.EffectiveTo ?? onsPostcode.Termination ?? DateTime.MaxValue); /// </summary> /// <param name="delivery">The delivery.</param> /// <param name="onsPostcode">The ons postcode.</param> /// <returns> /// <c>true</c> if [in qualifying period] [the specified delivery]; otherwise, <c>false</c>. /// </returns> public bool InQualifyingPeriod(ILearningDelivery delivery, IONSPostcode onsPostcode) => It.IsBetween(delivery.LearnStartDate, onsPostcode.EffectiveFrom, onsPostcode.Termination ?? onsPostcode.EffectiveTo ?? DateTime.MaxValue);
/// <summary> /// Determines whether the specified validity is current. /// </summary> /// <param name="validity">The validity.</param> /// <param name="delivery">The delivery.</param> /// <returns> /// <c>true</c> if the specified validity is current; otherwise, <c>false</c>. /// </returns> public bool IsCurrent(ILARSValidity validity, ILearningDelivery delivery) => It.IsBetween(delivery.LearnStartDate, validity.StartDate, validity.EndDate ?? DateTime.MaxValue);
/// <summary> /// Determines whether [is qualifying aim] [the specified delivery]. /// </summary> /// <param name="delivery">The delivery.</param> /// <returns> /// <c>true</c> if [is qualifying aim] [the specified delivery]; otherwise, <c>false</c>. /// </returns> public bool IsQualifyingAim(ILearningDelivery delivery) => It.IsBetween(delivery.LearnStartDate, FirstViableDate, LastViableDate);
/// <summary> /// Determines whether the specified employment status record has qualifying start date /// </summary> /// <param name="employment">The employment.</param> /// <param name="minStart">The minimum start.</param> /// <param name="maxStart">The maximum start (if null sets to today).</param> /// <returns> /// <c>true</c> if [has qualifying start] [the specified employment]; otherwise, <c>false</c>. /// </returns> public bool HasQualifyingStart(ILearnerEmploymentStatus employment, DateTime minStart, DateTime?maxStart = null) => It.Has(employment) && It.IsBetween(employment.DateEmpStatApp, minStart, maxStart ?? DateTime.MaxValue);
/// <summary> /// Determines whether the specified learning delivery has qualifying start date /// </summary> /// <param name="delivery">The delivery.</param> /// <param name="minStart">The minimum start.</param> /// <param name="maxStart">The maximum start (if null sets to today).</param> /// <returns> /// <c>true</c> if [has qualifying start] [the specified delivery]; otherwise, <c>false</c>. /// </returns> public bool HasQualifyingStart(ILearningDelivery delivery, DateTime minStart, DateTime?maxStart = null) => It.Has(delivery) && It.IsBetween(delivery.LearnStartDate, minStart, maxStart ?? DateTime.MaxValue);
/// <summary> /// Determines whether [has qualifying dates] [the specified delivery]. /// must be less than the learn start date /// </summary> /// <param name="delivery">The delivery.</param> /// <returns> /// <c>true</c> if [has qualifying dates] [the specified delivery]; otherwise, <c>false</c>. /// </returns> public bool HasQualifyingDates(ILearningDelivery delivery) => It.IsBetween(delivery.OrigLearnStartDateNullable.Value, DateTime.MinValue, delivery.LearnStartDate, false);
/// <summary> /// Determines whether [has qualifying framework aim] [this delivery]. /// TODO: back log item => restore full date range checks for 19/20 rollover processing /// IsOutOfScope(frameworkAims) || frameworkAims.Any(fa => fa.IsCurrent(earliestStart)); /// </summary> /// <param name="frameworkAims">The framework aims.</param> /// <param name="earliestStart">The earliest start.</param> /// <returns> /// <c>true</c> if [has qualifying framework aim] [this delivery]; otherwise, <c>false</c>. /// </returns> public bool HasQualifyingFrameworkAim(IReadOnlyCollection <ILARSFrameworkAim> frameworkAims, DateTime earliestStart) => IsOutOfScope(frameworkAims) || frameworkAims.Any(fa => It.IsBetween(earliestStart, DateTime.MinValue, fa.EndDate ?? DateTime.MaxValue));
/// <summary> /// Determines whether [is target age group] [the specified learner]. /// </summary> /// <param name="learner">The learner.</param> /// <param name="delivery">The delivery.</param> /// <returns> /// <c>true</c> if [is target age group] [the specified learner]; otherwise, <c>false</c>. /// </returns> public bool IsTargetAgeGroup(ILearner learner, ILearningDelivery delivery) => It.Has(learner.DateOfBirthNullable) && It.IsBetween(delivery.LearnStartDate - learner.DateOfBirthNullable.Value, MinimumViableAge, MaximumViableAge);
/// <summary> /// Determines whether [is viable start] [the specified delivery]. /// </summary> /// <param name="delivery">The delivery.</param> /// <returns> /// <c>true</c> if [is viable start] [the specified delivery]; otherwise, <c>false</c>. /// </returns> public bool IsViableStart(ILearningDelivery delivery) => It.IsBetween(delivery.LearnStartDate, FirstViableDate, LastViableDate);