private async Task <CivilFileAppearancesResponse> PopulateDetailAppearancesAsync(FutureYN2?future, HistoryYN2?history, string fileId)
        {
            var civilFileAppearancesResponse = await _filesClient.FilesCivilFileIdAppearancesAsync(_requestAgencyIdentifierId, _requestPartId, future, history,
                                                                                                   fileId);

            if (civilFileAppearancesResponse == null)
            {
                return(null);
            }

            var civilAppearances = _mapper.Map <CivilAppearanceResponse>(civilFileAppearancesResponse);

            foreach (var appearance in civilAppearances.ApprDetail)
            {
                appearance.AppearanceReasonDsc = await _lookupService.GetCivilAppearanceReasonsDescription(appearance.AppearanceReasonCd);

                appearance.AppearanceResultDsc = await _lookupService.GetCivilAppearanceResultsDescription(appearance.AppearanceResultCd);

                appearance.AppearanceStatusDsc = await _lookupService.GetCivilAppearanceStatusDescription(appearance.AppearanceStatusCd.ToString());

                appearance.CourtLocationId = await _locationService.GetLocationAgencyIdentifier(appearance.CourtAgencyId);

                appearance.CourtLocation = await _locationService.GetLocationName(appearance.CourtAgencyId);

                appearance.DocumentTypeDsc = await _lookupService.GetDocumentDescriptionAsync(appearance.DocumentTypeCd);
            }
            return(civilAppearances);
        }
예제 #2
0
        private List <Task <CivilFileAppearancesResponse> > CivilAppearancesTasks(DateTime?proceeding, List <string> fileIds)
        {
            var targetDateInPast         = DateTime.Now > proceeding;
            var lookForPastAppearances   = targetDateInPast ? HistoryYN2.Y : HistoryYN2.N;
            var lookForFutureAppearances = targetDateInPast ? FutureYN2.N : FutureYN2.Y;

            var appearanceTasks = new List <Task <CivilFileAppearancesResponse> >();

            foreach (var fileId in fileIds)
            {
                async Task <CivilFileAppearancesResponse> Appearances() => await _filesClient.FilesCivilFileIdAppearancesAsync(_requestAgencyIdentifierId, _requestPartId, lookForFutureAppearances,
                                                                                                                               lookForPastAppearances, fileId);

                appearanceTasks.Add(_cache.GetOrAddAsync($"CivilAppearances-{fileId}-InPast-{targetDateInPast}", Appearances));
            }

            return(appearanceTasks);
        }