コード例 #1
0
        private JobAd CreateJobAd(int index)
        {
            var jobAd = new JobAd
            {
                Id             = Guid.NewGuid(),
                Status         = JobAdStatus.Open,
                Title          = string.Format("Job Ad {0}", index),
                CreatedTime    = DateTime.Now.AddDays(-100),
                JobDescription = new JobDescription
                {
                    BulletPoints = new[] { "good verbal communication", "self management and independency", "bullet point 3" },
                    Content      =
                        "Mutley, you snickering, floppy eared hound. When courage is needed, you're never around.",
                    JobTypes   = JobTypes.FullTime,
                    Industries = new List <Industry> {
                        _industriesQuery.GetIndustry("Engineering")
                    },
                    Location = new LocationReference(_locationQuery.GetCountrySubdivision(_australia, "QLD")),
                }
            };

            _jobAdsCommand.CreateJobAd(jobAd);

            return(jobAd);
        }
コード例 #2
0
        public void RelocationTestsInitialize()
        {
            var australia = _locationQuery.GetCountry("Australia");

            _tasmania = new LocationReference(_locationQuery.GetCountrySubdivision(australia, "TAS"));
            _armadale = new LocationReference(_locationQuery.GetPostalCode(australia, "3143"));
            _malvern  = new LocationReference(_locationQuery.GetPostalSuburb(_locationQuery.GetPostalCode(australia, "3144"), "Malvern"));
        }
コード例 #3
0
 public static LocationReference Map(this ILocationReferenceEntity entity, ILocationQuery locationQuery)
 {
     return(new LocationReference(
                entity.unstructuredLocation,
                entity.namedLocationId == null ? null : locationQuery.GetNamedLocation(entity.namedLocationId.Value),
                locationQuery.GetCountrySubdivision(entity.countrySubdivisionId),
                entity.localityId == null ? null : locationQuery.GetLocality(entity.localityId.Value))
     {
         Id = entity.id
     });
 }
コード例 #4
0
ファイル: LocationMapper.cs プロジェクト: formist/LinkMe
        private void Add(ILocationQuery locationQuery, Country australia,
                         string capitalName, string stateName, string capitalId, string regionalId)
        {
            var capital = _world.GetPointSet(locationQuery.GetRegion(australia, capitalName));

            _mappings.Add(new KeyValuePair <HashSet <int>, string>(capital, capitalId));

            var state = _world.GetPointSet(locationQuery.GetCountrySubdivision(australia, stateName));

            _mappings.Add(new KeyValuePair <HashSet <int>, string>(
                              new HashSet <int>(state.Except(capital)), regionalId));
        }
コード例 #5
0
        public void TestSimpleSearch()
        {
            // Title only

            var criteria = new JobAdSearchCriteria {
                AdTitle = "ONE"
            };

            TestSearch(criteria, _one);

            // Title and content

            criteria = new JobAdSearchCriteria {
                AdTitle = "title", SortCriteria = new JobAdSearchSortCriteria {
                    SortOrder = JobAdSortOrder.CreatedTime
                }
            };
            criteria.SetKeywords("content");
            TestSearch(criteria, _two, _one);

            // Content and Locality

            GeographicalArea area = _locationQuery.GetPostalCode(_australia, "3143").Locality;

            criteria = new JobAdSearchCriteria {
                Location = new LocationReference(area)
            };
            criteria.SetKeywords("ad AND content");
            TestSearch(criteria, _one);

            // State

            area     = _locationQuery.GetCountrySubdivision(_australia, "NSW");
            criteria = new JobAdSearchCriteria {
                Location = new LocationReference(area)
            };
            TestSearch(criteria, _two);

            // No results

            criteria = new JobAdSearchCriteria {
                AdTitle = "one"
            };
            criteria.SetKeywords("second");
            TestSearch(criteria);
        }
コード例 #6
0
        protected void OnLocationLoaded(SearchCriteria criteria)
        {
            var criteriaLocation = criteria as ISearchCriteriaLocation;

            if (criteriaLocation == null)
            {
                return;
            }

            // "255" is reserved for "anywhere"

            if (criteriaLocation.CountryId == 255)
            {
                return;
            }

            // Old alerts store location in different ways so try to use them.

            if (criteriaLocation.Area != null)
            {
                var area = _locationQuery.GetGeographicalArea(criteriaLocation.Area.Value, true);
                criteriaLocation.Location = new LocationReference(area);
                return;
            }

            // Country, default to Australia if not found.

            var country = criteriaLocation.CountryId != null
                ? _locationQuery.GetCountry(criteriaLocation.CountryId.Value)
                : null;

            var postcode = criteriaLocation.Postcode;
            var state    = criteriaLocation.State;
            var location = criteriaLocation.LocationText;

            if (!string.IsNullOrEmpty(postcode))
            {
                // If only the postcode is set then use that.

                if (string.IsNullOrEmpty(state) && string.IsNullOrEmpty(location))
                {
                    var postalCode = _locationQuery.GetPostalCode(country ?? _locationQuery.GetCountry("Australia"), criteriaLocation.Postcode);
                    if (postalCode != null)
                    {
                        criteriaLocation.Location = new LocationReference(postalCode.Locality);
                        return;
                    }
                }
            }

            if (!string.IsNullOrEmpty(criteriaLocation.State))
            {
                // If only the state is set then use that.

                if (string.IsNullOrEmpty(postcode) && string.IsNullOrEmpty(location))
                {
                    var countrySubdivision = _locationQuery.GetCountrySubdivision(country ?? _locationQuery.GetCountry("Australia"), criteriaLocation.State);
                    if (countrySubdivision != null)
                    {
                        criteriaLocation.Location = new LocationReference(countrySubdivision);
                        return;
                    }
                }
            }

            // Standard way.

            if (country == null && string.IsNullOrEmpty(postcode) && string.IsNullOrEmpty(state) && string.IsNullOrEmpty(location))
            {
                return;
            }

            // Put in everything.

            if (string.IsNullOrEmpty(location))
            {
                location = string.Empty;
            }
            if (!string.IsNullOrEmpty(postcode))
            {
                location += " " + postcode;
            }
            if (!string.IsNullOrEmpty(state))
            {
                location += " " + state;
            }

            criteriaLocation.Location = _locationQuery.ResolveLocation(country ?? _locationQuery.GetCountry("Australia"), location);
        }
コード例 #7
0
ファイル: LocationFilterTests.cs プロジェクト: formist/LinkMe
        public static void ClassInitialize(TestContext context)
        {
            _indexWriter = new IndexWriter(new RAMDirectory(), new SimpleAnalyzer(), IndexWriter.MaxFieldLength.UNLIMITED);

            _australia     = LocationQuery.GetCountry("Australia");
            _victoria      = new LocationReference(LocationQuery.GetCountrySubdivision(_australia, "VIC"));
            _tasmania      = new LocationReference(LocationQuery.GetCountrySubdivision(_australia, "TAS"));
            _queensland    = new LocationReference(LocationQuery.GetCountrySubdivision(_australia, "QLD"));
            _devonport     = new LocationReference(LocationQuery.GetPostalCode(_australia, "7310").Locality);
            _hobart        = new LocationReference(LocationQuery.GetRegion(_australia, "Hobart"));
            _melbourne     = new LocationReference(LocationQuery.GetRegion(_australia, "Melbourne"));
            _goldCoast     = new LocationReference(LocationQuery.GetRegion(_australia, "Gold Coast"));
            _nearGoldCoast = new LocationReference(LocationQuery.GetPostalCode(_australia, "4227").Locality);
            _armadale      = new LocationReference(LocationQuery.GetPostalCode(_australia, "3143"));
            _malvern       = new LocationReference(LocationQuery.GetPostalSuburb(LocationQuery.GetPostalCode(_australia, "3144"), "Malvern"));
            _nearArmadale  = new LocationReference(LocationQuery.GetPostalCode(_australia, "3181").Locality);

            _indexer = new Indexer(new MemberSearchBooster(), LocationQuery, Resolve <IIndustriesQuery>(), null);

            // Zero - not willing to relocate.
            _zero = Guid.NewGuid();
            IndexContent(new MemberContent
            {
                Member = new Member {
                    Id = _zero, Address = new Address {
                        Location = ResolvePostalSuburb("Malvern VIC")
                    }
                },
                Candidate = new Candidate(),
            });

            // One - in NSW, but willing to relocate to Armadale or Malvern or TAS
            _one = Guid.NewGuid();
            IndexContent(new MemberContent
            {
                Member = new Member {
                    Id = _one, Address = new Address {
                        Location = ResolvePostalSuburb("Woolloomooloo NSW"),
                    }
                },
                Candidate = new Candidate {
                    RelocationPreference = RelocationPreference.Yes, RelocationLocations = new[] { _armadale, _malvern, _tasmania }
                },
            });

            // Three - would consider relocating anywhere in Australia
            _three = Guid.NewGuid();
            IndexContent(new MemberContent
            {
                Member = new Member {
                    Id = _three, Address = new Address {
                        Location = ResolvePostalSuburb("Caulfield VIC"),
                    }
                },
                Candidate = new Candidate {
                    RelocationPreference = RelocationPreference.Yes, RelocationLocations = new[] { new LocationReference(LocationQuery.GetCountrySubdivision(_australia, null)) }
                },
            });

            // Four - "would consider" relocating to Gold Coast (region)
            _four = Guid.NewGuid();
            IndexContent(new MemberContent
            {
                Member = new Member {
                    Id = _four, Address = new Address {
                        Location = ResolvePostalSuburb("VIC"),
                    }
                },
                Candidate = new Candidate {
                    RelocationPreference = RelocationPreference.Yes, RelocationLocations = new[] { _goldCoast }
                },
            });

            _indexSearcher = new IndexSearcher(_indexWriter.getReader());
        }