コード例 #1
0
    protected void PopulateControls()
    {
        double    priceMax = 0;
        DataTable dt       = ItemAccess.GetFenLeiZongJiMingXiList(catTypeId, today, userId, out priceMax);

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

        this.hidChartData.Value = ItemHelper.GetChartData(dt, "PageUrl");
    }
コード例 #2
0
    protected void PopulateControls()
    {
        int       catTypeId = Int32.Parse(Request.QueryString["catTypeId"]);
        string    today     = Session["TodayDate"].ToString();
        int       userId    = Int32.Parse(Session["UserID"].ToString());
        double    priceMax  = 0;
        DataTable dt        = ItemAccess.GetFenLeiZongJiMingXiList(catTypeId, today, userId, out priceMax);

        string max       = "1";
        string max2      = "1";
        string step      = "1";
        string step2     = "1";
        string itemName  = "";
        string itemPrice = "";
        string countNum  = "";

        if (dt.Rows.Count > 0)
        {
            max   = Math.Ceiling(priceMax).ToString();
            max2  = dt.Rows[0]["CountNum"].ToString();
            step  = Math.Floor(Double.Parse(max) / 10).ToString();
            step2 = Math.Floor(Double.Parse(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;
                itemPrice += dr["ItemPrice"].ToString() + dot;
                countNum  += dr["CountNum"].ToString() + dot;
                i++;
            }
        }

        Response.Write(GetChartJsonString(itemName, itemPrice, countNum, max, step, max2, step2));
        Response.End();
    }