public BlacklistQueryResult Search(SearchCompanyBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.Name, nameof(model.Name), e => e.IsNotNullOrEmpty()) .Property(x => x.CountryCode, nameof(model.CountryCode), e => e.IsNotNullOrEmpty().HasExactLength(2)); // name and country are manditory var query = new DplSearch(); query.AddClause(DplFields.Name, DplSearchMatchType.Similar, model.Name); query.AddClause(DplFields.CountryCode, DplSearchMatchType.Exact, model.CountryCode); if (!string.IsNullOrEmpty(model.City)) { query.AddClause(DplFields.City, DplSearchMatchType.Exact, model.City); } if (model.Uri != null && Uri.IsWellFormedUriString(model.Uri, UriKind.Absolute)) { var uri = new Uri(model.Uri, UriKind.Absolute); query.AddClause(DplFields.Notes, DplSearchMatchType.Contains, uri.DnsSafeHost); } if (!string.IsNullOrEmpty(model.StateCode)) { query.AddClause(DplFields.StateCode, DplSearchMatchType.Exact, model.StateCode); } var dplResult = CSDenialService.SearchDpl(query); var result = new BlacklistQueryResult(dplResult.Hits.Select(x => x.Id)); return(result); }
public BlacklistQueryResult Search(SearchPersonBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.Name, nameof(model.Name), e => e.IsNotNullOrEmpty()) .Property(x => x.CountryCode, nameof(model.CountryCode), e => e.IsNotNullOrEmpty().HasExactLength(2)); // name and country are manditory var query = new DplSearch(); query.AddClause(DplFields.Name, DplSearchMatchType.Similar, model.Name); query.AddClause(DplFields.CountryCode, DplSearchMatchType.Exact, model.CountryCode); if (!string.IsNullOrEmpty(model.City)) { query.AddClause(DplFields.City, DplSearchMatchType.Exact, model.City); } if (!string.IsNullOrEmpty(model.Email)) { query.AddClause(DplFields.Notes, DplSearchMatchType.Contains, model.Email); } if (!string.IsNullOrEmpty(model.StateCode)) { query.AddClause(DplFields.StateCode, DplSearchMatchType.Exact, model.StateCode); } var dplResult = CSDenialService.SearchDpl(query); var result = new BlacklistQueryResult(dplResult.Hits.Select(x => x.Id)); return(result); }
public BlacklistEntryDetails GetEntryDetails(Guid id) { Establish.For(id, nameof(id)).IsNotDefault(); var entry = CSDenialService.GetEntry(id); if (entry == null) { return(null); } return(new BlacklistEntryDetails() { City = entry.City, CountryCode = entry.CountryCode, EndDate = entry.EndDate, Id = entry.Id, LastUpdate = entry.LastUpdate, Name = entry.Name, Notes = entry.Notes, StartDate = entry.StartDate, StateCode = entry.StateCode, Street = entry.Street }); }
public bool IsCountryEmbargoed(SearchCountryBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.CountryCode, nameof(model.CountryCode), e => e.IsNotNullOrEmpty().HasExactLength(2)); return(CSDenialService.IsCountryEmbargoed(model.CountryCode)); }
public BlacklistQueryResult Search(SearchEmailBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.Email, nameof(model.Email), e => e.IsNotNullOrEmpty().MatchesPattern(EmailRegex)); var query = new DplSearch(); query.AddClause(DplFields.Notes, DplSearchMatchType.Contains, model.Email); var dplResult = CSDenialService.SearchDpl(query); var result = new BlacklistQueryResult(dplResult.Hits.Select(x => x.Id)); return(result); }
public BlacklistQueryResult Search(SearchDomainBlacklistRequest model) { Establish.For(model, nameof(model)).IsNotNull() .Property(x => x.Uri, nameof(model.Uri), e => e.IsNotNull().Satisfies(x => Uri.IsWellFormedUriString(x, UriKind.Absolute))); var uri = new Uri(model.Uri); var query = new DplSearch(); query.AddClause(DplFields.Notes, DplSearchMatchType.Contains, uri.DnsSafeHost); var dplResult = CSDenialService.SearchDpl(query); var result = new BlacklistQueryResult(dplResult.Hits.Select(x => x.Id)); return(result); }