Exemplo n.º 1
0
        internal SLGroupLevel Clone()
        {
            SLGroupLevel gl = new SLGroupLevel();
            gl.UniqueName = this.UniqueName;
            gl.Caption = this.Caption;
            gl.User = this.User;
            gl.CustomRollUp = this.CustomRollUp;

            gl.Groups = new List<SLGroup>();
            foreach (SLGroup g in this.Groups)
            {
                gl.Groups.Add(g.Clone());
            }

            return gl;
        }
        internal void FromCacheHierarchy(CacheHierarchy ch)
        {
            this.SetAllNull();

            if (ch.UniqueName != null) this.UniqueName = ch.UniqueName.Value;
            if (ch.Caption != null) this.Caption = ch.Caption.Value;
            if (ch.Measure != null) this.Measure = ch.Measure.Value;
            if (ch.Set != null) this.Set = ch.Set.Value;
            if (ch.ParentSet != null) this.ParentSet = ch.ParentSet.Value;
            if (ch.IconSet != null) this.IconSet = ch.IconSet.Value;
            if (ch.Attribute != null) this.Attribute = ch.Attribute.Value;
            if (ch.Time != null) this.Time = ch.Time.Value;
            if (ch.KeyAttribute != null) this.KeyAttribute = ch.KeyAttribute.Value;
            if (ch.DefaultMemberUniqueName != null) this.DefaultMemberUniqueName = ch.DefaultMemberUniqueName.Value;
            if (ch.AllUniqueName != null) this.AllUniqueName = ch.AllUniqueName.Value;
            if (ch.AllCaption != null) this.AllCaption = ch.AllCaption.Value;
            if (ch.DimensionUniqueName != null) this.DimensionUniqueName = ch.DimensionUniqueName.Value;
            if (ch.DisplayFolder != null) this.DisplayFolder = ch.DisplayFolder.Value;
            if (ch.MeasureGroup != null) this.MeasureGroup = ch.MeasureGroup.Value;
            if (ch.Measures != null) this.Measures = ch.Measures.Value;
            if (ch.Count != null) this.Count = ch.Count.Value;
            if (ch.OneField != null) this.OneField = ch.OneField.Value;
            if (ch.MemberValueDatatype != null) this.MemberValueDatatype = ch.MemberValueDatatype.Value;
            if (ch.Unbalanced != null) this.Unbalanced = ch.Unbalanced.Value;
            if (ch.UnbalancedGroup != null) this.UnbalancedGroup = ch.UnbalancedGroup.Value;
            if (ch.Hidden != null) this.Hidden = ch.Hidden.Value;

            FieldUsage fu;
            SLGroupLevel gl;
            using (OpenXmlReader oxr = OpenXmlReader.Create(ch))
            {
                while (oxr.Read())
                {
                    if (oxr.ElementType == typeof(FieldUsage))
                    {
                        fu = (FieldUsage)oxr.LoadCurrentElement();
                        this.FieldsUsage.Add(fu.Index.Value);
                    }
                    else if (oxr.ElementType == typeof(GroupLevel))
                    {
                        gl = new SLGroupLevel();
                        gl.FromGroupLevel((GroupLevel)oxr.LoadCurrentElement());
                        this.GroupLevels.Add(gl);
                    }
                }
            }
        }