Esempio n. 1
0
 public void RunBeforeEachTest()
 {
     Segment s = new Segment();
     this.Name = s.Name;
     this.ValueName = s.ValueName;
     this.ValueType = s.ValueType;
     this.Schema = s.Schema;
     this.Namespace = s.Namespace;
 }
Esempio n. 2
0
        public static bool SegmentEquals( Segment s1, Segment s2 )
        {
            if( s1 == null )
            {
                if( s2 == null )
                    return true;
                else
                    return false;
            }
            else if( s2 == null )
            {
                return false;
            }

            if( s1.DimensionInfo == null )
            {
                if( s2.DimensionInfo == null )
                    return true;
                else
                    return false;
            }
            else if( s2.DimensionInfo == null )
            {
                return false;
            }

            if( !string.Equals( s1.DimensionInfo.Id, s2.DimensionInfo.Id ) )
                return false;

            if( !string.Equals( s1.DimensionInfo.dimensionId, s2.DimensionInfo.dimensionId ) )
                return false;

            return true;
        }
Esempio n. 3
0
        public void TestUsGaap2008_DimensionValidation2()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );
            string fileName = @"C:\Users\srikanth.srinivasan\AppData\Roaming\Rivet\CrossTag\Taxonomies\cov\cov.xsd";

            TestUsGaap2008 s = new TestUsGaap2008();

            int errors = 0;
            DateTime start = DateTime.Now;
            if (s.Load(fileName, out errors) != true)
            {
                Assert.Fail((string)s.ErrorList[0]);
            }

            s.Parse(out errors);

            Assert.AreEqual(0, errors, "should not have any errors");

            s.CurrentLanguage = s.SupportedLanguages[0] as string;
            s.CurrentLabelRole = "preferredLabel";

            ArrayList nodes = s.GetNodesByPresentation(true);

            s.TryBuildDimensionValidationInformation();

            ArrayList segments = new ArrayList();
            ArrayList scenarios = new ArrayList();

            string elementId = "us-gaap_GainLossRelatedToLitigationSettlement";

            Segment seg = new Segment();
            seg.DimensionInfo = new ContextDimensionInfo();
            seg.DimensionInfo.dimensionId = "us-gaap_ProductOrServiceAxis";
            seg.DimensionInfo.Id = "cov_LitigationLossMember";

            segments.Add(seg);

            string error;
            bool ret = s.IsDimensionInformationValid(elementId, segments, scenarios, out error);

            Assert.IsFalse(ret, "should return failure");
            Console.WriteLine(error);
            s.linkbaseFileInfos.Sort();

            foreach (LinkbaseFileInfo lbfi in s.linkbaseFileInfos)
            {
                Console.WriteLine(lbfi.ToString());
            }
        }
Esempio n. 4
0
        public void TestUsGaap2008_DimensionValidation()
        {
            //Trace.Listeners.Add( new TextWriterTraceListener(Console.Out) );
            string fileName = TestCommon.FolderRoot + @"XBRLUSGAAPTaxonomies-2008-02-13\ind\ci\us-gaap-ci-stm-2008-01-31.xsd";

            TestUsGaap2008 s = new TestUsGaap2008();

            int errors = 0;
            DateTime start = DateTime.Now;
            if (s.Load(fileName, out errors) != true)
            {
                Assert.Fail((string)s.ErrorList[0]);
            }

            s.Parse(out errors);

            Assert.AreEqual(0, errors, "should not have any errors");

            s.CurrentLanguage = s.SupportedLanguages[0] as string;
            s.CurrentLabelRole = "preferredLabel";

            ArrayList nodes = s.GetNodesByPresentation(true);

            s.TryBuildDimensionValidationInformation();

            ArrayList segments = new ArrayList();
            ArrayList scenarios = new ArrayList();

            string elementId = "us-gaap_NetIncomeLossAvailableToCommonStockholdersBasic";

            Segment seg = new Segment();
            seg.DimensionInfo = new ContextDimensionInfo();
            seg.DimensionInfo.dimensionId = "us-gaap_StatementScenarioAxis";
            seg.DimensionInfo.Id = "us-gaap_ScenarioActualMember";

            segments.Add(seg);

            string error;
            bool ret = s.IsDimensionInformationValid(elementId, segments, scenarios, out error);

            Assert.IsFalse(ret, "should return failure");
            Console.WriteLine(error);
            s.linkbaseFileInfos.Sort();

            foreach (LinkbaseFileInfo lbfi in s.linkbaseFileInfos)
            {
                Console.WriteLine(lbfi.ToString());
            }
        }
Esempio n. 5
0
        public bool ApplySpecialLabel( Segment specialSegment )
        {
            if( string.IsNullOrEmpty( specialSegment.ValueName ) )
                return false;

            if( specialSegment.IsDefaultForEntity )
                return false;

            LabelLine newLabel = new LabelLine( this.Labels.Count + 1, string.Format( " ({1})", this.Label, specialSegment.ValueName ) );
            this.Labels.Add( newLabel );
            return true;
        }
        public object Clone()
        {
            //Clones all base type properties and shallow clones any complex types
            //Complex types will be recloned further down in the code.
            MergedContextUnitsWrapper mcu = this.MemberwiseClone() as MergedContextUnitsWrapper;

            mcu.contextRef = new ContextProperty( this.contextRef.ContextID );
            mcu.contextRef.EntitySchema = this.contextRef.EntitySchema;
            mcu.contextRef.EntityValue = this.contextRef.EntityValue;
            mcu.contextRef.PeriodDisplayName = this.contextRef.PeriodDisplayName;
            mcu.contextRef.PeriodEndDate = this.contextRef.PeriodEndDate;
            mcu.contextRef.PeriodStartDate = this.contextRef.PeriodStartDate;
            mcu.contextRef.PeriodType = this.contextRef.PeriodType;

            mcu.contextRef.Segments = new ArrayList();

            #region clone segments

            foreach( Segment seg in this.contextRef.Segments )
            {
                Segment segClone = new Segment();

                //Setting DimensionInfo sets some of the other properties on the Segment, so to ensure that
                //the object is truely cloned set DimensionInfo first then set the other properties
                if (seg.DimensionInfo != null)
                {
                    segClone.DimensionInfo = seg.DimensionInfo.Clone() as ContextDimensionInfo;
                }

                segClone.Name = seg.Name;
                segClone.ValueName = seg.ValueName;
                segClone.ValueType = seg.ValueType;
                segClone.Namespace = seg.Namespace;
                segClone.Schema = seg.Schema;

                mcu.contextRef.AddSegment( segClone );
            }

            #endregion

            #region clone scenarios

            foreach( Scenario scen in this.contextRef.Scenarios )
            {
                Segment scenClone = new Segment();

                //Setting DimensionInfo sets some of the other properties on the scenario, so to ensure that
                //the object is truely cloned set DimensionInfo first then set the other properties
                if (scen.DimensionInfo != null)
                {
                    scenClone.DimensionInfo = scen.DimensionInfo.Clone() as ContextDimensionInfo;
                }

                scenClone.Name = scen.Name;
                scenClone.ValueName = scen.ValueName;
                scenClone.ValueType = scen.ValueType;
                scenClone.Namespace = scen.Namespace;
                scenClone.Schema = scen.Schema;

                mcu.contextRef.AddScenario( scen );
            }

            #endregion

            #region clone unit properties

            mcu.UPS = new List<UnitProperty>();
            foreach (UnitProperty up in this.UPS)
            {
                UnitProperty upClone = new UnitProperty(up.UnitID, up.UnitType);
                upClone.Scale = up.Scale;

                if (up.StandardMeasure != null)
                {
                    upClone.StandardMeasure = new Aucent.MAX.AXE.XBRLParser.Measure();
                    upClone.StandardMeasure.MeasureNamespace = up.StandardMeasure.MeasureNamespace;
                    upClone.StandardMeasure.MeasureSchema = up.StandardMeasure.MeasureSchema;
                    upClone.StandardMeasure.MeasureValue = up.StandardMeasure.MeasureValue;
                }

                if (up.MultiplyMeasures != null)
                {
                    upClone.MultiplyMeasures = new Aucent.MAX.AXE.XBRLParser.Measure[up.MultiplyMeasures.Length];
                    for (int i = 0; i < up.MultiplyMeasures.Length; i++)
                    {
                        upClone.MultiplyMeasures[i] = new Aucent.MAX.AXE.XBRLParser.Measure();
                        upClone.MultiplyMeasures[i].MeasureNamespace = up.MultiplyMeasures[i].MeasureNamespace;
                        upClone.MultiplyMeasures[i].MeasureSchema = up.MultiplyMeasures[i].MeasureSchema;
                        upClone.MultiplyMeasures[i].MeasureValue = up.MultiplyMeasures[i].MeasureValue;
                    }
                }

                if (up.NumeratorMeasure != null)
                {
                    upClone.NumeratorMeasure = new Aucent.MAX.AXE.XBRLParser.Measure();
                    upClone.NumeratorMeasure.MeasureNamespace = up.NumeratorMeasure.MeasureNamespace;
                    upClone.NumeratorMeasure.MeasureSchema = up.NumeratorMeasure.MeasureSchema;
                    upClone.NumeratorMeasure.MeasureValue = up.NumeratorMeasure.MeasureValue;
                }

                if (up.DenominatorMeasure != null)
                {
                    upClone.DenominatorMeasure = new Aucent.MAX.AXE.XBRLParser.Measure();
                    upClone.DenominatorMeasure.MeasureNamespace = up.DenominatorMeasure.MeasureNamespace;
                    upClone.DenominatorMeasure.MeasureSchema = up.DenominatorMeasure.MeasureSchema;
                    upClone.DenominatorMeasure.MeasureValue = up.DenominatorMeasure.MeasureValue;
                }

                mcu.UPS.Add(upClone);
            }

            #endregion

            mcu.CurrencySymbol = this.CurrencySymbol;
            mcu.CurrencyCode = this.CurrencyCode;

            return mcu;
        }
Esempio n. 7
0
        internal static bool TryCreateFromXml( XmlNode node, XmlNamespaceManager theManager, out ContextProperty cp, ref ArrayList errors )
        {
            if ( errors == null )
            {
                errors = new ArrayList();
            }

            cp = new ContextProperty();
            cp.ErrorList = errors;

            cp.ContextID = node.Attributes[ ID_ATTR ].Value;

            XmlNode entity = node.SelectSingleNode( "./link2:" + ENTITY, theManager );
            if ( entity == null )
            {
                if ( ( entity = node.SelectSingleNode( ENTITY ) ) == null )
                {
                    Common.WriteError( "XBRLParser.Error.MissingRequiredField", errors, "Entity" );
                    return false;
                }
            }

            XmlNode identifier = entity.SelectSingleNode( "./link2:" + IDENTIFIER, theManager );
            if ( identifier == null )
            {
                if ( ( identifier = entity.SelectSingleNode( "./" + IDENTIFIER ) ) == null )
                {
                    Common.WriteError( "XBRLParser.Error.MissingRequiredField", errors, "identifier" );
                    return false;
                }
            }

            cp.EntitySchema = identifier.Attributes[ SCHEME_ATTR ].Value;
            cp.EntityValue = identifier.InnerXml;

            XmlNode segments = entity.SelectSingleNode( "./link2:" + SEGMENT, theManager );

            if ( segments == null )
            {
                segments = entity.SelectSingleNode( "./" + SEGMENT );
            }

            if ( segments != null )
            {
                foreach ( XmlNode segment in segments.ChildNodes )
                {
                    if (segment is XmlComment) continue;

                    bool createSegment = true;
                    if (segment.LocalName.ToLower().Equals(EXPLICITMEMBER.ToLower()) &&
                        segment.NamespaceURI.Equals( DocumentBase.XBRLDI_URI) )
                    {
                        //we have a dimension info
                        string dimensionId=null;
                        string valueId = segment.InnerXml.Replace( ":", "_");
                        foreach (XmlAttribute attr in segment.Attributes)
                        {
                            if (attr.Name.Equals(DIMENSION))
                            {
                                dimensionId = attr.Value.Replace( ":", "_");
                                break;
                            }
                        }
                        if (dimensionId != null)
                        {
                            Segment seg = new Segment(string.Empty, valueId, dimensionId, DocumentBase.XBRLDI_PREFIX, segment.NamespaceURI);
                            ContextDimensionInfo di = new ContextDimensionInfo();
                            di.dimensionId = dimensionId;
                            di.Id = valueId;
                            seg.DimensionInfo = di;

                            cp.AddSegment(seg);
                            createSegment = false;
                        }

                    }

                    if (createSegment)
                    {
                        cp.AddSegment(segment.Prefix, segment.InnerXml, segment.LocalName, segment.NamespaceURI);
                    }
                }
            }

            XmlNode scenarios = node.SelectSingleNode( "./link2:" + SCENARIO, theManager );
            if ( scenarios == null )
            {
                scenarios = node.SelectSingleNode( "./" + SCENARIO );
            }

            if ( scenarios != null )
            {
                foreach ( XmlNode scenario in scenarios )
                {

                    bool createScenario = true;
                    if (scenario.LocalName.ToLower().Equals(EXPLICITMEMBER.ToLower()) &&
                        scenario.NamespaceURI.Equals(DocumentBase.XBRLDI_URI))
                    {
                        //we have a dimension info
                        string dimensionId = null;
                        string valueId = scenario.InnerXml.Replace(":", "_");
                        foreach (XmlAttribute attr in scenario.Attributes)
                        {
                            if (attr.Name.Equals(DIMENSION))
                            {
                                dimensionId = attr.Value.Replace(":", "_");
                                break;
                            }
                        }
                        if (dimensionId != null)
                        {
                            Scenario seg = new Scenario(string.Empty, valueId, dimensionId, DocumentBase.XBRLDI_PREFIX, scenario.NamespaceURI);
                            ContextDimensionInfo di = new ContextDimensionInfo();
                            di.dimensionId = dimensionId;
                            di.Id = valueId;
                            seg.DimensionInfo = di;

                            cp.AddScenario(seg);
                            createScenario = false;
                        }

                    }

                    if (createScenario)
                    {

                        cp.AddScenario(scenario.Prefix, scenario.InnerXml, scenario.LocalName, scenario.NamespaceURI);
                    }
                }
            }

            // lastly, repopulate the time period
            XmlNode timePeriod = node.SelectSingleNode( "./link2:" + PERIOD, theManager );
            if ( timePeriod == null )
            {
                timePeriod = node.SelectSingleNode( "./" + PERIOD );
                if ( timePeriod == null )
                {
                    Common.WriteError( "XBRLParser.Error.MissingRequiredField", errors, "TimePeriod" );
                    return false;
                }
                else
                {
                    if ( !cp.ParsePeriods( timePeriod, theManager ) )
                    {
                        return false;
                    }
                }
            }
            else
            {
                if ( !cp.ParsePeriods( timePeriod, theManager ) )
                {
                    return false;
                }
            }

            return cp.IsValid();
        }
Esempio n. 8
0
        public Dictionary<string, object> GetInUseSegmentDictionary(
			IEnumerable<CommandIterator> iteratorHierarchy, CommandIterator currentIterator,
			out Segment defaultMember )
        {
            string axis = currentIterator.AxisName;
            defaultMember = this.AxisMemberDefaults.ContainsKey( axis ) ?
                this.AxisMemberDefaults[ axis ] : null;

            Segment colSeg = null;
            Dictionary<string, object> segmentDictionary = new Dictionary<string, object>();
            if( string.Equals( currentIterator.Filter, "*" ) )
            {
                foreach( InstanceReportColumn col in this.Columns )
                {
                    colSeg = col.GetAxisMember( axis, defaultMember );
                    if( colSeg == null )
                        continue;

                    if( segmentDictionary.ContainsKey( colSeg.DimensionInfo.Id ) )
                        continue;

                    if( col.ContainsSegmentMembers( iteratorHierarchy ) )
                        segmentDictionary[ colSeg.DimensionInfo.Id ] = colSeg;
                }

                Segment[] allSegments = new Segment[ segmentDictionary.Count ];
                segmentDictionary.Values.CopyTo( allSegments, 0 );
                Array.Sort( allSegments, this.CompareSegments );

                segmentDictionary.Clear();
                foreach( Segment seg in allSegments )
                {
                    segmentDictionary[ seg.DimensionInfo.Id ] = seg;
                }
            }
            else
            {
                foreach( InstanceReportColumn col in this.Columns )
                {
                    colSeg = col.GetAxisMember( axis, defaultMember );
                    if( colSeg != null && string.Equals( currentIterator.Filter, colSeg.DimensionInfo.Id ) )
                    {
                        segmentDictionary[ colSeg.DimensionInfo.Id ] = colSeg;
                        break;
                    }
                }
            }

            return segmentDictionary;
        }
Esempio n. 9
0
        /// <summary>
        /// Crawls a <see cref="DimensionNode"/> (<paramref name="dNode"/>) looking for Segments and storing them in this.<see cref="commonDimensions"/>
        /// </summary>
        /// <param name="dNode">The <see cref="DimensionNode"/> to crawl looking for Segments.</param>
        //[Obsolete]
        private void PopulateCommonDimensions( DimensionNode dNode )
        {
            if( dNode.NodeDimensionInfo != null && dNode.NodeDimensionInfo.NodeType == DimensionNode.NodeType.Item )
            {
                DimensionNode pNode = dNode.GetParentDimensionTypeDimensionNode();
                if( !this.commonDimensions.ContainsKey( pNode.Id ) )
                {
                    this.commonAxes.Add( pNode.Id );
                    this.commonDimensions[ pNode.Id ] = new List<Segment>();
                }

                Segment segment = new Segment
                {
                    DimensionInfo = new ContextDimensionInfo
                    {
                        dimensionId = pNode.Id,
                        Id = dNode.Id
                    },
                    ValueName = dNode.Label,
                    ValueType = pNode.Id
                };

                this.commonDimensions[ pNode.Id ].Add( segment );
            }

            if( dNode.HasChildren && dNode.Children.Count > 0 )
            {
                foreach( DimensionNode child in dNode.Children )
                {
                    this.PopulateCommonDimensions( child );
                }
            }
        }
Esempio n. 10
0
        /// <summary>
        /// Looks up the total label (corresponding to totalLabel role) for a segment.
        /// </summary>
        /// <param name="seg">The segment whose total label should be retrieved.</param>
        /// <param name="label">The total label found.</param>
        /// <returns>True on success, false on fail.</returns>
        private bool GetSegmentTotalLabel( Segment seg, out string label )
        {
            label = null;

            string dimensionId = seg.DimensionInfo.Id;
            Element el = this.currentTaxonomy.AllElements[ dimensionId ] as Element;
            if( el == null )
                return false;

            if( !el.TryGetLabel( this.preferredLanguage, "totalLabel", out label ) )
                return false;

            return true;
        }
Esempio n. 11
0
        /// <summary>
        /// Determines if supplied <see cref="Segment"/> value equals this <see cref="Segment"/> by comparing on properties defined
        ///  by supplied parameter.
        /// </summary>
        /// <param name="s"><see cref="Segment"/> to be compared with this <see cref="Segment"/>.</param>
        /// <param name="includeNamespaceAndSchema">A <see cref="Boolean"/> that, if true, indicates that
        /// method is to include namespace and schema in comparison.</param>
        /// <returns>An <see cref="int"/>: Zero if supplied <see cref="Segment"/> is equal in value
        /// to this <see cref="Segment"/>.</returns>
        public int CompareValue(Segment s, Boolean includeNamespaceAndSchema)
        {
            int ret = 0;
            if (this.DimensionInfo != null)
            {
                if (s.DimensionInfo == null) return 1;

                return this.DimensionInfo.CompareValue(s.DimensionInfo);
            }
            else if (s.DimensionInfo != null) return -1;

            ret = this.ValueName.CompareTo( s.ValueName);
            if( ret != 0 )
                return ret;
            ret = this.ValueType.CompareTo( s.ValueType);
            if( ret != 0 )
                return ret;

            if (includeNamespaceAndSchema == true)
            {
                ret = this.Namespace.CompareTo(s.Namespace);
                if (ret != 0)
                    return ret;

                ret = this.Schema.CompareTo(s.Schema);
            }

            return ret;
        }
Esempio n. 12
0
 /// <summary>
 /// Determines if supplied <see cref="Segment"/> value equals this <see cref="Segment"/> by comparing on all significant properties.
 /// </summary>
 public int CompareValue(Segment s)
 {
     return this.CompareValue(s, true);
 }
Esempio n. 13
0
        /// <summary>
        /// Crawls <paramref name="currentNode"/> recursively checking for <see cref="Node"/>s where <paramref name="currentNode"/>.<see>MyElement</see>.<see>IsDimensionItem</see>"/> is true.
        /// </summary>
        /// <param name="currentTaxonomy">The <see cref="Taxonomy"/> containing <paramref name="currentNode"/>, used to look up the default member of an axis.</param>
        /// <param name="currentNode">The current <see cref="Node"/>.  When called, this should be a top-level node from the presentation taxonomy.</param>
        /// <param name="axisName">The axis for any dimensions found.  Null or empty until a dimension is found.</param>
        /// <param name="axisByPresentation">A list of axes to be populated.</param>
        /// <param name="axisMembersByPresentation">A list of dimensions to be populated, grouped and key by axis.</param>
        private static void GetDimensions( Taxonomy currentTaxonomy, Node currentNode, string axisName, ref List<string> axisByPresentation, ref Dictionary<string, List<Segment>> axisMembersByPresentation )
        {
            if( string.IsNullOrEmpty( axisName ) )
            {
                if( currentNode.MyElement.IsDimensionItem() )
                {
                    GetDimensions( currentTaxonomy, currentNode, currentNode.Id, ref axisByPresentation, ref axisMembersByPresentation );
                }
                else if( currentNode.HasChildren )
                {
                    foreach( Node childNode in currentNode.Children )
                    {
                        GetDimensions( currentTaxonomy, childNode, null, ref axisByPresentation, ref axisMembersByPresentation );
                    }
                }
            }
            else
            {
                //this is a dimension
                // - add it to the list
                if( !axisByPresentation.Contains( axisName ) )
                    axisByPresentation.Add( axisName );

                // - collect the members in order
                if( !axisMembersByPresentation.ContainsKey( axisName ) )
                    axisMembersByPresentation[ axisName ] = new List<Segment>();

                string defaultMember = null;
                if( currentTaxonomy != null && currentTaxonomy.NetDefinisionInfo != null )
                    currentTaxonomy.NetDefinisionInfo.TryGetDefaultMember( axisName, out defaultMember );

                if( currentNode.HasChildren )
                {
                    foreach( Node childNode in currentNode.Children )
                    {
                        Segment newSeg = new Segment
                        {
                            DimensionInfo = new ContextDimensionInfo
                            {
                                dimensionId = axisName,
                                Id = childNode.Id
                            },
                            ValueName = childNode.Label,
                            ValueType = axisName
                        };

                        //always store the default member
                        if( string.Equals( defaultMember, childNode.Id ) )
                            newSeg.IsDefaultForEntity = true;

                        axisMembersByPresentation[ axisName ].Add( newSeg );

                        if( childNode.HasChildren )
                            GetDimensions( currentTaxonomy, childNode, axisName, ref axisByPresentation, ref axisMembersByPresentation );
                    }
                }
            }
        }
Esempio n. 14
0
 public static string BuildSegmentScenarioName(Segment s)
 {
     s.ValueName = s.ValueName.Replace(Environment.NewLine, " ");
     return s.ValueName == string.Empty ? s.ValueType : "{" + s.ValueType + "} : " + s.ValueName;
     //return s.ValueName == string.Empty ? s.ValueType : s.ValueName;
 }
Esempio n. 15
0
        public Segment GetAxisMember( string axis, Segment defaultMember )
        {
            if( this.Segments == null )
                return defaultMember;

            foreach( Segment segment in this.Segments )
            {
                if( segment.DimensionInfo.dimensionId == axis )
                    return segment;
            }

            return defaultMember;
        }
Esempio n. 16
0
        public static bool IsSegmentPreviouslyReported( Segment seg, XmlDocument membersXDoc )
        {
            XmlNode previousParent = membersXDoc.SelectSingleNode( "/EquityMembers/PreviouslyReportedMembers" );
            foreach( XmlNode child in previousParent.ChildNodes )
            {
                if( !string.Equals( child.Name, seg.DimensionInfo.dimensionId ) )
                    continue;

                if( string.Equals( child.InnerText, "*" ) || string.Equals( child.InnerText, seg.DimensionInfo.Id ) )
                    return true;

            }
            return false;
        }
Esempio n. 17
0
        public bool IsSegmentInUse( Segment specificMember )
        {
            //get this columns copy of the segment
            Segment colSeg = this.GetAxisMember( specificMember.DimensionInfo.dimensionId, null );

            //null represents the default member (this segment cannot be found in the this.Segments)
            if( colSeg == null )
            {
                //Were we actually looking for the default member?
                //If so, this will return true.  Otherwise, false.
                return specificMember.IsDefaultForEntity;
            }

            //this is not the default member, so check if the "specific" member is a match
            if( colSeg.DimensionInfo.Id == specificMember.DimensionInfo.Id )
            {
                return true;
            }

            return false;
        }
Esempio n. 18
0
        public static int Compare( Segment x, Segment y )
        {
            int typeCompare = x.ValueType.CompareTo( y.ValueType );
            if ( typeCompare == 0 )
            {
                return x.ValueName.CompareTo( y.ValueName );
            }

            return typeCompare;
        }
Esempio n. 19
0
        private void InitializeTestInstanceReportCommonSegment()
        {
            this.Columns.Clear();
            this.Rows.Clear();

            Segment sharedSegment = new Segment("SharedSeg", "Shared Segment", "Shared Segment Value");
            sharedSegment.DimensionInfo = new ContextDimensionInfo();
            sharedSegment.DimensionInfo.Id = "SharedSegmentAxis";
            sharedSegment.DimensionInfo.dimensionId = "SharedSegmentMember";

            //Add reporting periods to columns for testing MergeInstanceAndDuration
            InstanceReportColumn irc = new InstanceReportColumn();
            ContextProperty cp = new ContextProperty();
            cp.PeriodStartDate = new DateTime(2006, 10, 1);
            cp.PeriodEndDate = new DateTime(2006, 12, 31);
            cp.PeriodType = Element.PeriodType.duration;
            irc.MCU = new MergedContextUnitsWrapper("mcu0", cp);
            cp.Segments.Add(sharedSegment);
            LabelLine ll = new LabelLine(0, string.Format("{0} - {1}", cp.PeriodStartDate.ToShortDateString(), cp.PeriodEndDate.ToShortDateString()));
            irc.Labels.Add(ll);
            this.Columns.Add(irc);

            irc = new InstanceReportColumn();
            cp = new ContextProperty();
            cp.PeriodStartDate = new DateTime(2007, 10, 1);
            cp.PeriodEndDate = new DateTime(2007, 12, 31);
            cp.PeriodType = Element.PeriodType.duration;
            irc.MCU = new MergedContextUnitsWrapper("mcu1", cp);
            cp.Segments.Add(sharedSegment);
            ll = new LabelLine(0, string.Format("{0} - {1}", cp.PeriodStartDate.ToShortDateString(), cp.PeriodEndDate.ToShortDateString()));
            irc.Labels.Add(ll);
            this.Columns.Add(irc);

            irc = new InstanceReportColumn();
            cp = new ContextProperty();
            cp.PeriodStartDate = new DateTime(2007, 12, 31);
            cp.PeriodType = Element.PeriodType.instant;
            irc.MCU = new MergedContextUnitsWrapper("mcu2", cp);
            cp.Segments.Add(sharedSegment);
            ll = new LabelLine(0, cp.PeriodStartDate.ToShortDateString());
            irc.Labels.Add(ll);
            this.Columns.Add(irc);

            irc = new InstanceReportColumn();
            cp = new ContextProperty();
            cp.PeriodStartDate = new DateTime(2006, 12, 31);
            cp.PeriodType = Element.PeriodType.instant;
            irc.MCU = new MergedContextUnitsWrapper("mcu3", cp);
            cp.Segments.Add(sharedSegment);
            ll = new LabelLine(0, cp.PeriodStartDate.ToShortDateString());
            irc.Labels.Add(ll);
            this.Columns.Add(irc);

            irc = new InstanceReportColumn();
            cp = new ContextProperty();
            cp.PeriodStartDate = new DateTime(2008, 12, 31);
            cp.PeriodType = Element.PeriodType.instant;
            cp.Segments.Add(sharedSegment);
            irc.MCU = new MergedContextUnitsWrapper("mcu4", cp);
            ll = new LabelLine(0, cp.PeriodStartDate.ToShortDateString());
            irc.Labels.Add(ll);
            this.Columns.Add(irc);

            irc = new InstanceReportColumn();
            cp = new ContextProperty();
            cp.PeriodStartDate = new DateTime(2008, 12, 31);
            cp.PeriodType = Element.PeriodType.instant;
            cp.Segments.Add(sharedSegment);
            irc.MCU = new MergedContextUnitsWrapper("mcu5", cp);
            ll = new LabelLine(0, cp.PeriodStartDate.ToShortDateString());
            irc.Labels.Add(ll);
            cp.Segments.Add(sharedSegment);
            irc.Labels.Add(new LabelLine(1, "Segment One"));
            this.Columns.Add(irc);

            irc = new InstanceReportColumn();
            cp = new ContextProperty();
            cp.PeriodStartDate = new DateTime(2008, 12, 31);
            cp.PeriodType = Element.PeriodType.instant;
            cp.Segments.Add(sharedSegment);
            irc.MCU = new MergedContextUnitsWrapper("mcu6", cp);
            ll = new LabelLine(0, cp.PeriodStartDate.ToShortDateString());
            irc.Labels.Add(ll);
            cp.Segments.Add(sharedSegment);
            irc.Labels.Add(new LabelLine(2, "Segment Two"));
            this.Columns.Add(irc);

            InstanceReportRow irr = new InstanceReportRow("Test Elem", 7);
            irr.ElementName = "Test Elem";
            for (int i = 0; i < 7; i++)
            {
                Cell cell = new Cell();
                cell.NumericAmount = (decimal)((i + 1) * 10.0);
                irr.Cells.Add(cell);
            }
            this.Rows.Add(irr);
        }
Esempio n. 20
0
 /// <summary>
 /// Add a parameter-supplied <see cref="Segment"/> to this <see cref="ContextProperty"/>'s segments collection.
 /// </summary>
 /// <param name="s">The <see cref="Segment"/> to be added.</param>
 public void AddSegment(Segment s)
 {
     Segments.Add( s );
 }