private Employer CreateLogin(int index) { var firstName = string.Format(FirstNameFormat, index); var lastName = string.Format(LastNameFormat, index); _loginIdTextBox.Text = string.Format(LoginIdFormat, index); _passwordTextBox.Text = Password; _emailAddressTextBox.Text = string.Format(EmailAddressFormat, index); _firstNameTextBox.Text = firstName; _lastNameTextBox.Text = lastName; _phoneNumberTextBox.Text = string.Format(PhoneNumberFormat, index); _jobTitleTextBox.Text = string.Format(JobTitleFormat, index); _industryIdDropDownList.SelectedIndex = index + 1; _createButton.Click(); AssertConfirmationMessage("The account for " + firstName + " " + lastName + " has been created."); return(new Employer { EmailAddress = new EmailAddress { Address = string.Format(EmailAddressFormat, index), IsVerified = true }, FirstName = firstName, LastName = lastName, PhoneNumber = new PhoneNumber { Number = string.Format(PhoneNumberFormat, index), Type = PhoneNumberType.Work }, JobTitle = string.Format(JobTitleFormat, index), SubRole = EmployerSubRole.Recruiter, Industries = new List <Industry> { _industriesQuery.GetIndustryByAnyName(_industryIdDropDownList.Items[index + 1].Text) } }); }
private IEnumerable <Guid> GetIndustryIds(string industries) { if (string.IsNullOrEmpty(industries)) { return(null); } var ids = new List <Guid>(); foreach (var name in industries.Split('|')) { if (string.IsNullOrEmpty(name)) { continue; } var industry = _industriesQuery.GetIndustryByAnyName(name); if (industry == null) { var sb = new StringBuilder(); sb.AppendFormat("The '{0}' industry is unknown.", name); throw new UserException(sb.ToString()); } ids.Add(industry.Id); } return(ids); }
private void ConvertIndustries(ISearchCriteriaIndustries criteriaIndustries) { // Convert a list of names into a list of ids. criteriaIndustries.IndustryIds = null; var names = criteriaIndustries.Industries.Split(new[] { "," }, StringSplitOptions.RemoveEmptyEntries); var list = new List <Guid>(); foreach (var name in names) { // Try the name first. var industry = _industriesQuery.GetIndustryByAnyName(name.Trim()); if (industry != null) { list.Add(industry.Id); } else { // Try as a Guid. try { var id = new Guid(name); industry = _industriesQuery.GetIndustry(id); if (industry != null) { list.Add(industry.Id); } } catch (Exception) { } } } if (list.Count > 0) { criteriaIndustries.IndustryIds = list; } }
public static JobAd Map(this JobAdElement jobAd, IIndustriesQuery industriesQuery, ILocationQuery locationQuery) { return(new JobAd { Title = jobAd.Title, // If no status is supplied assume it is open. Status = jobAd.Status == null ? JobAdStatus.Open : jobAd.Status.Value, ContactDetails = MapContactDetails(jobAd.ContactDetails), Integration = { ExternalApplyUrl = jobAd.ExternalApplyUrl, ExternalReferenceId = jobAd.ExternalReferenceId, }, Description = { CompanyName = jobAd.EmployerCompanyName, BulletPoints = jobAd.BulletPoints, Content = jobAd.Content, Industries = jobAd.Industries != null ? (from n in jobAd.Industries let i = industriesQuery.GetIndustryByAnyName(n) where i != null select i).ToList() : null, JobTypes = jobAd.JobTypes, Location = Map(jobAd.Location, jobAd.Postcode, locationQuery), Package = jobAd.PackageDetails, PositionTitle = jobAd.PositionTitle, ResidencyRequired = jobAd.ResidencyRequired, Salary = jobAd.Salary != null ? new Salary { LowerBound = jobAd.Salary.LowerBound, UpperBound = jobAd.Salary.UpperBound,Rate = jobAd.Salary.Rate, Currency = Currency.AUD } : null, Summary = jobAd.Summary, }, }); }
public void TestGetIndustryByAnyName() { // Find an industry that has no aliases. var industry = _industriesQuery.GetIndustries().First(i => i.Aliases.Count == 0 && i.UrlAliases.Count == 0); AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(industry.Name)); AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(industry.ShortName)); AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(industry.UrlName)); // Find an industry that has an alias. industry = _industriesQuery.GetIndustries().First(i => i.Aliases.Count > 0); AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(industry.Name)); AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(industry.ShortName)); AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(industry.UrlName)); foreach (var alias in industry.Aliases) { AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(alias)); } // Find an industry that has a url alias. industry = _industriesQuery.GetIndustries().First(i => i.UrlAliases.Count > 0); AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(industry.Name)); AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(industry.ShortName)); AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(industry.UrlName)); foreach (var urlAlias in industry.UrlAliases) { AssertAreEqual(industry, _industriesQuery.GetIndustryByAnyName(urlAlias)); } }