Пример #1
0
        /// <summary>
        /// Updates a Rock location to match an Ideal Postcodes ResultAddress
        /// </summary>
        /// <param name="location">The Rock location to be modified</param>
        /// <param name="address">The IdeaL Postcodes ResultAddress to copy the data from</param>
        /// <returns>Whether the Location was succesfully geocoded</returns>
        public bool UpdateLocation(Rock.Model.Location location, ResultAddress address)
        {
            location.Street1 = address.line_1;
            location.Street2 = address.line_2;
            if (!string.IsNullOrWhiteSpace(address.dependant_locality) && address.dependant_locality != address.line_2)
            {
                location.City = address.dependant_locality;
            }
            else
            {
                string city = address.post_town;
                city          = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(city.ToLower());
                location.City = city;
            }

            location.State                = address.county;
            location.PostalCode           = address.postcode;
            location.StandardizedDateTime = RockDateTime.Now;

            // If ResultAddress has geocoding data set it on Location
            if (address.latitude.HasValue && address.longitude.HasValue)
            {
                bool setLocationResult = location.SetLocationPointFromLatLong(address.latitude.Value, address.longitude.Value);
                if (setLocationResult)
                {
                    location.GeocodedDateTime = RockDateTime.Now;
                }
                return(setLocationResult);
            }
            return(false);
        }
Пример #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (instruction_ != null)
            {
                hash ^= Instruction.GetHashCode();
            }
            hash ^= operandShapes_.GetHashCode();
            if (ResultAddress != 0UL)
            {
                hash ^= ResultAddress.GetHashCode();
            }
            hash ^= operandAddresses_.GetHashCode();
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }