protected void PopulateControls()
    {
        string    today    = Session["TodayDate"].ToString();
        int       userId   = Int32.Parse(Session["UserID"].ToString());
        double    priceMax = 0;
        DataTable dt       = ItemAccess.GetBiJiaoFenXiList(today, userId, "chart", out priceMax);

        string max           = "1";
        string step          = "1";
        string catTypeName   = "";
        string itemPriceCur  = "";
        string itemPricePrev = "";

        if (dt.Rows.Count > 0)
        {
            max  = (priceMax > 0 ? Math.Floor(priceMax).ToString() : "1");
            step = Math.Floor(Double.Parse(max) / 10).ToString();

            int i = 0;
            foreach (DataRow dr in dt.Rows)
            {
                string dot = (i < dt.Rows.Count - 1 ? "," : "");
                catTypeName   += "{\"text\":\"" + dr["CategoryTypeName"].ToString() + "\",\"rotate\":0}" + dot;
                itemPriceCur  += dr["ItemPriceCur"].ToString() + dot;
                itemPricePrev += dr["ItemPricePrev"].ToString() + dot;
                i++;
            }
        }

        Response.Write(GetChartJsonString(catTypeName, itemPriceCur, itemPricePrev, max, step));
        Response.End();
    }
Esempio n. 2
0
    protected void PopulateControls()
    {
        double    priceMax = 0;
        DataTable dt       = ItemAccess.GetBiJiaoFenXiList(today, userId, "", out priceMax);

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

        double totalCur  = 0;
        double totalPrev = 0;

        foreach (DataRow dr in dt.Rows)
        {
            totalCur  += Double.Parse(dr["ItemPriceCur"].ToString());
            totalPrev += Double.Parse(dr["ItemPricePrev"].ToString());
        }

        this.Label2.Text = totalCur.ToString("0.0##");
        this.Label3.Text = totalPrev.ToString("0.0##");

        DataTable dd = ItemAccess.GetBiJiaoFenXiList(today, userId, "chart", out priceMax);

        this.hidChartData.Value = ItemHelper.GetChartData(dd, "PageUrl");
    }