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


C# Location.IsAuthorized方法代码示例

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


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

示例1: ShowReadonlyDetails


//.........这里部分代码省略.........
            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 ) ) );
                    }
                }
            }

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

示例2: 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


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