private void PopulateControls() { decimal priceMax = 0m; int countMax = 0; DataTable dt = bll.GetBiJiaoMingXiList(userId, today, catTypeId, out priceMax, out countMax); CatTypeList.DataSource = dt; CatTypeList.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "PageUrlCur"); this.hidChartData2.Value = ItemHelper.GetChartData(dt, "PageUrlPrev"); }
private void PopulateControls() { int userId = Convert.ToInt32(Session["UserID"]); DateTime today = Convert.ToDateTime(Session["TodayDate"]); int catTypeId = Convert.ToInt32(Request.QueryString["catTypeId"]); decimal priceMax = 0m; int countMax = 0; MonthBLL bll = new MonthBLL(); DataTable dt = bll.GetBiJiaoMingXiList(userId, today, catTypeId, out priceMax, out countMax); string max = "1"; string step = "1"; string max2 = "1"; string step2 = "1"; string itemName = ""; string itemPriceCur = ""; string itemPricePrev = ""; string countNumCur = ""; string countNumPrev = ""; if (dt.Rows.Count > 0) { max = Math.Floor(priceMax).ToString(); step = Math.Floor(Convert.ToDouble(max) / 10).ToString(); max2 = countMax.ToString(); step2 = Math.Floor(Convert.ToDouble(max2) / 10).ToString(); int i = 0; foreach (DataRow dr in dt.Rows) { if (i == 15) { break; } string dot = (i < 15 - 1 && i < dt.Rows.Count - 1 ? "," : ""); itemName += "{\"text\":\"" + dr["ItemName"].ToString() + "\",\"rotate\":90}" + dot; itemPriceCur += dr["ItemPriceCur"].ToString() + dot; itemPricePrev += dr["ItemPricePrev"].ToString() + dot; countNumCur += dr["CountNumCur"].ToString() + dot; countNumPrev += dr["CountNumPrev"].ToString() + dot; i++; } } Response.Write(GetChartJsonString(itemName, itemPriceCur, itemPricePrev, countNumCur, countNumPrev, max, step, max2, step2)); Response.End(); }