protected void PopulateControls()
    {
        string    today  = Session["TodayDate"].ToString();
        int       userId = Int32.Parse(Session["UserID"].ToString());
        DataTable dt     = ItemAccess.GetItemPriceTopList(today, userId);

        string max       = "1";
        string step      = "1";
        string itemName  = "";
        string itemPrice = "";

        if (dt.Rows.Count > 0)
        {
            max  = Math.Ceiling(Double.Parse(dt.Rows[0]["ItemPrice"].ToString())).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();
    }
Exemplo n.º 2
0
    protected void PopulateControls()
    {
        DataTable dt = ItemAccess.GetItemPriceTopList(today, userId);

        PriceTop.DataSource = dt;
        PriceTop.DataBind();

        this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate");
    }