public string Get3DCellContent(string pk1, string name1, string pk2, string name2, string pk3, string name3) { Rpt3DCell cell = this.DataCells3D.Get3DCell(pk1, pk2, pk3); if (cell == null || cell.Value == null || cell.Value.Equals(DBNull.Value)) { return("-"); } else if (cell.Url == "" || float.Parse(cell.Value.ToString()) == 0 || pk1 == "sum" || pk2 == "sum" || pk3 == "sum" ) { return(cell.Value.ToString()); } else { return("<a href='" + cell.Url + "?" + this.D1EnsName + "=" + cell.PK1 + "&" + this.D2EnsName + "=" + cell.PK2 + "&" + this.D3EnsName + "=" + cell.PK3 + CellAddHref + "' title='" + name1 + "," + name2 + "," + name3 + "'" + " Target='" + cell.Target + "'>" + cell.Value + "</a>"); } }
/// <summary> /// 对维度1进行合计 /// 为了不破坏显示格式,本算法必须设定 this.Style == Rpt3DStyle.LeftD1D2 才计算 /// </summary> /// <param name="sumTitle">合计列上的标题</param> public void AddSumD1(string sumTitleOnD1, string sumTitleOnD2, string sumTitleOnD3) { #region 增加合计 if (this.Style == Rpt3DStyle.LeftD1D2) { this.D1Ens.Add("sum", sumTitleOnD1, "", true); this.D2Ens.Add("sum", sumTitleOnD1, "sum", true); foreach (Dimension en3 in this.D3Ens) { float sum = 0; foreach (Dimension en1 in this.D1Ens) { Dimensions ds2 = this.GetD2EnsBy1FK(en1.No); foreach (Dimension en2 in ds2) { Rpt3DCell cell = this.DataCells3D.Get3DCell(en1.No, en2.No, en3.No); if (cell == null || cell.Value == null || cell.Value.Equals(DBNull.Value)) { } else if (float.Parse(cell.Value.ToString()) == 0) { } else { sum += float.Parse(cell.Value.ToString()); } } } this.DataCells3D.Add("sum", "sum", en3.No, sum, this.CellUrl, this.CellTarget); } } #endregion 增加合计 }
public bool Add(Rpt3DCell add) { if (this.ContainsCell(add)) { return(false); } else { this.InnerList.Add(add); return(true); } }
public bool Add(string pk1, string pk2, string pk3, object val, string url, string target) { if (this.ContainsCell(pk1, pk2, pk3)) { return(false); } else { Rpt3DCell cell = new Rpt3DCell(pk1, pk2, pk3, val, url, target); this.InnerList.Add(cell); return(true); } }
public object GetCellValue(string pk1, string pk2, string pk3) { Rpt3DCell cell = this.DataCells3D.Get3DCell(pk1, pk2, pk3); if (cell == null) { return(null); } else { return(cell.Value); } }
/// <summary> /// 对维度3进行合计 /// </summary> /// <param name="sumTitle">合计列上的标题</param> public void AddSumD3(string sumTitle) { #region 增加合计 foreach (Dimension en1 in this.D1Ens) { Dimensions ds2 = this.GetD2EnsBy1FK(en1.No); foreach (Dimension en2 in ds2) { float sum = 0; Dimensions ds3 = this.GetD3EnsBy2FK(en2.No); if (ds3.Count < 2) { continue; } foreach (Dimension en3 in ds3) { Rpt3DCell cell = this.DataCells3D.Get3DCell(en1.No, en2.No, en3.No); if (cell == null || cell.Value == null || cell.Value.Equals(DBNull.Value)) { } else if (float.Parse(cell.Value.ToString()) == 0) { } else { sum += float.Parse(cell.Value.ToString()); } } if (this.D3RefD2) { this.D3Ens.Add("sum", sumTitle, en2.No, true); } else { this.D3Ens.Add("sum", sumTitle, "", true); } this.DataCells3D.Add(en1.No, en2.No, "sum", sum, this.CellUrl, this.CellTarget); } } #endregion 增加合计 }
public bool ContainsCell(Rpt3DCell cell) { return(ContainsCell(cell.PK1, cell.PK2, cell.PK3)); }