Beispiel #1
0
        public async Task <SupplementaryDataWrapper> GetFile(
            IEsfJobContext esfJobContext,
            ISourceFileModel sourceFileModel,
            CancellationToken cancellationToken)
        {
            SupplementaryDataWrapper wrapper = new SupplementaryDataWrapper();
            ICollection <SupplementaryDataLooseModel> esfRecords = new List <SupplementaryDataLooseModel>();
            IList <ValidationErrorModel> errors = new List <ValidationErrorModel>();

            try
            {
                esfRecords = await _eSFProviderService.GetESFRecordsFromFile(esfJobContext, cancellationToken);

                if (esfRecords == null || !esfRecords.Any())
                {
                    _logger.LogInfo("No ESF records to process");
                }
            }
            catch (ValidationException ex)
            {
                _logger.LogError($"The file format is incorrect, key: {sourceFileModel.FileName}", ex);

                errors.Add(new ValidationErrorModel
                {
                    RuleName     = "Fileformat_01",
                    ErrorMessage = "The file format is incorrect. Please check the field headers are as per the Guidance document.",
                    IsWarning    = false
                });
            }

            wrapper.SupplementaryDataLooseModels = esfRecords;
            wrapper.ValidErrorModels             = errors;
            return(wrapper);
        }
Beispiel #2
0
 public async Task <IList <SupplementaryDataLooseModel> > GetESFRecords(SourceFileModel sourceFileModel, CancellationToken cancellationToken)
 {
     return(await _providerService.GetESFRecordsFromFile(sourceFileModel, cancellationToken));
 }