protected void Page_Load(object sender, EventArgs e) { if (Request.QueryString["page"] != "" && Request.QueryString["page"] != null) { int pageNumber = Int32.Parse(Request.QueryString["page"]); int userId = Int32.Parse(Session["UserID"].ToString()); double priceMax = 0; int howManyItems = 0; StringBuilder items = new StringBuilder(); items.Append("["); DataTable dt = ItemAccess.GetJiaGeFenXiList(userId, pageNumber, out howManyItems, out priceMax); if (dt.Rows.Count > 0) { foreach (DataRow dr in dt.Rows) { items.Append("{"); items.Append("\"RowNumber\":" + "\"" + dr["RowNumber"].ToString() + "\","); items.Append("\"ItemType\":" + "\"" + dr["ItemType"].ToString() + "\","); items.Append("\"ItemTypeValue\":" + "\"" + dr["ItemTypeValue"].ToString() + "\","); items.Append("\"ItemName\":" + "\"" + dr["ItemName"].ToString() + "\","); items.Append("\"ItemBuyDate\":" + "\"" + DateTime.Parse(dr["ItemBuyDate"].ToString()).ToString("yyyy-MM-dd") + "\","); items.Append("\"ItemPrice\":" + "\"" + Double.Parse(dr["ItemPrice"].ToString()).ToString("0.0##") + "\""); items.Append("},"); } items.Remove(items.ToString().LastIndexOf(','), 1); } items.Append("]"); Response.Write(items.ToString()); Response.End(); } }
protected void PopulateControls() { int userId = Int32.Parse(Session["UserID"].ToString()); double priceMax = 0; int pageNumber = 1; int howManyItems = 0; DataTable dt = ItemAccess.GetJiaGeFenXiList(userId, pageNumber, out howManyItems, out priceMax); string max = "1"; string step = "1"; string itemName = ""; string itemPrice = ""; if (dt.Rows.Count > 0) { max = Math.Floor(priceMax).ToString(); step = Math.Floor(Double.Parse(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; itemPrice += dr["ItemPrice"].ToString() + dot; i++; } } Response.Write(GetChartJsonString(itemName, itemPrice, max, step)); Response.End(); }
protected void PopulateControls() { int pageNumber = 1; double priceMax = 0; DataTable dt = ItemAccess.GetJiaGeFenXiList(userId, pageNumber, out howManyItems, out priceMax); ItemList.DataSource = dt; ItemList.DataBind(); this.hidChartData.Value = ItemHelper.GetChartData(dt, "PageUrl"); }