Пример #1
0
        public IndexedLocation UpdateLocation(IndexedLocation UpdatedIndexedLocation)
        {
            var entity = UpdatedIndexedLocation.ConvertToEditableLocation();
            var result = this.UpdateLocation(entity);

            return(new IndexedLocation(result));
        }
Пример #2
0
        internal static IEnumerable <SearchedLocation> ExamineToSearchedLocations(ISearchResults SearchResults)
        {
            var returnList = new List <SearchedLocation>();

            // check that there are any search results
            if (SearchResults.TotalItemCount > 0)
            {
                // iterate through the search results
                foreach (SearchResult result in SearchResults)
                {
                    var sl = new SearchedLocation();
                    sl.ExamineNodeId = result.Id;
                    sl.SearchScore   = result.Score;

                    var location = new IndexedLocation();
                    location.IndexNodeId      = result.Id;
                    location.Key              = result.Fields.ContainsKey("Key") ? new Guid(result.Fields["Key"]) : Guid.Empty;
                    location.Name             = result.Fields.ContainsKey("Name") ? result.Fields["Name"] : string.Empty;
                    location.LocationTypeKey  = result.Fields.ContainsKey("LocationTypeKey") ? new Guid(result.Fields["LocationTypeKey"]) : Guid.Empty;
                    location.LocationTypeName = result.Fields.ContainsKey("LocationTypeName") ? result.Fields["LocationTypeName"] : string.Empty;
                    location.Latitude         = result.Fields.ContainsKey("Latitude") ? System.Convert.ToDouble(result.Fields["Latitude"]) : 0;
                    location.Longitude        = result.Fields.ContainsKey("Longitude") ? System.Convert.ToDouble(result.Fields["Longitude"]) : 0;
                    location.Address1         = result.Fields.ContainsKey("Address1") ? result.Fields["Address1"] : string.Empty;
                    location.Address2         = result.Fields.ContainsKey("Address2") ? result.Fields["Address2"] : string.Empty;
                    location.Locality         = result.Fields.ContainsKey("Locality") ? result.Fields["Locality"] : string.Empty;
                    location.Region           = result.Fields.ContainsKey("Region") ? result.Fields["Region"] : string.Empty;
                    location.PostalCode       = result.Fields.ContainsKey("PostalCode") ? result.Fields["PostalCode"] : string.Empty;
                    location.CountryCode      = result.Fields.ContainsKey("CountryCode") ? result.Fields["CountryCode"] : string.Empty;
                    location.Email            = result.Fields.ContainsKey("Email") ? result.Fields["Email"] : string.Empty;
                    location.Phone            = result.Fields.ContainsKey("Phone") ? result.Fields["Phone"] : string.Empty;

                    //Handle Custom properties
                    List <IndexedPropertyData> customProps;

                    if (result.Fields.ContainsKey("CustomPropertyData"))
                    {
                        customProps = ExamineCustomPropsToIndexedProps(result.Fields["CustomPropertyData"]);
                    }
                    else
                    {
                        customProps = new List <IndexedPropertyData>();
                    }

                    location.CustomPropertyData = customProps;

                    //Add all properties to Dictionary
                    location.AllPropertiesDictionary = AllPropertiesToDictionary(result.Fields, customProps);

                    // add the location to SL
                    sl.IndexedLocation = location;

                    //add to list
                    returnList.Add(sl);
                }
            }

            return(returnList);
        }
Пример #3
0
        public IndexedLocation Update(IndexedLocation updatedLocation)
        {
            //OLD
            //var key = updatedLocation.Key;
            //var entity = updatedLocation.ConvertToEditableLocation();
            //Repositories.LocationRepo.Update(entity);
            //var result = Repositories.LocationRepo.GetByKey(key);

            var result = locationService.UpdateLocation(updatedLocation);

            return(result);
        }
        public void NoIndexedLocationInsertsCreatesNewIndexedLocation()
        {
            var indexedLocation = "indexedLocation";
            var service         = new IndexedLocation("TestMosaicDatabase");
            var request         = new IndexedLocationRequest()
            {
                IndexedLocation = indexedLocation
            };

            service.UpdateIndexedLocation(request);

            var response = service.ReadIndexedLocation();

            Assert.AreEqual(indexedLocation, response.IndexedLocation);
        }
    public override int GetHashCode()
    {
        int hash = 1;

        if (IndexedLocation.Length != 0)
        {
            hash ^= IndexedLocation.GetHashCode();
        }
        if (Error.Length != 0)
        {
            hash ^= Error.GetHashCode();
        }
        if (_unknownFields != null)
        {
            hash ^= _unknownFields.GetHashCode();
        }
        return(hash);
    }
        public void OneIndexedLocationInsertReplacesIndexedLocation()
        {
            var oldIndexedLocation = "oldIndexedLocation";
            var newIndexedLocation = "newIndexedLocation";
            var service            = new IndexedLocation("TestMosaicDatabase");

            var request1 = new IndexedLocationRequest()
            {
                IndexedLocation = oldIndexedLocation
            };

            service.UpdateIndexedLocation(request1);

            var request2 = new IndexedLocationRequest()
            {
                IndexedLocation = newIndexedLocation
            };

            service.UpdateIndexedLocation(request2);

            var response = service.ReadIndexedLocation();

            Assert.AreEqual(newIndexedLocation, response.IndexedLocation);
        }