Esempio n. 1
0
        private void AddFamilyLocation( int rockFamilyId, PersonAddress personAddress)
        {
            RockMaps.LocationMap locationMap = new RockMaps.LocationMap( Service );
            Address arenaAddress = personAddress.Address;
            int? rockLocationId = null;
            Dictionary<string, object> rockLocation = locationMap.GetByForeignId( arenaAddress.address_id.ToString() );

            if ( rockLocation != null )
            {
                rockLocationId = (int)rockLocation["Id"];
            }
            else
            {
                rockLocationId = locationMap.SaveAddress( arenaAddress.street_address_1, arenaAddress.city, arenaAddress.state, arenaAddress.country,
                        arenaAddress.postal_code, arenaAddress.street_address_2, arenaAddress.Latitude, arenaAddress.Longitude, arenaAddress.address_id.ToString(), isActive: true );
            }

            if ( rockLocationId != null )
            {
                RockMaps.GroupLocationMap glMap = new RockMaps.GroupLocationMap( Service );

                if ( glMap.GetGroupLocationByGroupIdLocationId( rockFamilyId, (int)rockLocationId ).Count > 0 )
                {
                    return;
                }
                else
                {
                    glMap.SaveGroupLocation( rockFamilyId, (int)rockLocationId, GetDefinedValueIdByForeignId(personAddress.address_type_luid), null, true, true );
                }
            }
        }
Esempio n. 2
0
        private int? SaveCampusLocation( string campusName, Model.Address a )
        {
            RockMap.LocationMap locationMap = new RockMap.LocationMap( Service );

            Dictionary<string,object> rockLocation = locationMap.GetByForeignId( a.address_id.ToString() );

            if ( rockLocation != null )
            {
                return (int)rockLocation["Id"];
            }

            int? addressid = locationMap.SaveAddress( a.street_address_1, a.city, a.state, a.country, a.postal_code, a.street_address_2, a.Latitude,
                a.Longitude, a.address_id.ToString(), campusName, true, null, null, locationMap.GetCampusLocationDefinedValueId() );

            return addressid;
        }