Ejemplo n.º 1
0
        private async Task <SSG_SearchRequest> VerifySearchRequest(SearchRequestOrdered searchRequestOrdered)
        {
            //get existedSearchRequest
            SSG_SearchRequest existedSearchRequest = await _searchRequestService.GetSearchRequest(searchRequestOrdered.SearchRequestKey, _cancellationToken);

            if (existedSearchRequest == null)
            {
                string error = "the search request does not exist.";
                _logger.LogInformation(error);
                throw new Exception(error);
            }
            if (existedSearchRequest.StatusCode == SearchRequestStatusCode.SearchRequestCancelled.Value)
            {
                throw new AgencyRequestException("fileCancelled", new Exception($"File {searchRequestOrdered.SearchRequestKey} is cancelled."));
            }
            if (existedSearchRequest.StatusCode == SearchRequestStatusCode.SearchRequestClosed.Value)
            {
                throw new AgencyRequestException("fileClosed", new Exception($"File {searchRequestOrdered.SearchRequestKey} is closed."));
            }
            if (existedSearchRequest.Agency == null || existedSearchRequest.Agency.AgencyCode != searchRequestOrdered?.Person?.Agency?.Code)
            {
                throw new AgencyRequestException("wrongAgency", new Exception($"Wrong Agency Code."));
            }
            return(existedSearchRequest);
        }
Ejemplo n.º 2
0
        private async Task <SSG_SearchRequest> VerifySearchRequest(SearchRequestOrdered searchRequestOrdered)
        {
            //get existedSearchRequest
            SSG_SearchRequest existedSearchRequest = await _searchRequestService.GetSearchRequest(searchRequestOrdered.SearchRequestKey, _cancellationToken);

            if (existedSearchRequest == null)
            {
                _logger.LogInformation("the updating search request does not exist.");
                return(null);
            }
            if (existedSearchRequest.StatusCode == SEARCH_REQUEST_CANCELLED)
            {
                throw new AgencyRequestException("fileCancelled", new Exception($"File {searchRequestOrdered.SearchRequestKey} is cancelled."));
            }
            if (existedSearchRequest.StatusCode == SEARCH_REQUEST_CLOSED)
            {
                throw new AgencyRequestException("fileClosed", new Exception($"File {searchRequestOrdered.SearchRequestKey} is closed."));
            }
            if (existedSearchRequest.Agency == null || existedSearchRequest.Agency.AgencyCode != searchRequestOrdered?.Person?.Agency?.Code)
            {
                throw new AgencyRequestException("wrongAgency", new Exception($"Wrong Agency Code."));
            }
            return(existedSearchRequest);
        }
Ejemplo n.º 3
0
 public async Task <SSG_SearchRequest> GetSearchRequest(string fileId, CancellationToken token)
 {
     return(await _searchRequestService.GetSearchRequest(fileId, _cancellationToken));
 }