예제 #1
0
        public async Task <IActionResult> Index(long jobId)
        {
            Logger.LogInfo($"Loading validation results page for job id : {jobId}", jobIdOverride: jobId);

            var job = await GetJob(jobId);

            var valResult = await _validationResultsService.GetValidationResult(Ukprn, jobId, job.JobType, job.DateTimeSubmittedUtc);

            if (valResult == null)
            {
                Logger.LogInfo($"Loading validation results page for job id : {jobId}, no data found", jobIdOverride: jobId);
                return(View(new ValidationResultViewModel()));
            }

            if (await _collectionManagementService.GetCurrentPeriodAsync(job.CollectionName) == null)
            {
                var nextPeriod = await _collectionManagementService.GetNextPeriodAsync(job.CollectionName);

                ViewData[ViewDataConstants.NextReturnOpenDate] = nextPeriod?.NextOpeningDate;
            }

            valResult.CollectionName = job.CollectionName;
            Logger.LogInfo($"Returning validation results for job id : {jobId}, total errors : {valResult.TotalErrors}", jobIdOverride: jobId);

            return(View(valResult));
        }
        public override async Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
        {
            if (!string.IsNullOrEmpty(Collection))
            {
                var period = await _collectionManagementService.GetCurrentPeriodAsync(Collection);

                if (period != null)
                {
                    output.Content.SetHtmlContent($"Return Period {period?.PeriodNumber} ({period?.PeriodName()})");
                }
                else
                {
                    output.SuppressOutput();
                }
            }
        }
        private async Task SetupNextPeriod(string collectionName)
        {
            if (string.IsNullOrEmpty(collectionName))
            {
                return;
            }

            if (await _collectionManagementService.GetCurrentPeriodAsync(collectionName) == null)
            {
                Logger.LogWarning($"No active period for collection : {collectionName}");

                var nextPeriod = await _collectionManagementService.GetNextPeriodAsync(collectionName);

                ViewData[ViewDataConstants.NextReturnOpenDate] = nextPeriod?.NextOpeningDate;
            }
        }
예제 #4
0
 protected async Task <ReturnPeriodViewModel> GetCurrentPeriodAsync(string collectionName)
 {
     return(await _collectionManagementService.GetCurrentPeriodAsync(collectionName));
 }