Esempio n. 1
0
        private List <Task <CriminalFileAppearancesResponse> > CriminalAppearancesTasks(DateTime?proceeding, List <string> fileIds)
        {
            var targetDateInPast         = DateTime.Now > proceeding;
            var lookForPastAppearances   = targetDateInPast ? HistoryYN.Y : HistoryYN.N;
            var lookForFutureAppearances = targetDateInPast ? FutureYN.N : FutureYN.Y;

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

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

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

            return(appearanceTasks);
        }
Esempio n. 2
0
        private async Task <CriminalFileAppearances> PopulateDetailsAppearancesAsync(string fileId, FutureYN?future, HistoryYN?history)
        {
            var criminalFileIdAppearances = await _filesClient.FilesCriminalFileIdAppearancesAsync(_requestAgencyIdentifierId, _requestPartId, future, history, fileId);

            var criminalAppearances = _mapper.Map <CriminalFileAppearances>(criminalFileIdAppearances);

            foreach (var appearance in criminalAppearances.ApprDetail)
            {
                appearance.AppearanceReasonDsc = await _lookupService.GetCriminalAppearanceReasonsDescription(appearance.AppearanceReasonCd);

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

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

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

                appearance.CourtLocation = await _locationService.GetLocationName(appearance.CourtAgencyId);
            }
            return(criminalAppearances);
        }