예제 #1
0
        public ActionResult Candidates()
        {
            var country = ActivityContext.Location.Country;

            return(View(new CandidatesModel
            {
                Country = country,
                CountrySubdivisions = _locationQuery.GetCountrySubdivisions(country).Where(s => !s.IsCountry).ToList(),
                Regions = _locationQuery.GetRegions(country),
                SalaryBands = GetSalaryBands(),
            }));
        }
예제 #2
0
        public ActionResult JobAds()
        {
            var country = ActivityContext.Location.Country;

            return(View(new JobAdsModel
            {
                Country = country,
                CountrySubdivisions = _locationQuery.GetCountrySubdivisions(country).Where(s => !s.IsCountry).ToList(),
                Regions = _locationQuery.GetRegions(country),
                Industries = _industriesQuery.GetIndustries(),
            }));
        }
예제 #3
0
        private HomeModel CreateHomeModel(UserType preferredUserType, Login login, MemberJoin join, bool acceptTerms)
        {
            var country = ActivityContext.Location.Country;

            var qna = _resourcesQuery.GetQnA(_resourcesQuery.GetFeaturedQnAs().Single().ResourceId);

            return(new HomeModel
            {
                PreferredUserType = preferredUserType,
                Login = login,
                Join = join,
                AcceptTerms = acceptTerms,
                Reference = new ReferenceModel
                {
                    MinSalary = JobAdSearchCriteria.MinSalary,
                    MaxSalary = JobAdSearchCriteria.MaxSalary,
                    StepSalary = JobAdSearchCriteria.StepSalary,
                    MinHourlySalary = JobAdSearchCriteria.MinHourlySalary,
                    MaxHourlySalary = JobAdSearchCriteria.MaxHourlySalary,
                    StepHourlySalary = JobAdSearchCriteria.StepHourlySalary,
                    Industries = GetIndustries(),
                    FeaturedStatistics = GetFeaturedStatistics(),
                    FeaturedEmployers = GetFeaturedEmployers(),
                    FeaturedJobAds = GetFeaturedJobAds(),
                    FeaturedCandidateSearches = GetFeaturedCandidateSearches(),
                    Countries = _locationQuery.GetCountries(),
                    CountrySubdivisions = (from s in _locationQuery.GetCountrySubdivisions(country) where !s.IsCountry select s).ToList(),
                    Regions = _locationQuery.GetRegions(country),
                    DefaultCountry = country,
                    FeaturedAnsweredQuestion = qna,
                    Categories = _resourcesQuery.GetCategories(),
                }
            });
        }
예제 #4
0
        private SearchAncillaryModel GetAncillaryData()
        {
            var country = ActivityContext.Location.Country;

            var ancillaryModel = new SearchAncillaryModel
            {
                Countries           = _locationQuery.GetCountries(),
                Industries          = _industriesQuery.GetIndustries(),
                Distances           = Reference.Distances,
                DefaultDistance     = JobAdSearchCriteria.DefaultDistance,
                DefaultCountry      = ActivityContext.Location.Country,
                Recencies           = Recencies,
                DefaultRecency      = JobAdSearchCriteria.DefaultRecency,
                MaxRecency          = JobAdSearchCriteria.MaxRecency,
                MinSalary           = JobAdSearchCriteria.MinSalary,
                MaxSalary           = JobAdSearchCriteria.MaxSalary,
                StepSalary          = JobAdSearchCriteria.StepSalary,
                MinHourlySalary     = JobAdSearchCriteria.MinHourlySalary,
                MaxHourlySalary     = JobAdSearchCriteria.MaxHourlySalary,
                StepHourlySalary    = JobAdSearchCriteria.StepHourlySalary,
                CountrySubdivisions = (from s in _locationQuery.GetCountrySubdivisions(country)
                                       where !s.IsCountry
                                       select s).ToList(),
                Regions = _locationQuery.GetRegions(country)
            };

            return(ancillaryModel);
        }
예제 #5
0
        private JobDetailsModel GetJobDetailsModel(Guid?memberId, JobDetailsMemberModel memberModel, int?externalReferralSourceId)
        {
            var model = GetModel <JobDetailsModel>(memberId);

            model.Member = memberModel;

            // Referral.

            model.ExternalReferralSourceId = externalReferralSourceId;
            model.SendSuggestedJobs        = Pageflow.SendSuggestedJobs == null ? Defaults.SendSuggestedJobs : Pageflow.SendSuggestedJobs.Value;

            // Referance.

            var country = ActivityContext.Location.Country;

            model.Reference = new JobDetailsReferenceModel
            {
                Countries           = _locationQuery.GetCountries(),
                CurrentCountry      = country,
                CountrySubdivisions = (from s in _locationQuery.GetCountrySubdivisions(country) where !s.IsCountry select s).ToList(),
                Regions             = _locationQuery.GetRegions(country),
                Industries          = _industriesQuery.GetIndustries(),
                Months = Months,
                Years  = Years,
                ExternalReferralSources = _referralsQuery.GetExternalReferralSources(),
            };

            return(model);
        }
예제 #6
0
        private DesiredJobModel CreateDesiredJobModel(IMember member, ICandidate candidate, IList <Country> countries)
        {
            var visibility = member.VisibilitySettings.Professional.EmploymentVisibility;
            var country    = ActivityContext.Location.Country;

            return(new DesiredJobModel
            {
                Member = new DesiredJobMemberModel
                {
                    SendSuggestedJobs = GetSuggestedJobsEmailSetting(member.Id),
                    DesiredJobTitle = candidate.DesiredJobTitle,
                    DesiredJobTypes = candidate.DesiredJobTypes,
                    Status = candidate.Status,
                    DesiredSalaryLowerBound = candidate.DesiredSalary == null ? null : candidate.DesiredSalary.LowerBound,
                    DesiredSalaryRate = candidate.DesiredSalary == null ? Defaults.DesiredSalaryRate : candidate.DesiredSalary.Rate,
                    IsSalaryNotVisible = !visibility.IsFlagSet(ProfessionalVisibility.Salary),
                    RelocationPreference = candidate.RelocationPreference,
                    RelocationCountryIds = candidate.RelocationLocations.GetRelocationCountryIds(),
                    RelocationCountryLocationIds = candidate.RelocationLocations.GetRelocationCountryLocationIds(country),
                },
                Reference = new DesiredJobReferenceModel
                {
                    Countries = countries,
                    CountrySubdivisions = (from s in _locationQuery.GetCountrySubdivisions(country) where !s.IsCountry select s).ToList(),
                    Regions = _locationQuery.GetRegions(country),
                    CurrentCountry = country,
                    SalaryRates = SalaryRates,
                },
            });
        }
예제 #7
0
        public ActionResult Home()
        {
            var country = ActivityContext.Location.Country;

            return(View(new HomeModel
            {
                Reference = new ReferenceModel
                {
                    MinSalary = JobAdSearchCriteria.MinSalary,
                    MaxSalary = JobAdSearchCriteria.MaxSalary,
                    StepSalary = JobAdSearchCriteria.StepSalary,
                    MinHourlySalary = JobAdSearchCriteria.MinHourlySalary,
                    MaxHourlySalary = JobAdSearchCriteria.MaxHourlySalary,
                    StepHourlySalary = JobAdSearchCriteria.StepHourlySalary,
                    Countries = _locationQuery.GetCountries(),
                    CountrySubdivisions = (from s in _locationQuery.GetCountrySubdivisions(country) where !s.IsCountry select s).ToList(),
                    Regions = _locationQuery.GetRegions(country),
                    DefaultCountry = country,
                },
                RecentSearches = GetRecentSearchesModel()
            }));
        }
예제 #8
0
        protected override void ProcessRequestImpl(HttpContext context)
        {
            context.Response.ContentType = "text/html";

            // Extract the parameters.

            string location  = context.Request.QueryString[LocationParameter];
            int    maximum   = ParseUtil.ParseUserInputInt32Optional(context.Request.QueryString[MaximumParameter], MaximumParameter, MaximumDefault);
            int    countryId = ParseUtil.ParseUserInputInt32Optional(context.Request.QueryString[CountryParameter], CountryParameter, /*RequestContext.Current.LocationContext.Country*/ _locationQuery.GetCountry("Australia").Id);

            Country country = _locationQuery.GetCountry(countryId);

            if (country == null)
            {
                throw new ServiceEndUserException(String.Format(ValidationErrorMessages.INVALID_COUNTRY_ID_SPECIFIED, countryId));
            }

            // Get the matches.

            IList <PartialMatch> locations;

            if (String.IsNullOrEmpty(location))
            {
                // An empty location means get all subdivisions and regions with no limitation.

                locations = new List <PartialMatch>();
                Add(_locationQuery.GetCountrySubdivisions(country), locations);
                Add(_locationQuery.GetRegions(country), locations);
            }
            else
            {
                // Get the partially matching locations.

                locations = _locationQuery.FindPartialMatchedLocations(country, location, maximum);
            }

            context.Response.Write(GetRecords(locations));
        }
예제 #9
0
        public void BuildUp(ILocationQuery locationQuery, bool includeDistances)
        {
            Clear();

            // Create points in our metric space.
            // The points are Localities and empty Countries.
            // The distance between an empty countries and any other entity is presumed to be infinite.

            var localities     = new List <Locality>();
            var emptyCountries = new List <Country>();

            foreach (var country in locationQuery.GetCountries())
            {
                var countryLocalities = locationQuery.GetLocalities(country);
                if (countryLocalities.Count > 0)
                {
                    localities.AddRange(countryLocalities);
                }
                else
                {
                    emptyCountries.Add(country);
                }
            }

            _localityCount = localities.Count;
            var pointCount = localities.Count + emptyCountries.Count;

            _points = Enumerable.Range(0, pointCount);

            if (includeDistances)
            {
                // Calculate distances between localities.

                _distances = new short[_localityCount][];

                for (var i = 0; i < _localityCount; i++)
                {
                    _distances[i] = new short[i];

                    for (var j = 0; j < i; j++)
                    {
                        _distances[i][j] = (short)Math.Round(EarthDistance(
                                                                 localities[i].Centroid.Latitude,
                                                                 localities[i].Centroid.Longitude,
                                                                 localities[j].Centroid.Latitude,
                                                                 localities[j].Centroid.Longitude));
                    }
                }
            }

            // Add Localities.

            _subsets = new Dictionary <int, HashSet <int> >();

            for (var i = 0; i < _localityCount; i++)
            {
                var subset = new HashSet <int> {
                    i
                };
                _subsets.Add(localities[i].Id, subset);
            }

            // Add empty Countries.

            for (var i = 0; i < emptyCountries.Count; i++)
            {
                var subset = new HashSet <int> {
                    _localityCount + i
                };
                _subsets.Add(emptyCountries[i].Id, subset);
            }

            // Add CountrySubdivisions.

            foreach (var locality in localities)
            {
                foreach (var countrySubdivision in locality.CountrySubdivisions)
                {
                    HashSet <int> subset;
                    if (!_subsets.TryGetValue(countrySubdivision.Id, out subset))
                    {
                        subset = new HashSet <int>();
                        _subsets.Add(countrySubdivision.Id, subset);
                    }

                    subset.Add(GetLocalityPoint(locality.Id));
                }
            }

#if DEBUG
            // Check that there are no empty CountrySubdivisions.

            foreach (var country in locationQuery.GetCountries())
            {
                foreach (var countrySubdivision in locationQuery.GetCountrySubdivisions(country))
                {
                    if (countrySubdivision.Id != 1)
                    {
                        Debug.Assert(_subsets[countrySubdivision.Id].Count > 0);
                    }
                }
            }
#endif

            // Add Countries.

            foreach (var country in locationQuery.GetCountries())
            {
                var subset = new HashSet <int>();

                foreach (var locality in locationQuery.GetLocalities(country))
                {
                    subset.Add(GetLocalityPoint(locality.Id));
                }

                if (subset.Count > 0)
                {
                    _subsets.Add(country.Id, subset);
                }
            }

            // Add Regions.

            foreach (var country in locationQuery.GetCountries())
            {
                foreach (var region in locationQuery.GetRegions(country))
                {
                    var subset = new HashSet <int>();

                    foreach (Locality locality in locationQuery.GetLocalities(region))
                    {
                        subset.Add(GetLocalityPoint(locality.Id));
                    }

                    Debug.Assert(subset.Count > 0);
                    _subsets.Add(region.Id, subset);
                }
            }

            _maxPointSetId = _subsets.Max(kvp => kvp.Key);
        }