/// <summary> /// 得到一个单元格内的字符串 /// </summary> /// <param name="pk1">pk1</param> /// <param name="pk2">pk2</param> /// <returns>html 标记</returns> public string GenerHtmlStrBy(string d1EnsName, string pk1, string d2EnsName, string pk2, AnalyseDataType adt) { RptPlanarCell en = this.GetCell(pk1, pk2); if (en.Url == "") { return(en.val.ToString()); } try { switch (adt) { case AnalyseDataType.AppFloat: return("<A href=\"javascript:openit('" + en.Url + "&" + d1EnsName + "=" + pk1 + "&" + d2EnsName + "=" + pk2 + "')\" >" + float.Parse(en.val.ToString()) + "</A>"); case AnalyseDataType.AppInt: return("<A href=\"javascript:openit('" + en.Url + "&" + d1EnsName + "=" + pk1 + "&" + d2EnsName + "=" + pk2 + "')\" >" + int.Parse(en.val.ToString()) + "</A>"); case AnalyseDataType.AppMoney: return("<A href=\"javascript:openit('" + en.Url + "&" + d1EnsName + "=" + pk1 + "&" + d2EnsName + "=" + pk2 + "')\" >" + float.Parse(en.val.ToString()).ToString("0.00") + "</A>"); default: throw new Exception("adt 类型错误."); } } catch { return("0"); } }
/// <summary> /// 用到HTML的显示。把Val 根据URL的设置转换为Link. /// </summary> /// <param name="pk1">pk1</param> /// <param name="pk2">pk2</param> /// <returns>string</returns> public string GetCellContext(string pk1, string pk2) { RptPlanarCell cell = this.PlanarCells.GetCell(pk1, pk2); if (cell.Url == "") { return(cell.val.ToString()); } return("<a href='" + cell.Url + "?" + this.SingleDimensionItem1.GetNewEntity.ToString() + "=" + cell.PK1 + "&" + this.SingleDimensionItem2.GetNewEntity.ToString() + "=" + cell.PK2 + "' Target='" + CellUrlTarget + "' >" + cell.val + "</a>"); }
/// <summary> /// 得到一个单元格内的字符串 /// </summary> /// <param name="pk1">pk1</param> /// <param name="pk2">pk2</param> /// <returns>html 标记</returns> public string GenerHtmlStrBy(string pk1, string pk2) { RptPlanarCell en = this.GetCell(pk1, pk2); if (en.Url == "") { return(en.val.ToString()); } string url = en.Url + "&PK1=" + pk1 + "&PK2=" + pk2; return("<A href='javascript:openit('" + url + "')' >" + float.Parse(en.val.ToString()).ToString("0") + "</A>"); //return "<A href=\""+en.Url+"&PK1="+pk1+"&PK2="+pk2+"\" target='_blank'>"+en.val+"</A>"; }
/// <summary> /// 加入一个新的元素 /// </summary> /// <param name="myen">Cell实体</param> public virtual void Add(RptPlanarCell myen) { //判断这个实体是不是存在 foreach (RptPlanarCell en in this) { if (en.PK1 == myen.PK1 && en.PK2 == myen.PK2) { en.val = myen.valOfFloat + myen.valOfFloat; return; } } // 加入这个实体。 this.InnerList.Add(myen); return; }
/// <summary> /// 增加一个新的实体 /// </summary> /// <param name="pk1">pk1</param> /// <param name="pk2">pk2</param> /// <param name="val">两个PK决定值</param> public void Add(string pk1, string pk2, object val) { RptPlanarCell en = new RptPlanarCell(pk1, pk2, val); this.Add(en); }