public async Task <RedactedCivilFileDetailResponse> FileIdAsync(string fileId, bool isVcUser)
        {
            async Task <CivilFileDetailResponse> FileDetails() => await _filesClient.FilesCivilGetAsync(_requestAgencyIdentifierId, _requestPartId, _applicationCode, fileId);
            async Task <CivilFileContent> FileContent() => await _filesClient.FilesCivilFilecontentAsync(_requestAgencyIdentifierId, _requestPartId, _applicationCode, null, null, null, null, fileId);
            async Task <CivilAppearanceResponse> Appearances() => await PopulateDetailAppearancesAsync(FutureYN2.Y, HistoryYN2.Y, fileId);

            var fileDetailTask  = _cache.GetOrAddAsync($"CivilFileDetail-{fileId}-{_requestAgencyIdentifierId}", FileDetails);
            var fileContentTask = _cache.GetOrAddAsync($"CivilFileContent-{fileId}-{_requestAgencyIdentifierId}", FileContent);
            var appearancesTask = _cache.GetOrAddAsync($"CivilAppearancesFull-{fileId}-{_requestAgencyIdentifierId}", Appearances);

            var fileDetail = await fileDetailTask;

            ValidUserHelper.CheckIfValidUser(fileDetail.ResponseMessageTxt);

            var appearances = await appearancesTask;
            var fileContent = await fileContentTask;

            if (fileDetail?.PhysicalFileId == null)
            {
                return(null);
            }

            var detail = _mapper.Map <RedactedCivilFileDetailResponse>(fileDetail);

            foreach (var document in PopulateDetailCsrsDocuments(fileDetail.Appearance))
            {
                if (!isVcUser)
                {
                    detail.Document.Add(document);
                }
            }

            detail = await PopulateBaseDetail(detail);

            detail.Appearances = appearances;

            var fileContentCivilFile = fileContent?.CivilFile?.First(cf => cf.PhysicalFileID == fileId);

            detail.Party = await PopulateDetailParties(detail.Party);

            detail.Document = await PopulateDetailDocuments(detail.Document, fileContentCivilFile);

            detail.HearingRestriction = await PopulateDetailHearingRestrictions(fileDetail.HearingRestriction);

            if (isVcUser)
            {
                detail.HearingRestriction = new List <CivilHearingRestriction>();
            }

            return(detail);
        }
        public async void Civil_File_Services_File_Content()
        {
            /* This is the largest civil file on dev. Unfortunately if the WSDL changes for this route,
             * it will always return back 200, but a null file. It would have been nice if the server
             * would return 500 etc on errors. */
            var result = await _fileServicesClient.FilesCivilFilecontentAsync(_agencyIdentifierId, _partId, "SCV", null, null, null, null, "2222");

            Assert.NotNull(result);
        }
        public async Task <RedactedCivilFileDetailResponse> FileIdAsync(string fileId)
        {
            async Task <CivilFileDetailResponse> FileDetails() => await _filesClient.FilesCivilFileIdAsync(_requestAgencyIdentifierId, _requestPartId, fileId);
            async Task <CivilFileContent> FileContent() => await _filesClient.FilesCivilFilecontentAsync(null, null, null, null, fileId);
            async Task <CivilFileAppearancesResponse> Appearances() => await PopulateDetailAppearancesAsync(FutureYN2.Y, HistoryYN2.Y, fileId);

            var fileDetailTask  = _cache.GetOrAddAsync($"CivilFileDetail-{fileId}", FileDetails);
            var fileContentTask = _cache.GetOrAddAsync($"CivilFileContent-{fileId}", FileContent);
            var appearancesTask = _cache.GetOrAddAsync($"CivilAppearancesFull-{fileId}", Appearances);

            var fileDetail  = await fileDetailTask;
            var appearances = await appearancesTask;
            var fileContent = await fileContentTask;

            if (fileDetail?.PhysicalFileId == null)
            {
                return(null);
            }

            var detail = _mapper.Map <RedactedCivilFileDetailResponse>(fileDetail);

            foreach (var document in PopulateDetailCsrsDocuments(fileDetail.Appearance))
            {
                detail.Document.Add(document);
            }

            detail = await PopulateBaseDetail(detail);

            detail.Appearances     = appearances;
            detail.FileCommentText = fileContent.CivilFile.First(cf => cf.PhysicalFileID == fileId).FileCommentText;
            detail.Party           = await PopulateDetailParties(detail.Party);

            detail.Document = await PopulateDetailDocuments(detail.Document);

            detail.HearingRestriction = await PopulateDetailHearingRestrictions(fileDetail.HearingRestriction);

            return(detail);
        }
        private List <Task <CivilFileContent> > CivilFileContentTasks(List <string> fileIds)
        {
            var fileContentTasks = new List <Task <CivilFileContent> >();

            foreach (var fileId in fileIds)
            {
                async Task <CivilFileContent> FileContent() =>
                await _filesClient.FilesCivilFilecontentAsync(_requestAgencyIdentifierId, _requestPartId, _applicationCode, null, null, null, null, fileId);

                fileContentTasks.Add(_cache.GetOrAddAsync($"CivilFileContent-{fileId}-{_requestAgencyIdentifierId}", FileContent));
            }

            return(fileContentTasks);
        }
예제 #5
0
        private List <Task <CivilFileContent> > CivilFileContentTasks(List <string> fileIds)
        {
            var fileContentTasks = new List <Task <CivilFileContent> >();

            foreach (var fileId in fileIds)
            {
                async Task <CivilFileContent> FileContent() =>
                await _filesClient.FilesCivilFilecontentAsync(null, null, null, null, fileId);

                fileContentTasks.Add(_cache.GetOrAddAsync($"CivilFileContent-{fileId}", FileContent));
            }

            return(fileContentTasks);
        }