private void PopulateControls() { decimal priceMax = 0m; DataTable lists = bll.GetBiJiaoFenXiList(userId, today, "list", out priceMax); List.DataSource = lists; List.DataBind(); double zhiTotalCur = 0d; double shouTotalCur = 0d; double zhiTotalPrev = 0d; double shouTotalPrev = 0d; foreach (DataRow dr in lists.Rows) { zhiTotalCur += Convert.ToDouble(dr["ZhiPriceCur"]); shouTotalCur += Convert.ToDouble(dr["ShouPriceCur"]); zhiTotalPrev += Convert.ToDouble(dr["ZhiPricePrev"]); shouTotalPrev += Convert.ToDouble(dr["ShouPricePrev"]); } this.Label4.Text = zhiTotalCur.ToString("0.0##"); this.Label2.Text = shouTotalCur.ToString("0.0##"); this.Label5.Text = zhiTotalPrev.ToString("0.0##"); this.Label3.Text = shouTotalPrev.ToString("0.0##"); DataTable dt = bll.GetBiJiaoFenXiList(userId, today, "chart", out priceMax); this.hidChartData.Value = ItemHelper.GetChartData(dt, "PageUrl"); }
private void PopulateControls() { int userId = Convert.ToInt32(Session["UserID"]); DateTime today = Convert.ToDateTime(Session["TodayDate"]); decimal priceMax = 0m; MonthBLL bll = new MonthBLL(); DataTable dt = bll.GetBiJiaoFenXiList(userId, today, "chart", out priceMax); string max = "1"; string step = "1"; string catTypeName = ""; string itemPriceCur = ""; string itemPricePrev = ""; if (dt.Rows.Count > 0) { max = (priceMax > 0 ? Math.Floor(priceMax).ToString() : "1"); step = Math.Floor(Convert.ToDouble(max) / 10).ToString(); int i = 0; foreach (DataRow dr in dt.Rows) { string dot = (i < dt.Rows.Count - 1 ? "," : ""); catTypeName += "{\"text\":\"" + dr["CategoryTypeName"].ToString() + "\",\"rotate\":0}" + dot; itemPriceCur += dr["ZhiPriceCur"].ToString() + dot; itemPricePrev += dr["ZhiPricePrev"].ToString() + dot; i++; } } Response.Write(GetChartJsonString(catTypeName, itemPriceCur, itemPricePrev, max, step)); Response.End(); }