Beispiel #1
0
		public IEnumerable<SearchLegalPartyDto> Search(SearchLegalPartyQueryDto legalPartySearchQuery)
		{
			var uri = _urlServices.GetServiceUri(Constants.ServiceLegalPartySearch);

			ExcludeNoneFeatureSpecificSearchParameters(legalPartySearchQuery);

			string result;

			try
			{
				result = _httpClientProxy.Post(uri.ToString(), "v1.1/SearchLegalParties", legalPartySearchQuery);
			}
			catch (HttpRequestException e)
			{
				if (e.Message.Contains("403 (Forbidden)"))
				{
					throw new InvalidProgramException("You do not have permission to operate this page. Please contact your system administrator for more details.");
				}
				throw;
			}
			catch (TimeoutException e)
			{
				throw new TimeoutException("The search information you have provided is too vague.  Please refine your search and try again.", e);
			}

			if (!string.IsNullOrEmpty(result))
			{
				return JsonConvert.DeserializeObject<List<SearchLegalPartyDto>>(result);
			}

			return null;
		}
Beispiel #2
0
		private void ExcludeNoneFeatureSpecificSearchParameters(SearchLegalPartyQueryDto searchLegalPartyQueryDto)
		{
			switch (_feature)
			{
				case Features.LegalPartySearch:
					searchLegalPartyQueryDto.ExcludeTag = true;
					searchLegalPartyQueryDto.ExcludeGeoCode = true;
					break;
			}
		}