public void AddMemberChildren(string Identifier, bool AutoSelect) { SchemaMember parentMem = SchemaMemberFromIdentifier(Identifier); if (parentMem == null) { throw new Exception("Error: invalid identifier"); } Hierarchy hier = parentMem.Hierarchy; if (AutoSelect) { // remove children first this.RemoveMemberChildren(Identifier); // add children set MemberChildrenSet mcs = new MemberChildrenSet(null, hier, parentMem); hier.AddMember(mcs, true); } else { for (int i = 0; i < parentMem.Children.Count; i++) { hier.AddMember(parentMem.Children[i], true); } } }
public MemberChildrenSet GetMemberChildrenSet(string memUniqueName) { foreach (CalculatedMember cmem in this) { MemberChildrenSet mcs = cmem as MemberChildrenSet; if (mcs != null && mcs.Member.UniqueName == memUniqueName) { return(mcs); } } return(null); }
public void RemoveMemberChildren(string Identifier) { SchemaMember parentMem = SchemaMemberFromIdentifier(Identifier); if (parentMem == null) { throw new Exception("Error: invalid identifier"); } // check if autoselect MemberChildrenSet mcs = parentMem.Hierarchy.CalculatedMembers.GetMemberChildrenSet(parentMem.UniqueName); if (mcs != null) { parentMem.Hierarchy.RemoveMember(mcs); } else { parentMem.Hierarchy.RemoveSchemaMemberChildren(parentMem); } }
public void Remove(System.Collections.Specialized.StringCollection Identifiers) { ArrayList memList = new ArrayList(); for (int i = 0; i < Identifiers.Count; i++) { short axisOrdinal = -1; int pos = -1; int mpos = -1; this.CellsetPositionFromIdentifier(Identifiers[i], ref axisOrdinal, ref pos, ref mpos); CellsetMember cstMem = _report.Cellset.GetCellsetMember((byte)axisOrdinal, mpos, pos); memList.Add(cstMem); } // remove members System.Collections.Specialized.StringCollection parentList = new System.Collections.Specialized.StringCollection(); for (int i = 0; i < memList.Count; i++) { CellsetMember cstMem = (CellsetMember)memList[i]; Hierarchy hier = _report.Schema.GetHierarchyFromMemberUniqueName(cstMem.UniqueName); // get member, remove if exisits DataMember dmem = (DataMember)hier.GetMember(cstMem.UniqueName); if (dmem != null) { dmem.Hierarchy.RemoveMember(dmem); continue; } // if not found by unique name, check if member was part of MemberChildrenSet (autoselect), // in this case we convert it to not-autoselect if (cstMem.LevelDepth == 0) { continue; } SchemaMember parentMem = _report.Schema.GetMemberParent(hier, cstMem.UniqueName); if (parentMem != null) { if (parentList.Contains(parentMem.UniqueName)) { continue; // parent already handled } parentList.Add(parentMem.UniqueName); MemberChildrenSet mcs = hier.CalculatedMembers.GetMemberChildrenSet(parentMem.UniqueName); if (mcs != null) { // add children hier.RemoveMember(mcs); hier.AddMemberChildren(parentMem.UniqueName, false); } } } // finally remove members for (int i = 0; i < memList.Count; i++) { CellsetMember cstMem = (CellsetMember)memList[i]; Hierarchy hier = _report.Schema.GetHierarchyFromMemberUniqueName(cstMem.UniqueName); hier.DataMembers.Remove(cstMem.UniqueName); } }