//设置图表 private void GetChartInfo() { DataTable dt = new DataTable(); DateTime now = DateTime.Now.Date; if (curDate != "") { now = Convert.ToDateTime(curDate).Date; } switch (chartType) { case "datechart": decimal priceMax = 0m; dt = month_bll.GetItemDateTopList(userId, now, "chart", out priceMax); chartDate = ItemHelper.GetChartData(dt, "ItemBuyDate"); chartUrl = "/Web2015/ItemDateChartJson.aspx?date=" + curDate; break; case "numchart": dt = month_bll.GetItemNumTopList(userId, now); chartDate = ItemHelper.GetChartData(dt, "ChartUrl"); chartUrl = "/Web2015/ItemNumChartJson.aspx?date=" + curDate; break; case "pricechart": dt = month_bll.GetItemPriceTopList(userId, now); chartDate = ItemHelper.GetChartData(dt, "ItemBuyDate"); chartUrl = "/Web2015/ItemPriceChartJson.aspx?date=" + curDate; break; } }
//初始数据 private void PopulateControls() { decimal priceMax = 0m; DataTable lists = bll.GetItemDateTopList(userId, today, "list", out priceMax); DateTop.DataSource = lists; DateTop.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(lists, "ItemBuyDate"); }
//初始数据 private void BindGrid() { int userId = Convert.ToInt32(Session["UserID"]); DateTime today = Utility.GetRequestDate(Request.QueryString["date"]); //图表点击所需数据 decimal priceMax = 0m; DataTable dt = month_bll.GetItemDateTopList(userId, today, "chart", out priceMax); this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate"); #region 每日消费代码 DataTable total = month_bll.GetShouZhiJieHuanList(userId, today); this.Label2.Text = Convert.ToDouble(total.Rows[0]["ShouRuPrice"]).ToString("0.0##"); this.Label4.Text = Convert.ToDouble(total.Rows[0]["ZhiChuPrice"]).ToString("0.0##"); this.Label1.Text = Convert.ToDouble(total.Rows[0]["ShouRuPriceMonth"]).ToString("0.0##"); this.Label3.Text = Convert.ToDouble(total.Rows[0]["ZhiChuPriceMonth"]).ToString("0.0##"); this.Label11.Text = Convert.ToDouble(total.Rows[0]["ShouRuPriceYear"]).ToString("0.0##"); this.Label12.Text = Convert.ToDouble(total.Rows[0]["ZhiChuPriceYear"]).ToString("0.0##"); double JieChuPrice = Convert.ToDouble(total.Rows[0]["JieChuPriceYear"]); double HuanRuPrice = Convert.ToDouble(total.Rows[0]["HuanRuPriceYear"]); double JieRuPrice = Convert.ToDouble(total.Rows[0]["JieRuPriceYear"]); double HuanChuPrice = Convert.ToDouble(total.Rows[0]["HuanChuPriceYear"]); this.Label5.Text = JieChuPrice.ToString("0.##"); this.Label6.Text = HuanRuPrice.ToString("0.##"); this.Label7.Text = JieRuPrice.ToString("0.##"); this.Label8.Text = HuanChuPrice.ToString("0.##"); this.Label9.Text = (JieChuPrice - HuanRuPrice).ToString("0.##"); this.Label10.Text = (JieRuPrice - HuanChuPrice).ToString("0.##"); #endregion //首页功能链接 string userFunction = ""; if (Session["UserFunction"] != null) { userFunction = Session["UserFunction"].ToString(); } this.Label13.Text = UserHelper.GetUserFunctionText(userFunction); //钱包列表 this.CardList.DataSource = card_bll.GetCardList(userId); this.CardList.DataTextField = "CardName"; this.CardList.DataValueField = "CDID"; this.CardList.DataBind(); if (Request.Cookies["CardID"] != null) { string cardId = Request.Cookies["CardID"].Value; this.CardList.SelectedValue = cardId; } CardList_SelectionChanged(this.CardList, null); }
private void PopulateControls() { int userId = Convert.ToInt32(Session["UserID"]); DateTime today = Convert.ToDateTime(Session["TodayDate"]); if (curDate != "") { today = Convert.ToDateTime(curDate); } string orderBy = Request.QueryString["orderBy"] ?? "chart"; decimal priceMax = 0m; MonthBLL bll = new MonthBLL(); DataTable dt = bll.GetItemDateTopList(userId, today, orderBy, out priceMax); string max = "1"; string step = "1"; string itemBuyDate = ""; string shouruPrice = ""; string zhichuPrice = ""; string tip = (orderBy == "list" ? "#x_label#" : today.ToString("yyyy-MM-") + "#x_label#"); if (dt.Rows.Count > 0) { max = Math.Ceiling(priceMax).ToString(); step = Math.Floor(Convert.ToDouble(max) / 10).ToString(); int i = 0; foreach (DataRow dr in dt.Rows) { string dot = (i < dt.Rows.Count - 1 ? "," : ""); string date = (orderBy == "list" ? Convert.ToDateTime(dr["ItemBuyDate"]).ToString("yyyy-MM-dd") : Convert.ToDateTime(dr["ItemBuyDate"]).ToString("dd")); int rotate = (orderBy == "list" ? 90 : 0); itemBuyDate += "{\"text\":\"" + date + "\",\"rotate\":" + rotate + "}" + dot; shouruPrice += dr["ShouRuPrice"].ToString() + dot; zhichuPrice += dr["ZhiChuPrice"].ToString() + dot; i++; } } else { itemBuyDate = "{\"text\":\"0\"},{\"text\":\"1\"}"; } Response.Write(GetChartJsonString(itemBuyDate, shouruPrice, zhichuPrice, max, step, tip)); Response.End(); }