private void PopulateControls() { int pageNumber = 1; int pagePerNumber = Convert.ToInt32(WebConfiguration.PagePerNumber); int notBuyMax = 0; DataTable lists = bll.GetJianGeFenXiList(userId, pageNumber, pagePerNumber, out howManyItems, out notBuyMax); List.DataSource = lists; List.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(lists, "ItemBuyDate"); }
private void PopulateControls() { int userId = Convert.ToInt32(Session["UserID"]); int pageNumber = 1; int pagePerNumber = Convert.ToInt32(WebConfiguration.PagePerNumber); int howManyItems = 0; int notBuyMax = 0; MonthBLL bll = new MonthBLL(); DataTable dt = bll.GetJianGeFenXiList(userId, pageNumber, pagePerNumber, out howManyItems, out notBuyMax); string max = "1"; string step = "1"; string itemName = ""; string notBuy = ""; if (dt.Rows.Count > 0) { max = notBuyMax.ToString(); step = Math.Floor(Convert.ToDouble(max) / 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; notBuy += dr["NotBuy"].ToString() + dot; i++; } } Response.Write(GetChartJsonString(itemName, notBuy, max, step)); Response.End(); }
protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["page"] != "" && Request.QueryString["page"] != null) { int userId = Convert.ToInt32(Session["UserID"]); int pageNumber = Convert.ToInt32(Request.QueryString["page"]); int pagePerNumber = Convert.ToInt32(WebConfiguration.PagePerNumber); int howManyItems = 0; int notBuyMax = 0; StringBuilder items = new StringBuilder(); items.Append("["); MonthBLL bll = new MonthBLL(); DataTable dt = bll.GetJianGeFenXiList(userId, pageNumber, pagePerNumber, out howManyItems, out notBuyMax); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { items.Append("{"); items.Append("\"RowNumber\":" + "\"" + dr["RowNumber"].ToString() + "\","); items.Append("\"ItemTypeName\":" + "\"" + dr["ItemTypeName"].ToString() + "\","); items.Append("\"ItemName\":" + "\"" + dr["ItemName"].ToString() + "\","); items.Append("\"ItemBuyDate\":" + "\"" + Convert.ToDateTime(dr["ItemBuyDate"].ToString()).ToString("yyyy-MM-dd") + "\","); items.Append("\"ItemBuyDateMax\":" + "\"" + Convert.ToDateTime(dr["ItemBuyDateMax"].ToString()).ToString("yyyy-MM-dd") + "\","); items.Append("\"NotBuy\":" + "\"" + dr["NotBuy"].ToString() + "\""); items.Append("},"); } items.Remove(items.ToString().LastIndexOf(','), 1); } items.Append("]"); Response.Write(items.ToString()); Response.End(); } }