示例#1
0
        public Location GetLocation(string locationCode)
        {
            var locationSearcher = ExamineManager.Instance.SearchProviderCollection[SearchProvider];
            var locationSearchCriteria = locationSearcher.CreateSearchCriteria();
            var locationQuery = locationSearchCriteria.Field("locationName", locationCode);
            var locationSearchResults = locationSearcher.Search(locationQuery.Compile());

            var location = new Location();

            if (locationSearchResults.Count() == 1)
            {
                location.Title = locationSearchResults.First().Fields["nodeName"];
                location.Email = locationSearchResults.First().Fields["emailAddress"];
                location.Code = locationSearchResults.First().Fields["nodeName"];
            }
            return location;
        }
示例#2
0
 public Location GetLocation(string locationCode)
 {
     //TODO: none of the Examine config should be hard-coded
     var locSearcher = ExamineManager.Instance.SearchProviderCollection[SearchProvider];
     var locSearchCriteria = locSearcher.CreateSearchCriteria();
     var locQuery = locSearchCriteria.NodeTypeAlias(NodeTypeAlias);
     locQuery = locQuery.And().Field("centreInitials", locationCode);
     var locSearchResults = locSearcher.Search(locQuery.Compile());
     var location = new Location();
     if (locSearchResults.Any())
     {
         //TODO:make sure the fields exist!
         location.Title = locSearchResults.First().Fields["nodeName"];
         location.Code = locSearchResults.First().Fields["centreInitials"];
         location.Email = locSearchResults.First().Fields["centreEmail"];
     }
     else
     {
         location.Title = locationCode;
     }
     return location;
 }
示例#3
0
        public List<Location> GetLocations()
        {
            var locationList = new List<Location>();

            var locationSearcher = ExamineManager.Instance.SearchProviderCollection[SearchProvider];
            var locationSearchCriteria = locationSearcher.CreateSearchCriteria();
            var locationQuery = locationSearchCriteria.NodeTypeAlias(NodeTypeAlias);
            var locationSearchResults = locationSearcher.Search(locationQuery.Compile());

            foreach (var location in locationSearchResults)
            {
                var locationtoAdd =
                    new Location
                        {
                            Title = location.Fields["nodeName"],
                            Email = location.Fields["emailAddress"],
                            Code = location.Fields["nodeName"]
                        };
                locationList.Add(locationtoAdd);
            }

            return locationList;
        }