public CloudBlockBlob GetBlob(string fileName, EnumJobType jobType) { var cloudStorageSettings = _indexedCloudStorageSettings[jobType]; var cloudStorageAccount = CloudStorageAccount.Parse(cloudStorageSettings.ConnectionString); var cloudBlobClient = cloudStorageAccount.CreateCloudBlobClient(); var cloudBlobContainer = cloudBlobClient.GetContainerReference(cloudStorageSettings.ContainerName); return(cloudBlobContainer.GetBlockBlobReference(fileName)); }
protected AbstractSubmissionAuthorisedController( EnumJobType jobType, IJobService jobService, ILogger logger, ICollectionManagementService collectionManagementService, IIndex <EnumJobType, IStreamableKeyValuePersistenceService> storagePersistenceServices, IIndex <EnumJobType, IAzureStorageKeyValuePersistenceServiceConfig> storageKeyValueConfigs) : base(logger) { _jobService = jobService; _collectionManagementService = collectionManagementService; _storageService = storagePersistenceServices[jobType]; _jobType = jobType; _storageKeyValueConfig = storageKeyValueConfigs[jobType]; }
public string GetHeader(EnumJobType jobType, int period) { switch (jobType) { case EnumJobType.IlrSubmission: return(string.Concat("R", period.ToString("00"), " ILR file submitted")); case EnumJobType.EsfSubmission: return(string.Concat("R", period.ToString("00"), " supplementary data file submitted")); case EnumJobType.EasSubmission: return("EAS statement updated"); } return(string.Empty); }
private string MapJobType(EnumJobType jobType) { switch (jobType) { case EnumJobType.IlrSubmission: return("ILR"); case EnumJobType.EsfSubmission: return("ESF"); case EnumJobType.EasSubmission: return("EAS"); default: throw new Exception("invalid job type"); } }
public async Task <decimal> GetReportFileSizeAsync(string fileName, EnumJobType jobType) { _logger.LogInfo($"Getting report file size : {fileName}"); try { var cloudBlockBlob = GetBlob(fileName, jobType); if (await cloudBlockBlob.ExistsAsync()) { return((decimal)cloudBlockBlob.Properties.Length / 1024); } } catch (Exception ex) { _logger.LogError($"Error occured trying to get report size : {fileName}", ex); throw; } return(0); }
public async Task <Stream> GetBlobFileStreamAsync(string fileName, EnumJobType jobType) { _logger.LogInfo($"Getting report : {fileName}"); try { var cloudBlockBlob = GetBlob(fileName, jobType); if (await cloudBlockBlob.ExistsAsync()) { return(await cloudBlockBlob.OpenReadAsync()); } } catch (Exception ex) { _logger.LogError($"Error occured trying to report : {fileName}", ex); throw; } return(null); }
/// <summary> Добавить пулер билд сервера </summary> /// <param name="jobDesc">Имя задачи "для пользователя"</param> /// <param name="jobName">Имя задачи на сервере</param> /// <param name="jobType">Тип сборки</param> public void AddBuildPuller([NotNull] string jobDesc, [NotNull] string jobName, EnumJobType jobType) { this.BuildServerPulles.Add(new JenkinsJobInfo { JobDesc = jobDesc, JobName = jobName, JobType = jobType }); }
public async Task <decimal> GetFileSize(long ukprn, long jobId, EnumJobType jobType, DateTime dateTimeUtc, ValidationResultsReportType whichReport) { var fileName = $"{GetStorageFileName(ukprn, jobId, dateTimeUtc, whichReport)}.csv"; return(await _reportService.GetReportFileSizeAsync(fileName, jobType)); }
public async Task <ValidationResultViewModel> GetValidationResult(long ukprn, long jobId, EnumJobType jobType, DateTime dateTimeUtc) { var validationResult = await GetValidationResultsData(ukprn, jobId); if (validationResult == null) { return(null); } var dataMatchSize = await GetFileSize(ukprn, jobId, jobType, dateTimeUtc, ValidationResultsReportType.DataMatch); return(new ValidationResultViewModel() { JobId = jobId, TotalErrors = validationResult.TotalErrors, TotalErrorLearners = validationResult.TotalErrorLearners, TotalWarningLearners = validationResult.TotalWarningLearners, TotalWarnings = validationResult.TotalWarnings, TotalLearners = validationResult.TotalLearners, ReportFileSize = (await GetFileSize(ukprn, jobId, jobType, dateTimeUtc, ValidationResultsReportType.DetailedErrors)).ToString("N1"), ErrorMessage = validationResult.ErrorMessage, DataMatchReportFileSize = dataMatchSize.ToString("N1"), HasDataMatchReport = dataMatchSize > 0, TotalDataMatchErrors = validationResult.TotalDataMatchErrors, TotalDataMatchLearners = validationResult.TotalDataMatchLearners }); }
public SubmissionMessageViewModel(EnumJobType jobType, long ukprn) { JobType = jobType; Ukprn = ukprn; }