public CellsetMember[] GetColumnTuple(int columnPos) { if (_columnMembers == null) { throw new Exception("Cellset not loaded"); } CellsetMember[] ret = new CellsetMember[_columnTupleMembers]; for (int i = 0; i < ret.Length; i++) { ret[i] = GetColumnMember(i, columnPos); } return(ret); }
public void DrillUp(System.Collections.Specialized.StringCollection Identifiers) { ArrayList list = 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 mem = _report.Cellset.GetCellsetMember((byte)axisOrdinal, mpos, pos); list.Add(mem); } _report.DrillUp((CellsetMember[])list.ToArray(typeof(CellsetMember))); }
internal virtual bool GetValueForSort(CellsetMember x, ICubeAddress y, List <Member> fColMembers, List <Member> fRowMembers, out object Value) { var a = x.GetAddress(); a.Merge(y); var b = GetCellValue(a, out Value); if (!b) { return(false); } var sm = a.MeasureMode; if (sm == null || IsNativeDataPresent(sm)) { return(b); } switch (sm.Mode) { case MeasureShowModeType.smPercentParentColItem: x = x.FParent; if (x == null) { return(true); } a = x.GetAddress(); a.Merge(y); object V; var b1 = GetCellValue(a, out V); if (!b1) { return(b); } try { Value = Convert.ToDouble(Value) / Convert.ToDouble(V); } catch { ; } break; case MeasureShowModeType.smPercentColTotal: a = x.GetAddress(); if (y.Measure != null) { a.Measure = y.Measure; a.MeasureMode = y.MeasureMode; } b1 = GetCellValue(a, out V); if (!b1) { return(b); } try { Value = Convert.ToDouble(Value) / Convert.ToDouble(V); } catch { ; } break; case MeasureShowModeType.smColumnRank: if (!(Value is IComparable)) { return(true); } if (a.Measure == null) { return(true); } a.MeasureMode = a.Measure.ShowModes[0]; var Rank = 1; var cmp = Value as IComparable; foreach (var m in fColMembers) { if (m == null) { continue; } try { a.AddMember(m); object vv; if (GetCellValue(a, out vv)) { if (cmp.CompareTo(vv) < 0) { Rank++; } } } catch { ; } } Value = Rank; break; case MeasureShowModeType.smRowRank: try { Value = -Convert.ToDouble(Value); } catch { ; } break; case MeasureShowModeType.smSpecifiedByEvent: if (!Grid.EventShowMeasureAssigned) { throw new Exception(string.Format(RadarUtils.GetResStr("rssmError"), a.Measure.DisplayName, sm.Caption)); } var E = new ShowMeasureArgs(Value, sm, null); E.fRowSiblings = fRowMembers; E.fColumnSiblings = fColMembers; E.fEvaluator = new Evaluator(Grid, a); Grid.EventShowMeasure(E); Value = E.ReturnData; break; } return(b); }
public void LoadHtmlTable() { System.Web.UI.HtmlControls.HtmlTable tblPivot = new System.Web.UI.HtmlControls.HtmlTable(); tblPivot.CellPadding = 0; tblPivot.CellSpacing = 0; tblPivot.Width = "100%"; tblPivot.Height = "100%"; tblPivot.Attributes.Add("class", "tbl1_T"); pnlPivot.Controls.Add(tblPivot); if (_report == null || _report.Cellset.IsValid == false) { return; } int Ax0MemCount = _report.Cellset.Axis0TupleMemCount; int Ax1MemCount = _report.Cellset.Axis1TupleMemCount; int Ax0PosCount = _report.Cellset.Axis0PosCount; int Ax1PosCount = _report.Cellset.Axis1PosCount; int ax0OrderPos = _report.GetOrderPosition(_report.Axes[0]); int ax1OrderPos = _report.GetOrderPosition(_report.Axes[1]); Hierarchy ax1Hier = null; Hierarchy ax0Hier = null; //table System.Web.UI.HtmlControls.HtmlTableRow tr = null; System.Web.UI.HtmlControls.HtmlTableCell td = null; if (Ax0PosCount == 0 && Ax1PosCount == 0) { tr = new HtmlTableRow(); tblPivot.Rows.Add(tr); td = new HtmlTableCell(); tr.Cells.Add(td); td.Attributes.Add("class", "tbl1_err"); td.Attributes.Add("nowrap", "true"); td.InnerText = "Query successfully executed, cellset contains no data"; return; } for (int i = 0; i < Ax0MemCount; i++) { tr = new System.Web.UI.HtmlControls.HtmlTableRow(); tblPivot.Rows.Add(tr); for (int j = 0; j < Ax1MemCount; j++) { td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.Attributes.Add("class", "tbl1_HC"); td.NoWrap = true; tr.Cells.Add(td); //hier controls in last row if (i == Ax0MemCount - 1) { this.CreateHierControls(_report.Axes[1].Hierarchies[j], td); } } ax0Hier = _report.Axes[0].Hierarchies[i]; for (int j = 0; j < Ax0PosCount; j++) { CellsetMember mem = _report.Cellset.GetCellsetMember(0, i, j); bool inOrderTuple = false; //if same as prev, continue if (j != 0 && _report.Cellset.GetCellsetMember(0, i, j - 1).UniqueName == mem.UniqueName) { continue; } td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.NoWrap = true; // handle order position highlight if (j == ax0OrderPos) // in order tuple { inOrderTuple = true; } // handle colspan int spanCount = 1; for (int n = j + 1; n < Ax0PosCount; n++) { CellsetMember nextMem = _report.Cellset.GetCellsetMember(0, i, n); if (nextMem.UniqueName == mem.UniqueName) { spanCount++; // handle order position highlight if (n == ax0OrderPos) { inOrderTuple = true; } } else { break; } } // handle order position highlight if (inOrderTuple) // in order tuple { td.Attributes.Add("class", "tbl1_H3"); } else { td.Attributes.Add("class", "tbl1_H2"); } // if we span if (spanCount > 1) { td.ColSpan = spanCount; } if (mem.ChildCount == 0) { // leaf-level System.Web.UI.HtmlControls.HtmlImage img = new System.Web.UI.HtmlControls.HtmlImage(); img.Src = "../images/leaf.gif"; td.Controls.Add(img); } System.Web.UI.HtmlControls.HtmlInputCheckBox chb = new System.Web.UI.HtmlControls.HtmlInputCheckBox(); chb.ID = "m:" + _contr.IdentifierFromCellsetPosition(0, j, i); chb.EnableViewState = false; td.EnableViewState = false; td.Controls.Add(chb); System.Web.UI.LiteralControl literal = new System.Web.UI.LiteralControl(mem.Name); td.Controls.Add(literal); tr.Cells.Add(td); } // hier controls in last col td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.Attributes.Add("class", "tbl1_HC"); td.NoWrap = true; CreateHierControls(ax0Hier, td); tr.Cells.Add(td); } for (int i = 0; i < Ax1PosCount; i++) { tr = new System.Web.UI.HtmlControls.HtmlTableRow(); tblPivot.Rows.Add(tr); for (int j = 0; j < Ax1MemCount; j++) { ax1Hier = _report.Axes[1].Hierarchies[j]; CellsetMember mem = _report.Cellset.GetCellsetMember(1, j, i); bool inOrderTuple = false; //if same as prev, continue if (i != 0 && _report.Cellset.GetCellsetMember(1, j, i - 1).UniqueName == mem.UniqueName) { continue; } td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.NoWrap = true; // handle order position highlight if (i == ax1OrderPos) // in order tuple { inOrderTuple = true; } // handle rowspan int spanCount = 1; for (int n = i + 1; n < Ax1PosCount; n++) { CellsetMember nextMem = _report.Cellset.GetCellsetMember(1, j, n); if (nextMem.UniqueName == mem.UniqueName) { spanCount++; // handle order position highlight if (n == ax1OrderPos) { inOrderTuple = true; } } else { break; } } // handle order position highlight if (inOrderTuple) // in order tuple { td.Attributes.Add("class", "tbl1_H1"); } else { td.Attributes.Add("class", "tbl1_H"); } // if we span if (spanCount > 1) { td.RowSpan = spanCount; } if (mem.ChildCount == 0) { // leaf-level System.Web.UI.HtmlControls.HtmlImage img = new System.Web.UI.HtmlControls.HtmlImage(); img.Src = "../images/leaf.gif"; td.Controls.Add(img); } System.Web.UI.HtmlControls.HtmlInputCheckBox chb = new System.Web.UI.HtmlControls.HtmlInputCheckBox(); chb.ID = "m:" + _contr.IdentifierFromCellsetPosition(1, i, j); chb.EnableViewState = false; td.EnableViewState = false; td.Controls.Add(chb); System.Web.UI.LiteralControl literal = new System.Web.UI.LiteralControl(mem.Name); td.Controls.Add(literal); tr.Cells.Add(td); } for (int j = 0; j < Ax0PosCount; j++) { td = new System.Web.UI.HtmlControls.HtmlTableCell(); td.Attributes.Add("class", "tbl1_C"); td.NoWrap = true; Cell olapCell = _report.Cellset.GetCell(j, i); td.InnerText = olapCell.FormattedValue; tr.Cells.Add(td); } } }
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); } }
private string ExportToCSV() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); //-------------------------------- slice--------------------------------------- Hierarchy[] hiers = this.Axes[2].Hierarchies.ToSortedByUniqueNameArray(); for (int i = 0; i < hiers.Length; i++) { Hierarchy hier = hiers[i]; //not displaying without mems if (hier.FilterMember == null) { continue; } DataMember mem = hier.FilterMember; //not displaying only with "All" members if (mem.LevelDepth == 0 && !(mem is CalculatedMember) && hier.Levels[0].IsAllLevel) { continue; } // add hier and mem sb.Append(hier.DisplayName); sb.Append(": "); Olap.CalculatedMemberTemplates.MembersAggregate aggMem = mem as Olap.CalculatedMemberTemplates.MembersAggregate; if (aggMem != null) //if aggregate, show children instead of agg itself { for (int j = 0; j < aggMem.Members.Count; j++) { sb.Append(aggMem.Members[j].Name); if (j < aggMem.Members.Count - 1) { sb.Append(", "); } } } else { sb.Append(mem.Name); } sb.Append("\r\n"); } sb.Append("\r\n"); //----------------------------------------------------------------------------- int Ax0MemCount = this.Cellset.Axis0TupleMemCount; int Ax1MemCount = this.Cellset.Axis1TupleMemCount; int Ax0PosCount = this.Cellset.Axis0PosCount; int Ax1PosCount = this.Cellset.Axis1PosCount; Hierarchy ax1Hier = null; Hierarchy ax0Hier = null; //-------------------------------- table--------------------------------------- System.Web.UI.HtmlControls.HtmlTableRow tr = null; System.Web.UI.HtmlControls.HtmlTableCell td = null; if (this.Cellset.IsValid == false) { return("Cellset contains no data"); } for (int i = 0; i < Ax0MemCount; i++) { for (int j = 0; j < Ax1MemCount; j++) { //hier uname in last row if (i == Ax0MemCount - 1) { sb.Append(this.Axes[1].Hierarchies[j].DisplayName); } sb.Append("\t"); } ax0Hier = this.Axes[0].Hierarchies[i]; for (int j = 0; j < Ax0PosCount; j++) { CellsetMember mem = this.Cellset.GetCellsetMember(0, i, j); sb.Append(mem.Name); sb.Append("\t"); } // hier name in last col sb.Append(ax0Hier.DisplayName); sb.Append("\r\n"); } for (int i = 0; i < Ax1PosCount; i++) { for (int j = 0; j < Ax1MemCount; j++) { ax1Hier = this.Axes[1].Hierarchies[j]; CellsetMember mem = this.Cellset.GetCellsetMember(1, j, i); sb.Append(mem.Name); sb.Append("\t"); } for (int j = 0; j < Ax0PosCount; j++) { Cell olapCell = this.Cellset.GetCell(j, i); sb.Append(olapCell.FormattedValue.Replace(System.Globalization.NumberFormatInfo.CurrentInfo.NumberGroupSeparator, "")); sb.Append("\t"); } sb.Append("\r\n"); } return(sb.ToString()); }
private string ExportToHTML() { System.Text.StringBuilder sb = new System.Text.StringBuilder(); // style sb.Append(@" <html><head><meta charset='utf-8'></meta> <style> .tbl1_H { text-align:left; PADDING-RIGHT: 2pt; border: solid 1px #aaaaaa; PADDING-LEFT: 2pt; FONT-SIZE: 8pt; COLOR: black; font-face: tahoma ; ; padding-top: 1px ; padding-bottom: 1px; BACKGROUND-COLOR: #e0e0e0; } .tbl1_H1 { text-align:left; PADDING-RIGHT: 2pt; border: solid 1px #aaaaaa; PADDING-LEFT: 2pt; FONT-SIZE: 8pt; COLOR: black; FONT-WEIGHT: bold; font-face: tahoma ; ; padding-top: 1px ; padding-bottom: 1px; BACKGROUND-COLOR: #e0e0e0; } .tbl1_H2 { text-align:center; PADDING-RIGHT: 2pt; border: solid 1px #aaaaaa; PADDING-LEFT: 2pt; FONT-SIZE: 8pt; COLOR: black; font-face: tahoma ; padding-top: 1px ; padding-bottom: 1px; BACKGROUND-COLOR: #e0e0e0; } .tbl1_H3 { text-align:center; PADDING-RIGHT: 2pt; border: solid 1px #aaaaaa; PADDING-LEFT: 2pt; FONT-SIZE: 8pt; COLOR: black; FONT-WEIGHT: bold; font-face: tahoma ; ; padding-top: 1px ; padding-bottom: 1px; BACKGROUND-COLOR: #e0e0e0; } .tbl1_HC { background-color:#FFFFC0; FONT-SIZE: 8pt; font-face: tahoma;PADDING-LEFT: 2pt;PADDING-RIGHT: 2pt; } .tbl1_T { border-collapse:collapse; } .tbl1_C { text-align:right; PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 8pt; BACKGROUND-COLOR: white; font-face: tahoma; padding-top: 1px ; padding-bottom: 1px; border: solid 1px #888888; } .tbl1_C1 { text-align:left; PADDING-RIGHT: 2pt; PADDING-LEFT: 2pt; FONT-SIZE: 8pt; BACKGROUND-COLOR: white; font-face: tahoma; padding-top: 1px ; padding-bottom: 1px; border: solid 1px #888888; } .tbl1_C2 { text-align:right; PADDING-RIGHT: 2pt; PADDING-LEFT: 6pt; FONT-SIZE: 8pt; BACKGROUND-COLOR: white; font-face: tahoma; padding-top: 1px ; padding-bottom: 1px; border: solid 1px #888888; } </style> </head> <body> " ); // ----- HEADER ------ sb.Append(@" <table cellspacing=0 cellpadding=3 width=100% class=capt><tr><td align=right style='BORDER-WIDTH:0px;background-color:red'> <font face=ArialBlack color=white size=1><b><i>© FieldForce Solutions </b></i></font> </tr></td> <tr><td style='BACKGROUND:#e0e0e0; BORDER-WIDTH:0px;'> <B><font color=red size=-1>" + this.Description + @"</font></B><font color=black size=-2><i> (description)</i></font> <br> <B><font color=4682b4 size=-2>" + this.Name + @"</font></B><font color=black size=-2><i> (name)</i></font> <BR> <B><font color=4682b4 size=-2>" + this.Owner.Name + @"</font></B><font color=black size=-2><i> (owner)</i></font> <BR> <B><font color=4682b4 size=-2>" + System.DateTime.Now.ToShortDateString() + " " + System.DateTime.Now.ToShortTimeString() + @"</font></B><font color=black size=-2><i> (distributed)</i></font> </td></tr> </table> <hr> " ); //-------------------------------- slice--------------------------------------- // table start sb.Append("<table cellpadding=0 cellspacing=0 width=100 class='tbl1_T'>"); Hierarchy[] hiers = this.Axes[2].Hierarchies.ToSortedByUniqueNameArray(); for (int i = 0; i < hiers.Length; i++) { Hierarchy hier = hiers[i]; //not displaying without mems if (hier.FilterMember == null) { continue; } DataMember mem = hier.FilterMember; //not displaying only with "All" members if (mem.LevelDepth == 0 && !(mem is CalculatedMember) && hier.Levels[0].IsAllLevel) { continue; } // add hier row sb.Append("<tr><td class=tbl1_H nowrap=1>"); sb.Append(hier.DisplayName); sb.Append("</td></tr>"); // add mem row Olap.CalculatedMemberTemplates.MembersAggregate aggMem = mem as Olap.CalculatedMemberTemplates.MembersAggregate; if (aggMem != null) //if aggregate, show children instead of agg itself { foreach (Olap.Object childMem in aggMem.Members) { sb.Append("<tr><td class=tbl1_C nowrap=1>"); sb.Append(childMem.Name); sb.Append("</td></tr>"); } continue; } sb.Append("<tr><td class=tbl1_C nowrap=1>"); sb.Append(mem.Name); sb.Append("</td></tr>"); } // table end sb.Append("</table><br>"); //----------------------------------------------------------------------------- if (this.Cellset.IsValid == false) { return("Cellset contains no data"); } int Ax0MemCount = this.Cellset.Axis0TupleMemCount; int Ax1MemCount = this.Cellset.Axis1TupleMemCount; int Ax0PosCount = this.Cellset.Axis0PosCount; int Ax1PosCount = this.Cellset.Axis1PosCount; int ax0OrderPos = this.GetOrderPosition(this.Axes[0]); int ax1OrderPos = this.GetOrderPosition(this.Axes[1]); Hierarchy ax1Hier = null; Hierarchy ax0Hier = null; // table start sb.Append("<table cellpadding=0 cellspacing=0 class='tbl1_T'>"); if (Ax0PosCount == 0 && Ax1PosCount == 0) { return("Cellset contains no data"); } for (int i = 0; i < Ax0MemCount; i++) { sb.Append("<tr>"); //row start for (int j = 0; j < Ax1MemCount; j++) { sb.Append("<td class='tbl1_HC' nowrap=1>"); //hier uname in last row if (i == Ax0MemCount - 1) { sb.Append(this.Axes[1].Hierarchies[j].DisplayName); } sb.Append("</td>"); } ax0Hier = this.Axes[0].Hierarchies[i]; for (int j = 0; j < Ax0PosCount; j++) { bool inOrderTuple = false; CellsetMember mem = this.Cellset.GetCellsetMember(0, i, j); //if same as prev, continue if (j != 0 && this.Cellset.GetCellsetMember(0, i, j - 1).UniqueName == mem.UniqueName) { continue; } // handle order position highlight if (j == ax0OrderPos) // in order tuple { inOrderTuple = true; } // handle colspan int spanCount = 1; for (int n = j + 1; n < Ax0PosCount; n++) { CellsetMember nextMem = this.Cellset.GetCellsetMember(0, i, n); if (nextMem.UniqueName == mem.UniqueName) { spanCount++; // handle order position highlight if (n == ax0OrderPos) { inOrderTuple = true; } } else { break; } } // handle order position highlight if (inOrderTuple) // in order tuple { sb.Append("<td class='tbl1_H3' nowrap=1 "); } else { sb.Append("<td class='tbl1_H2' nowrap=1 "); } // if we span if (spanCount > 1) { sb.Append("colspan=" + spanCount.ToString()); } sb.Append(">"); sb.Append(mem.Name); sb.Append("</td>"); } // hier in last col sb.Append("<td class='tbl1_HC' nowrap=1>"); sb.Append(ax0Hier.DisplayName); sb.Append("</td>"); sb.Append("</tr>"); //row end } for (int i = 0; i < Ax1PosCount; i++) { sb.Append("<tr>"); //row start for (int j = 0; j < Ax1MemCount; j++) { bool inOrderTuple = false; ax1Hier = this.Axes[1].Hierarchies[j]; CellsetMember mem = this.Cellset.GetCellsetMember(1, j, i); //if same as prev, continue if (i != 0 && this.Cellset.GetCellsetMember(1, j, i - 1).UniqueName == mem.UniqueName) { continue; } // handle order position highlight if (i == ax1OrderPos) // in order tuple { inOrderTuple = true; } // handle rowspan int spanCount = 1; for (int n = i + 1; n < Ax1PosCount; n++) { CellsetMember nextMem = this.Cellset.GetCellsetMember(1, j, n); if (nextMem.UniqueName == mem.UniqueName) { spanCount++; // handle order position highlight if (n == ax1OrderPos) { inOrderTuple = true; } } else { break; } } // handle order position highlight if (inOrderTuple) // in order tuple { sb.Append("<td class='tbl1_H1' nowrap=1 "); } else { sb.Append("<td class='tbl1_H' nowrap=1 "); } // if we span if (spanCount > 1) { sb.Append("rowspan=" + spanCount.ToString()); } sb.Append(">"); sb.Append(mem.Name); sb.Append("</td>"); } for (int j = 0; j < Ax0PosCount; j++) { sb.Append("<td class='tbl1_C' nowrap=1>"); Cell olapCell = this.Cellset.GetCell(j, i); sb.Append(olapCell.FormattedValue); sb.Append("</td>"); } sb.Append("</tr>"); // row end } sb.Append("</table>"); // table end sb.Append("</body></html>"); // body end return(sb.ToString()); }
public void DrillUp(CellsetMember[] cstMems) { if(cstMems==null || cstMems.Length==0) return; short axisOrd=this.Axis.Ordinal; int hierOrd=this.Ordinal; bool cleanupDone=false; foreach(CellsetMember mem in cstMems) { if(!mem.BelongsTo(this)) continue; if(mem.LevelDepth==0) continue; //delete data members and sets if( !cleanupDone ) { this.DataMembers.Clear(); this.CalculatedMembers.ClearSets(); cleanupDone=true; } //add new members MemberChildrenSet mcs=this.AddGrandParentChildrenSet(mem.UniqueName); if(mcs==null) // this means parent grandpa is hierarchy this.AddParentMemberWithSiblings(mem.UniqueName); } }
public void DrillDown(CellsetMember[] cstMems, bool IfLeafAddItself) { if(cstMems==null || cstMems.Length==0) return; short axisOrd=this.Axis.Ordinal; int hierOrd=this.Ordinal; bool cleanupDone=false; foreach(CellsetMember mem in cstMems) { if(!mem.BelongsTo(this)) continue; if(mem.ChildCount<=0 && !IfLeafAddItself) continue; //delete data members and sets if( !cleanupDone ) { this.DataMembers.Clear(); this.CalculatedMembers.ClearSets(); cleanupDone=true; } //add new members this.AddMemberChildrenSet(mem.UniqueName, IfLeafAddItself); } }
public void LoadCellset(string cellsetString) { _columnMembers = null; _columnMembers = null; _cells = null; string[] level1Parts = cellsetString.Split(new string[] { __del4 }, StringSplitOptions.None); if (level1Parts.Length != 5) { throw new Exception("Invalid cellsetString, split"); } //first part - axis0 metadata string[] axis0Metadata = level1Parts[0].Split(new string[] { __del2 }, StringSplitOptions.None); if (axis0Metadata.Length != 2) { throw new Exception("Invalid cellsetString, axis0 metadata"); } _columnCount = int.Parse(axis0Metadata[0]); _columnTupleMembers = int.Parse(axis0Metadata[1]); //second part - axis1 metadata string[] axis1Metadata = level1Parts[1].Split(new string[] { __del2 }, StringSplitOptions.None); if (axis1Metadata.Length != 2) { throw new Exception("Invalid cellsetString, axis1 metadata"); } _rowCount = int.Parse(axis1Metadata[0]); _rowTupleMembers = int.Parse(axis1Metadata[1]); //third part - axis0 members if (_columnCount > 0) { string[] axis0PosArr = level1Parts[2].Split(new string[] { __del3 }, StringSplitOptions.None); if (axis0PosArr.Length != _columnCount) { throw new Exception("Invalid cellsetString, axis0 pos count"); } for (int i = 0; i < _columnCount; i++) { string[] axis0MemArr = axis0PosArr[i].Split(new string[] { __del2 }, StringSplitOptions.None); for (int j = 0; j < _columnTupleMembers; j++) { string[] memProps = axis0MemArr[j].Split(new string[] { __del1 }, StringSplitOptions.None); CellsetMember mem = new CellsetMember(i, j, memProps[0], memProps[1], int.Parse(memProps[2]), short.Parse(memProps[3])); if (_columnMembers == null) // initialize { _columnMembers = new CellsetMember[_columnTupleMembers, _columnCount]; } _columnMembers[j, i] = mem; } } } //fourth part - axis1 members if (_rowCount > 0) { string[] axis1PosArr = level1Parts[3].Split(new string[] { __del3 }, StringSplitOptions.None); if (axis1PosArr.Length != _rowCount) { throw new Exception("Invalid cellsetString, axis1 pos count"); } for (int i = 0; i < _rowCount; i++) { string[] axis1MemArr = axis1PosArr[i].Split(new string[] { __del2 }, StringSplitOptions.None); for (int j = 0; j < _rowTupleMembers; j++) { string[] memProps = axis1MemArr[j].Split(new string[] { __del1 }, StringSplitOptions.None); CellsetMember mem = new CellsetMember(i, j, memProps[0], memProps[1], int.Parse(memProps[2]), short.Parse(memProps[3])); if (_rowMembers == null) // initialize { _rowMembers = new CellsetMember[_rowTupleMembers, _rowCount]; } _rowMembers[j, i] = mem; } } } //fifth part - cells if (_columnCount > 0 && _rowCount > 0) { // intialize cells _cells = new Cell[_columnCount, _rowCount]; string[] axis0CellPosArr = level1Parts[4].Split(new string[] { __del3 }, StringSplitOptions.None); if (axis0CellPosArr.Length != _columnCount) { throw new Exception("Invalid cellsetString, axis0 cell pos count"); } for (int i = 0; i < _columnCount; i++) { string[] axis1CellPosArr = axis0CellPosArr[i].Split(new string[] { __del2 }, StringSplitOptions.None); for (int j = 0; j < _rowCount; j++) { string[] cellValues = axis1CellPosArr[j].Split(new string[] { __del1 }, StringSplitOptions.None); _cells[i, j] = new Cell(cellValues[0], cellValues[1]); } } } }