当前位置: 首页>>代码示例>>C#>>正文


C# Location.GetFullStreetAddress方法代码示例

本文整理汇总了C#中Location.GetFullStreetAddress方法的典型用法代码示例。如果您正苦于以下问题:C# Location.GetFullStreetAddress方法的具体用法?C# Location.GetFullStreetAddress怎么用?C# Location.GetFullStreetAddress使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Location的用法示例。


在下文中一共展示了Location.GetFullStreetAddress方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ShowReadonlyDetails

        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="location">The location.</param>
        private void ShowReadonlyDetails( Location location )
        {
            SetEditMode( false );

            hfLocationId.SetValue( location.Id );

            if ( string.IsNullOrWhiteSpace( location.Name ) )
            {
                lReadOnlyTitle.Text = location.ToString().FormatAsHtmlTitle();
            }
            else
            {
                lReadOnlyTitle.Text = location.Name.FormatAsHtmlTitle();
            }

            hlInactive.Visible = !location.IsActive;
            if ( location.LocationTypeValue != null )
            {
                hlType.Text = location.LocationTypeValue.Value;
                hlType.Visible = true;
            }
            else
            {
                hlType.Visible = false;
            }

            string imgTag = GetImageTag( location.ImageId, 150, 150 );
            if ( location.ImageId.HasValue )
            {
                string imageUrl = ResolveRockUrl( String.Format( "~/GetImage.ashx?id={0}", location.ImageId.Value ) );
                lImage.Text = string.Format( "<a href='{0}'>{1}</a>", imageUrl, imgTag );
            }
            else
            {
                lImage.Text = imgTag;
            }

            DescriptionList descriptionList = new DescriptionList();

            if ( location.ParentLocation != null )
            {
                descriptionList.Add( "Parent Location", location.ParentLocation.Name );
            }

            if ( location.LocationTypeValue != null )
            {
                descriptionList.Add( "Location Type", location.LocationTypeValue.Value );
            }

            if ( location.PrinterDevice != null )
            {
                descriptionList.Add( "Printer", location.PrinterDevice.Name );
            }

            string fullAddress = location.GetFullStreetAddress().ConvertCrLfToHtmlBr();
            if ( !string.IsNullOrWhiteSpace( fullAddress ) )
            {
                descriptionList.Add( "Address", fullAddress );
            }

            lblMainDetails.Text = descriptionList.Html;

            location.LoadAttributes();
            Rock.Attribute.Helper.AddDisplayControls( location, phAttributes );

            phMaps.Controls.Clear();
            var mapStyleValue = DefinedValueCache.Read( GetAttributeValue( "MapStyle" ) );
            if ( mapStyleValue == null )
            {
                mapStyleValue = DefinedValueCache.Read( Rock.SystemGuid.DefinedValue.MAP_STYLE_ROCK );
            }

            if ( mapStyleValue != null )
            {
                string mapStyle = mapStyleValue.GetAttributeValue( "StaticMapStyle" );

                if ( !string.IsNullOrWhiteSpace( mapStyle ) )
                {
                    if ( location.GeoPoint != null )
                    {
                        string markerPoints = string.Format( "{0},{1}", location.GeoPoint.Latitude, location.GeoPoint.Longitude );
                        string mapLink = System.Text.RegularExpressions.Regex.Replace( mapStyle, @"\{\s*MarkerPoints\s*\}", markerPoints );
                        mapLink = System.Text.RegularExpressions.Regex.Replace( mapLink, @"\{\s*PolygonPoints\s*\}", string.Empty );
                        mapLink += "&sensor=false&size=350x200&zoom=13&format=png";
                        phMaps.Controls.Add( new LiteralControl ( string.Format( "<div class='group-location-map'><img src='{0}'/></div>", mapLink ) ) );
                    }

                    if ( location.GeoFence != null )
                    {
                        string polygonPoints = "enc:" + location.EncodeGooglePolygon();
                        string mapLink = System.Text.RegularExpressions.Regex.Replace( mapStyle, @"\{\s*MarkerPoints\s*\}", string.Empty );
                        mapLink = System.Text.RegularExpressions.Regex.Replace( mapLink, @"\{\s*PolygonPoints\s*\}", polygonPoints );
                        mapLink += "&sensor=false&size=350x200&format=png";
                        phMaps.Controls.Add( new LiteralControl( string.Format( "<div class='group-location-map'><img src='{0}'/></div>", mapLink ) ) );
                    }
                }
//.........这里部分代码省略.........
开发者ID:Higherbound,项目名称:Higherbound-2016-website-upgrades,代码行数:101,代码来源:LocationDetail.ascx.cs

示例2: PersonHtmlPanel

        private Panel PersonHtmlPanel( 
            string groupMemberGuidString, 
            Person person,
            GroupTypeRole GroupTypeRole,
            Location location,
            RockContext rockContext )
        {
            var personInfoHtml = new StringBuilder();

            Guid? recordTypeValueGuid = null;
            if ( person.RecordTypeValueId.HasValue )
            {
                recordTypeValueGuid = DefinedValueCache.Read( person.RecordTypeValueId.Value, rockContext ).Guid;
            }

            string personName = string.Format("{0} <small>(New Record)</small>", person.FullName);
            if ( person.Id > 0 )
            {
                string personUrl = ResolveRockUrl( string.Format( "~/person/{0}", person.Id ) );
                personName = string.Format( "<a href='{0}' target='_blank'>{1}</a>", personUrl, person.FullName );
            }

            personInfoHtml.Append( "<div class='row margin-b-lg'>" );

            // add photo if it's not the new record
            if ( person.Id > 0 )
            {
                personInfoHtml.Append( "<div class='col-md-2'>" );
                if ( person.PhotoId.HasValue )
                {
                    personInfoHtml.AppendFormat(
                        "<img src='{0}' class='img-thumbnail'>",
                        Person.GetPersonPhotoUrl( person, 200, 200 ) );
                }
                personInfoHtml.Append( "</div>" );
            }

            personInfoHtml.Append( "<div class='col-md-10'>" );
            personInfoHtml.AppendFormat( "<h4 class='margin-t-none'>{0}</h4>", personName );

            if ( GroupTypeRole != null )
            {
                personInfoHtml.Append( GroupTypeRole.Name );
            }

            int? personAge = person.Age;
            if ( personAge.HasValue )
            {
                personInfoHtml.AppendFormat( " <em>({0} yrs old)</em>", personAge.Value ); ;
            }

            var groupMembers = person.GetGroupMembers( _groupType.Id, false, rockContext );
            if ( groupMembers != null && groupMembers.Any() )
            {
                personInfoHtml.AppendFormat( "<p><strong>{0} Members:</strong> {1}", _groupType.Name,
                    groupMembers.Select( m => m.Person.NickName ).ToList().AsDelimited( ", " ) );
            }

            if ( location != null )
            {
                personInfoHtml.AppendFormat( "<p><strong>Address</strong><br/>{0}</p>", location.GetFullStreetAddress().ConvertCrLfToHtmlBr() );
            }

            // Generate the HTML for Email and PhoneNumbers
            if ( !string.IsNullOrWhiteSpace( person.Email ) || person.PhoneNumbers.Any() )
            {
                string emailAndPhoneHtml = "<p class='margin-t-sm'>";
                emailAndPhoneHtml += person.Email;
                string phoneNumberList = string.Empty;
                foreach ( var phoneNumber in person.PhoneNumbers )
                {
                    var phoneType = DefinedValueCache.Read( phoneNumber.NumberTypeValueId ?? 0, rockContext );
                    phoneNumberList += string.Format(
                        "<br>{0} <small>{1}</small>",
                        phoneNumber.IsUnlisted ? "Unlisted" : phoneNumber.NumberFormatted,
                        phoneType != null ? phoneType.Value : string.Empty );
                }

                emailAndPhoneHtml += phoneNumberList + "<p>";

                personInfoHtml.Append( emailAndPhoneHtml );
            }

            personInfoHtml.Append( "</div>" );
            personInfoHtml.Append( "</div>" );

            var dupPersonPnl = new Panel();
            dupPersonPnl.ID = string.Format( "dupPersonPnl_{0}_{1}", groupMemberGuidString, person.Id );
            dupPersonPnl.Controls.Add( new LiteralControl( personInfoHtml.ToString() ) );

            return dupPersonPnl;
        }
开发者ID:NewPointe,项目名称:Rockit,代码行数:92,代码来源:AddGroup.ascx.cs

示例3: GetLocationKey

 private string GetLocationKey()
 {
     var location = new Location();
     acAddress.GetValues( location );
     return location.GetFullStreetAddress().Trim();
 }
开发者ID:NewPointe,项目名称:Rockit,代码行数:6,代码来源:AddGroup.ascx.cs

示例4: GetBestPickerModeForLocation

        /// <summary>
        /// Gets the best picker mode for location.
        /// </summary>
        /// <param name="location">The location.</param>
        /// <returns></returns>
        public LocationPickerMode GetBestPickerModeForLocation( Location location )
        {
            if ( location != null )
            {
                if ( location.IsNamedLocation )
                {
                    return LocationPickerMode.Named;
                }

                if ( !string.IsNullOrWhiteSpace( location.GetFullStreetAddress().Replace( ",", string.Empty ) ) )
                {
                    return LocationPickerMode.Address;
                }

                if (location.GeoPoint != null)
                {
                    return LocationPickerMode.Point;
                }

                if (location.GeoFence != null)
                {
                    return LocationPickerMode.Polygon;
                }
            }

            return LocationPickerMode.Named;
        }
开发者ID:pkdevbox,项目名称:Rock,代码行数:32,代码来源:LocationPicker.cs

示例5: ShowReadonlyDetails

        /// <summary>
        /// Shows the readonly details.
        /// </summary>
        /// <param name="location">The location.</param>
        private void ShowReadonlyDetails( Location location )
        {
            SetEditMode( false );

            hfLocationId.SetValue( location.Id );

            if ( string.IsNullOrWhiteSpace( location.Name ) )
            {
                lReadOnlyTitle.Text = location.ToString().FormatAsHtmlTitle();
            }
            else
            {
                lReadOnlyTitle.Text = location.Name.FormatAsHtmlTitle();
            }

            hlInactive.Visible = !location.IsActive;
            if ( location.LocationTypeValue != null )
            {
                hlType.Text = location.LocationTypeValue.Name;
                hlType.Visible = true;
            }
            else
            {
                hlType.Visible = false;
            }

            DescriptionList descriptionList = new DescriptionList();

            string fullAddress = location.GetFullStreetAddress();
            if ( !string.IsNullOrWhiteSpace( fullAddress ) )
            {
                descriptionList.Add( "Address", fullAddress );
            }

            if ( location.ParentLocation != null )
            {
                descriptionList.Add( "Parent Location", location.ParentLocation.Name );
            }

            if ( location.PrinterDevice != null)
            {
                descriptionList.Add( "Printer", location.PrinterDevice.Name );
            }

            lblMainDetails.Text = descriptionList.Html;

            location.LoadAttributes();
            Rock.Attribute.Helper.AddDisplayControls( location, phAttributes );

            // Get all the location locations and location all those that have a geo-location into either points or polygons
            var dict = new Dictionary<string, object>();

            if ( location.GeoPoint != null )
            {
                var pointsDict = new Dictionary<string, object>();
                pointsDict.Add( "latitude", location.GeoPoint.Latitude );
                pointsDict.Add( "longitude", location.GeoPoint.Longitude );
                dict.Add( "point", pointsDict );
            }

            if ( location.GeoFence != null )
            {
                var polygonDict = new Dictionary<string, object>();
                polygonDict.Add( "polygon_wkt", location.GeoFence.AsText() );
                polygonDict.Add( "google_encoded_polygon", location.EncodeGooglePolygon() );
                dict.Add( "polygon", polygonDict );
            }

            phMaps.Controls.Clear();
            phMaps.Controls.Add( new LiteralControl( GetAttributeValue( "MapHTML" ).ResolveMergeFields( dict ) ) );

            btnSecurity.Visible = location.IsAuthorized( Authorization.ADMINISTRATE, CurrentPerson );
            btnSecurity.Title = location.Name;
            btnSecurity.EntityId = location.Id;
        }
开发者ID:CentralAZ,项目名称:Rockit-CentralAZ,代码行数:79,代码来源:LocationDetail.ascx.cs

示例6: GetBestPickerModeForLocation

        /// <summary>
        /// Gets the best picker mode for location.
        /// </summary>
        /// <param name="location">The location.</param>
        /// <returns></returns>
        public LocationPickerMode GetBestPickerModeForLocation( Location location )
        {
            if ( location != null )
            {
                if ( location.IsNamedLocation )
                {
                    return LocationPickerMode.Named;
                }

                if ( !string.IsNullOrWhiteSpace( location.GetFullStreetAddress().Replace( ",", string.Empty ) ) )
                {
                    return LocationPickerMode.Address;
                }

                if ( location.GeoPoint != null )
                {
                    return LocationPickerMode.Point;
                }

                if ( location.GeoFence != null )
                {
                    return LocationPickerMode.Polygon;
                }
            }

            // Couldn't determine best picker, so return the first allowed type
            if ( ( this.AllowedPickerModes & LocationPickerMode.Named ) == LocationPickerMode.Named ) return LocationPickerMode.Named;
            if ( ( this.AllowedPickerModes & LocationPickerMode.Address ) == LocationPickerMode.Address ) return LocationPickerMode.Address;
            if ( ( this.AllowedPickerModes & LocationPickerMode.Point ) == LocationPickerMode.Point ) return LocationPickerMode.Point;
            if ( ( this.AllowedPickerModes & LocationPickerMode.Polygon ) == LocationPickerMode.Polygon ) return LocationPickerMode.Polygon;

            return LocationPickerMode.None;
        }
开发者ID:tcavaletto,项目名称:Rock-CentralAZ,代码行数:38,代码来源:LocationPicker.cs


注:本文中的Location.GetFullStreetAddress方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。