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


C# Node.TryGetLabel方法代码示例

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


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

示例1: BuildReportRowProperties

        /// <summary>
        /// Updates a <paramref name="row"/> with relevant properties from the taxonomy.
        /// </summary>
        /// <param name="report">[Obsolete]</param>
        /// <param name="parent">The <see cref="Node"/> which created this <paramref name="row"/>.</param>
        /// <param name="row">The row to be updated.</param>
        /// <seealso cref="BuildReportRows"/>
        private void BuildReportRowProperties( InstanceReport report, Node parent, InstanceReportRow row )
        {
            row.BalanceType = parent.BalanceType;
            row.Id = report.Rows.Count + 1;
            row.IsReverseSign = InstanceUtils.IsDisplayReversed( parent );
            row.PreferredLabelRole = parent.PreferredLabel;
            row.IsBeginningBalance = InstanceUtils.IsBeginningBalance( row );
            row.IsEndingBalance = InstanceUtils.IsEndingBalance( row );
            row.PeriodType = parent.PeriodType;

            //apply the element label
            string label = null;
            if( !string.IsNullOrEmpty( row.PreferredLabelRole ) && parent.TryGetLabel( this.preferredLanguage, row.PreferredLabelRole, out label ) )
                row.Label = label;
            else if( parent.TryGetLabel( this.preferredLanguage, "label", out label ) )
                row.Label = label;
            else
                row.Label = string.Format( "[{0}]", parent.Name );

            //apply element properties
            Element element = parent.MyElement;
            if( element == null && !elementCache.TryGetValue( parent.Id, out element ) )
            {
                element =
                this.elementCache[ parent.Id ] =
                    this.currentTaxonomy.AllElements[ parent.Id ] as Element;
            }

            if( element == null )
            {
                Debug.Assert( false, "Why isn't this element in the taxonomy?" );
            }
            else
            {
                if( row.Cells != null && row.Cells.Count > 0 )
                {
                    if( !this.presentationElements.ContainsKey( parent.Id ) )
                        this.presentationElements[ parent.Id ] = 0;

                    this.presentationElements[ parent.Id ]++;
                }

                row.ElementDataType = element.OrigElementType;
                row.ElementName = parent.Id;
                row.ElementPrefix = parent.Id.Substring( 0, parent.Id.IndexOf( '_' ) + 1 );
                row.IsBaseElement = row.ElementPrefix.StartsWith( "usfr_" ) || row.ElementPrefix.StartsWith( "us-gaap_" );
                row.SimpleDataType = element.MyDataType.ToString().ToLower();

                DefAndRef dr;
                if( this.dar.references.TryGetValue( parent.Id, out dr ) )
                {
                    row.ElementDefenition = dr.Def;
                    row.ElementReferences = dr.Ref;
                }

                UnitType unit;
                if( this.elementUnitTypes.TryGetValue( row.ElementName, out unit ) )
                    row.Unit = unit;

                //perhaps the user used the wrong unit - attempt to find monetary, perShare
                if( row.Unit == UnitType.Other || row.Unit == UnitType.Monetary )
                {
                    if( element.OrigElementType.IndexOf( "perShare", StringComparison.CurrentCultureIgnoreCase ) > -1 )
                        row.Unit = UnitType.EPS;
                }
            }

            if( BuilderRules.IsRuleEnabled( RulesEngineUtils.DISPLAY_US_DATE_FORMAT ) )
            {
                if( string.Equals( row.SimpleDataType, "date", StringComparison.CurrentCultureIgnoreCase ) )
                {
                    foreach( Cell cell in row.Cells )
                    {
                        cell.DisplayDateInUSFormat = true;
                    }
                }
            }
        }
开发者ID:plamikcho,项目名称:xbrlpoc,代码行数:85,代码来源:ReportBuilder.cs


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