public async Task <IList <ILR1617.EsfLearningDeliveryDeliverablePeriodisedValues> > Get1617PeriodisedValues( int ukPrn, ILRConfiguration configuration, CancellationToken cancellationToken) { IList <ILR1617.EsfLearningDeliveryDeliverablePeriodisedValues> values = null; try { if (cancellationToken.IsCancellationRequested) { return(null); } var optionsBuilder = new DbContextOptionsBuilder <ILR1617.ILR1617Context>(); optionsBuilder.UseSqlServer( configuration.ILR1617ConnectionString, providerOptions => providerOptions.CommandTimeout(60)); using (_1617Context = new ILR1617.ILR1617Context(optionsBuilder.Options)) { values = await _1617Context.EsfLearningDeliveryDeliverablePeriodisedValues .Where(v => v.Ukprn == ukPrn) .ToListAsync(cancellationToken); } } catch (Exception ex) { // _logger.LogError($"Failed to get 16/17 FM70 periodised values with ukPrn {ukPrn}", ex); } return(values); }
public async Task <ILRFileDetails> GetLatest1617FileDetailsPerUkPrn( int ukPrn, ILRConfiguration configuration, CancellationToken cancellationToken) { ILRFileDetails result = null; try { if (cancellationToken.IsCancellationRequested) { return(null); } var optionsBuilder = new DbContextOptionsBuilder <ILR1617.ILR1617Context>(); optionsBuilder.UseSqlServer( configuration.ILR1617ConnectionString, providerOptions => providerOptions.CommandTimeout(60)); using (_1617Context = new ILR1617.ILR1617Context(optionsBuilder.Options)) { result = await _1617Context.FileDetails .Where(fd => fd.Ukprn == ukPrn) .OrderByDescending(fd => fd.SubmittedTime) .Select(fd => new ILRFileDetails { FileName = fd.Filename, LastSubmission = fd.SubmittedTime }).FirstOrDefaultAsync(cancellationToken); } } catch (Exception ex) { // _logger.LogError($"Failed to get 16/17 file details with ukPrn {ukPrn}", ex); } return(result); }