Esempio n. 1
0
    //初始数据
    private void PopulateControls()
    {
        decimal   priceMax = 0m;
        DataTable lists    = bll.GetFenLeiZongJiMingXiList(userId, today, catTypeId, out priceMax);

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

        this.hidChartData.Value = ItemHelper.GetChartData(lists, "PageUrl");
    }
    private void PopulateControls()
    {
        int      userId    = Convert.ToInt32(Session["UserID"]);
        DateTime today     = Convert.ToDateTime(Session["TodayDate"]);
        int      catTypeId = Convert.ToInt32(Request.QueryString["catTypeId"]);
        decimal  priceMax  = 0m;

        MonthBLL  bll = new MonthBLL();
        DataTable dt  = bll.GetFenLeiZongJiMingXiList(userId, today, catTypeId, 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(Convert.ToDouble(max) / 10).ToString();
            step2 = Math.Floor(Convert.ToDouble(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();
    }