private void ProcessRequestFieldsForSpecialCharacters(UpdateEpaOrganisationContactRequest request) { request.FirstName = _cleanser.CleanseStringForSpecialCharacters(request.FirstName); request.LastName = _cleanser.CleanseStringForSpecialCharacters(request.LastName); request.Email = _cleanser.CleanseStringForSpecialCharacters(request.Email); request.PhoneNumber = _cleanser.CleanseStringForSpecialCharacters(request.PhoneNumber); }
public string CheckOrganisationName(string name) { var organisationName = _cleanserService.CleanseStringForSpecialCharacters(name); if (string.IsNullOrEmpty(organisationName) || organisationName.Trim().Length == 0) { return(FormatErrorMessage(EpaOrganisationValidatorMessageName.OrganisationNameEmpty)); } return(organisationName.Trim().Length < 2 ? FormatErrorMessage(EpaOrganisationValidatorMessageName.OrganisationNameTooShort) : string.Empty); }
public async Task <AssessmentOrganisationSummary> Handle(GetAssessmentOrganisationByEmailRequest request, CancellationToken cancellationToken) { _logger.LogInformation("Handling Search AssessmentOrganisations Request"); var email = _cleanser.CleanseStringForSpecialCharacters(request.Email.Trim()); if (_validator.CheckIfEmailIsPresentAndInSuitableFormat(email) != string.Empty) { _logger.LogInformation($@"Getting AssessmentOrganisation based on contact email with invalid email address format: [{email}]"); return((AssessmentOrganisationSummary)null); } _logger.LogInformation($@"Getting AssessmentOrganisation based on contact email: [{email}]"); var result = await _registerQueryRepository.GetAssessmentOrganisationByContactEmail(email); return(result); }
public async Task <List <AssessmentOrganisationSummary> > Handle(SearchAssessmentOrganisationsRequest request, CancellationToken cancellationToken) { _logger.LogInformation("Handling Search AssessmentOrganisations Request"); var searchstring = _cleanser.CleanseStringForSpecialCharacters(request.SearchTerm.Trim()); if (searchstring.Length < 2) { throw new BadRequestException("The searchstring is too short to do a valid search"); } if (_validator.IsValidEpaOrganisationId(searchstring)) { _logger.LogInformation($@"Searching AssessmentOrganisations based on organisationId: [{searchstring}]"); var resultFromEpaCode = await _registerQueryRepository.GetAssessmentOrganisationsByOrganisationId(searchstring); return(resultFromEpaCode.ToList()); } IEnumerable <AssessmentOrganisationSummary> resultFromUkprn = null; if (_validator.IsValidUkprn(searchstring)) { _logger.LogInformation($@"Searching AssessmentOrganisations based on ukprn: [{searchstring}]"); resultFromUkprn = await _registerQueryRepository.GetAssessmentOrganisationsByUkprn(searchstring); } _logger.LogInformation($@"Searching AssessmentOrganisations based on name or charity number or company number wildcard: [{searchstring}]"); var resultMain = await _registerQueryRepository.GetAssessmentOrganisationsByNameOrCharityNumberOrCompanyNumber(searchstring); var result = resultMain.ToList(); if (resultFromUkprn != null) { result.AddRange(resultFromUkprn); } return(result.Distinct(new AssessmentOrganisationSummaryEqualityComparer()).Where(x => x.Status != "Applying").ToList()); }
private void ProcessRequestFieldsForSpecialCharacters(CreateEpaOrganisationStandardRequest request) { request.OrganisationId = _cleanser.CleanseStringForSpecialCharacters(request.OrganisationId?.Trim()); request.Comments = _cleanser.CleanseStringForSpecialCharacters(request.Comments?.Trim()); request.ContactId = request.ContactId?.Trim(); }
private void ProcessRequestFieldsForSpecialCharacters(CreateEpaOrganisationRequest request) { request.Name = _cleanser.CleanseStringForSpecialCharacters(request.Name); request.LegalName = _cleanser.CleanseStringForSpecialCharacters(request.LegalName); request.TradingName = _cleanser.CleanseStringForSpecialCharacters(request.TradingName); request.ProviderName = _cleanser.CleanseStringForSpecialCharacters(request.ProviderName); request.Email = _cleanser.CleanseStringForSpecialCharacters(request.Email); request.PhoneNumber = _cleanser.CleanseStringForSpecialCharacters(request.PhoneNumber); request.WebsiteLink = _cleanser.CleanseStringForSpecialCharacters(request.WebsiteLink); request.Address1 = _cleanser.CleanseStringForSpecialCharacters(request.Address1); request.Address2 = _cleanser.CleanseStringForSpecialCharacters(request.Address2); request.Address3 = _cleanser.CleanseStringForSpecialCharacters(request.Address3); request.Address4 = _cleanser.CleanseStringForSpecialCharacters(request.Address4); request.Postcode = _cleanser.CleanseStringForSpecialCharacters(request.Postcode); request.CompanyNumber = _cleanser.CleanseStringForSpecialCharacters(request.CompanyNumber); request.CharityNumber = _cleanser.CleanseStringForSpecialCharacters(request.CharityNumber); request.OrganisationReferenceType = _cleanser.CleanseStringForSpecialCharacters(request.OrganisationReferenceType); request.OrganisationReferenceId = _cleanser.CleanseStringForSpecialCharacters(request.OrganisationReferenceId); request.EndPointAssessmentOrgId = _cleanser.CleanseStringForSpecialCharacters(request.EndPointAssessmentOrgId); }
private UpdateEpaOrganisationRequest MapCommandToOrganisationRequest(CreateOrganisationContactCommand command, string organisationName, long?ukprn, int?organisationTypeId) { organisationName = _cleanser.CleanseStringForSpecialCharacters(organisationName); var organisationId = _cleanser.CleanseStringForSpecialCharacters(command.EndPointAssessorOrganisationId); var legalName = _cleanser.CleanseStringForSpecialCharacters(command.OrganisationName); var tradingName = _cleanser.CleanseStringForSpecialCharacters(command.TradingName); var email = _cleanser.CleanseStringForSpecialCharacters(command.ContactEmail); var phonenumber = _cleanser.CleanseStringForSpecialCharacters(command.ContactPhoneNumber); var website = _cleanser.CleanseStringForSpecialCharacters(command.StandardWebsite); var address1 = _cleanser.CleanseStringForSpecialCharacters(command.ContactAddress1); var address2 = _cleanser.CleanseStringForSpecialCharacters(command.ContactAddress2); var address3 = _cleanser.CleanseStringForSpecialCharacters(command.ContactAddress3); var address4 = _cleanser.CleanseStringForSpecialCharacters(command.ContactAddress4); var postcode = _cleanser.CleanseStringForSpecialCharacters(command.ContactPostcode); var companyNumber = _cleanser.CleanseStringForSpecialCharacters(command.CompanyNumber); var charityNumber = _cleanser.CleanseStringForSpecialCharacters(command.CharityNumber); if (!string.IsNullOrWhiteSpace(companyNumber)) { companyNumber = companyNumber.ToUpper(); } return(new UpdateEpaOrganisationRequest { Name = organisationName, OrganisationId = organisationId, OrganisationTypeId = organisationTypeId, Ukprn = ukprn, Status = null, LegalName = legalName, TradingName = tradingName, Email = email, PhoneNumber = phonenumber, WebsiteLink = website, Address1 = address1, Address2 = address2, Address3 = address3, Address4 = address4, Postcode = postcode, CompanyNumber = companyNumber, CharityNumber = charityNumber, FinancialDueDate = command.FinancialDueDate, FinancialExempt = command.IsFinancialExempt, ActionChoice = "ApproveApplication" // This will set: RoEPAOApproved = true }); }