/// <summary>
 /// Condition met.
 /// </summary>
 /// <param name="thisDelivery">this learning delivery.</param>
 /// <param name="thisFinancialRecord">this financial record.</param>
 /// <returns>
 /// true if any any point the conditions are met
 /// </returns>
 public bool ConditionMet(ILearningDelivery thisDelivery, IAppFinRecord thisFinancialRecord)
 {
     return(It.Has(thisDelivery) && It.Has(thisFinancialRecord)
         ? thisFinancialRecord.AFinDate > DateTime.MinValue &&
            thisDelivery.LearnStartDate == thisFinancialRecord.AFinDate
         : true);
 }
Пример #2
0
 public IEnumerable <IErrorMessageParameter> BuildMessageParametersFor(IAppFinRecord thisRecord)
 {
     return(new[]
     {
         BuildErrorMessageParameter(PropertyNameConstants.AFinDate, thisRecord.AFinDate),
         BuildErrorMessageParameter(PropertyNameConstants.FilePreparationDate, _fileData.FilePreparationDate())
     });
 }
        /// <summary>
        /// Raises the validation message.
        /// </summary>
        /// <param name="learnRefNumber">The learn reference number.</param>
        /// <param name="record">The record.</param>
        public void RaiseValidationMessage(string learnRefNumber, IAppFinRecord record)
        {
            var parameters = Collection.Empty <IErrorMessageParameter>();

            parameters.Add(_messageHandler.BuildErrorMessageParameter(PropertyNameConstants.ProgType, TypeOfLearningProgramme.ApprenticeshipStandard));
            parameters.Add(_messageHandler.BuildErrorMessageParameter(PropertyNameConstants.AFinType, record.AFinType));
            parameters.Add(_messageHandler.BuildErrorMessageParameter(PropertyNameConstants.AFinCode, record.AFinCode));
            parameters.Add(_messageHandler.BuildErrorMessageParameter(PropertyNameConstants.AFinDate, record.AFinDate));

            _messageHandler.Handle(RuleName, learnRefNumber, null, parameters);
        }
Пример #4
0
 public IDataEntity BuildApprenticeshipFinancialRecord(IAppFinRecord appFinRecord)
 {
     return(new DataEntity(Attributes.EntityApprenticeshipFinancialRecord)
     {
         Attributes = new Dictionary <string, IAttributeData>()
         {
             { Attributes.AFinAmount, new AttributeData(appFinRecord.AFinAmount) },
             { Attributes.AFinCode, new AttributeData(appFinRecord.AFinCode) },
             { Attributes.AFinDate, new AttributeData(appFinRecord.AFinDate) },
             { Attributes.AFinType, new AttributeData(appFinRecord.AFinType) }
         }
     });
 }
Пример #5
0
 public static AppFinRecord BuildInvalidAppFinRecord(
     int ukprn,
     ILearner learner,
     ILearningDelivery learningDelivery,
     IAppFinRecord appFinRecord,
     int learnerDeliveryId,
     int appFinRecordId)
 {
     return(new AppFinRecord
     {
         AppFinRecord_Id = appFinRecordId,
         LearningDelivery_Id = learnerDeliveryId,
         LearnRefNumber = learner.LearnRefNumber,
         UKPRN = ukprn,
         AFinAmount = appFinRecord.AFinAmount,
         AFinCode = appFinRecord.AFinCode,
         AFinDate = appFinRecord.AFinDate,
         AFinType = appFinRecord.AFinType,
         AimSeqNumber = learningDelivery.AimSeqNumber
     });
 }
Пример #6
0
 public void RaiseValidationMessage(string learnRefNumber, ILearningDelivery thisDelivery, IAppFinRecord thisRecord)
 {
     HandleValidationError(learnRefNumber, thisDelivery.AimSeqNumber, BuildMessageParametersFor(thisRecord));
 }
Пример #7
0
 public IAppFinRecord AFinRecordWithDateLessThanLearnStartDate(DateTime learnStartDate, IAppFinRecord appFinRecord)
 {
     return(appFinRecord.AFinDate < _dateTimeQueryService.AddYearsToDate(learnStartDate, _numberOfYears) ? appFinRecord : null);
 }
 /// <summary>
 /// Condition met.
 /// </summary>
 /// <param name="financialRecord">The financial record.</param>
 /// <returns>
 /// true if any any point the conditions are met
 /// </returns>
 public bool ConditionMet(IAppFinRecord financialRecord)
 {
     return(It.Has(financialRecord)
         ? It.IsInRange($"{financialRecord.AFinType}{financialRecord.AFinCode}", ApprenticeshipFinanicalRecord.TotalAssessmentPrice, ApprenticeshipFinanicalRecord.ResidualAssessmentPrice)
         : true);
 }
 public IAppFinRecord AFinRecordWithDateLessThanLearnStartDate(DateTime learnStartDate, IAppFinRecord appFinRecord)
 {
     return(appFinRecord.AFinDate < learnStartDate.AddYears(_numberOfYears) ? appFinRecord : null);
 }
Пример #10
0
 public AppFinRecord BuildLearningDeliveryAppFinRecord(int ukprn, ILearner learner, ILearningDelivery learningDelivery, IAppFinRecord appFinRecord, int id)
 {
     return(new AppFinRecord
     {
         AppFinRecord_Id = id,
         LearnRefNumber = learner.LearnRefNumber,
         UKPRN = ukprn,
         AFinAmount = appFinRecord.AFinAmount,
         AFinCode = appFinRecord.AFinCode,
         AFinDate = appFinRecord.AFinDate,
         AFinType = appFinRecord.AFinType,
         AimSeqNumber = learningDelivery.AimSeqNumber
     });
 }
 public IAppFinRecord AFinRecordWithDateGreaterThanLearnActEndDate(DateTime learnActEndDate, IAppFinRecord appFinRecord)
 => appFinRecord.AFinDate > learnActEndDate.AddYears(_numberOfYears) ? appFinRecord : null;
 public bool ConditionMet(IAppFinRecord appFinRecord)
 {
     return(!_lookups.Contains(TypeOfStringCodedLookup.AppFinType, $"{appFinRecord.AFinType.ToUpper()}{appFinRecord.AFinCode}"));
 }
 /// <summary>
 /// Determines whether [is assessment price] [the specified record].
 /// </summary>
 /// <param name="record">The record.</param>
 /// <returns>
 ///   <c>true</c> if [is assessment price] [the specified record]; otherwise, <c>false</c>.
 /// </returns>
 public bool IsAssessmentPrice(IAppFinRecord record) =>
 It.IsInRange($"{record.AFinType}{record.AFinCode}", ApprenticeshipFinanicalRecord.TotalAssessmentPrice, ApprenticeshipFinanicalRecord.ResidualAssessmentPrice);
 public IAppFinRecord AFinRecordWithDateGreaterThanLearnActEndDate(DateTime learnActEndDate, IAppFinRecord appFinRecord)
 => appFinRecord.AFinDate > _dateTimeQueryService.AddYearsToDate(learnActEndDate, _numberOfYears) ? appFinRecord : null;
 /// <summary>
 /// Determines whether [has wrong record cardinality] [the specified record].
 /// </summary>
 /// <param name="record">The record.</param>
 /// <param name="allRecords">All records.</param>
 /// <returns>
 ///   <c>true</c> if [has wrong record cardinality] [the specified record]; otherwise, <c>false</c>.
 /// </returns>
 public bool HasWrongRecordCardinality(IAppFinRecord record, IReadOnlyCollection <IAppFinRecord> allRecords) =>
 allRecords.SafeCount(x => RecordEqualityComparer.Equals(x, record)) != 1;
Пример #16
0
 public bool ConditionMet(IAppFinRecord appFinRecord)
 {
     return(!_lookups.Contains(TypeOfStringCodedLookup.ApprenticeshipFinancialRecord, $"{appFinRecord.AFinType}{appFinRecord.AFinCode}"));
 }
        public bool IsAssessmentPrice(IAppFinRecord appFinRecord)
        {
            var compoundAppFinRecordKey = appFinRecord.AFinType + appFinRecord.AFinCode;

            return(_assessmentPriceFinancialRecordKeys.Contains(compoundAppFinRecordKey));
        }
 public bool IsPaymentRequest(IAppFinRecord theRecord) =>
 theRecord.AFinType.CaseInsensitiveEquals(ApprenticeshipFinancialRecord.Types.PaymentRecord) &&
 (theRecord.AFinCode == ApprenticeshipFinancialRecord.PaymentRecordCodes.TrainingPayment || theRecord.AFinCode == ApprenticeshipFinancialRecord.PaymentRecordCodes.AssessmentPayment);
 /// <summary>
 /// Determines whether [has invalid financial date] [the specified record].
 /// </summary>
 /// <param name="record">The record.</param>
 /// <returns>
 ///   <c>true</c> if [has invalid financial date] [the specified record]; otherwise, <c>false</c>.
 /// </returns>
 public bool HasInvalidFinancialDate(IAppFinRecord record) =>
 record.AFinDate > _fileData.FilePreparationDate();
 public bool IsProviderReimbursement(IAppFinRecord theRecord) =>
 theRecord.AFinType.CaseInsensitiveEquals(ApprenticeshipFinancialRecord.Types.PaymentRecord) &&
 theRecord.AFinCode == ApprenticeshipFinancialRecord.PaymentRecordCodes.EmployerPaymentReimbursedByProvider;
Пример #21
0
 private void PopulateLearningDeliveryAppFinRecord(int ukprn, ILearner learner, ILearningDelivery learningDelivery, IAppFinRecord appFinRecord, int learnerDeliveryId, int appFinRecordId, InvalidLearnerData invalidLearnerData)
 {
     invalidLearnerData.RecordsInvalidAppFinRecords.Add(AppFinRecordBuilder.BuildInvalidAppFinRecord(ukprn, learner, learningDelivery, appFinRecord, learnerDeliveryId, appFinRecordId));
 }
 private void PopulateLearningDeliveryAppFinRecord(int ukprn, ILearner learner, ILearningDelivery learningDelivery, IAppFinRecord appFinRecord, ValidLearnerData validLearnerData)
 {
     validLearnerData.RecordsValidAppFinRecords.Add(AppFinRecordBuilder.BuildValidAppFinRecord(ukprn, learner, learningDelivery, appFinRecord));
 }