Ejemplo n.º 1
0
    protected void PopulateControls()
    {
        double    priceMax = 0;
        DataTable dt       = ItemAccess.GetItemNumDetailList(itemName, itemType, userId, Int32.Parse(catTypeId), today, "list", out priceMax);

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

        this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate");
    }
    protected void PopulateControls()
    {
        string title     = Request.QueryString["title"];
        string itemName  = Request.QueryString["itemName"] ?? "";
        string itemType  = Request.QueryString["itemType"] ?? "";
        string today     = Session["TodayDate"].ToString();
        string catTypeId = "0";

        if (Request.QueryString["catTypeId"] != null && Request.QueryString["catTypeId"] != "")
        {
            catTypeId = Request.QueryString["catTypeId"];
        }
        //比较分析明细进入使用
        if (Request.QueryString["date"] != null && Request.QueryString["date"] != "")
        {
            if (ValidHelper.CheckDate(Request.QueryString["date"]))
            {
                today = Request.QueryString["date"];
            }
        }
        int       userId   = Int32.Parse(Session["UserID"].ToString());
        double    priceMax = 0;
        DataTable dt       = ItemAccess.GetItemNumDetailList(itemName, itemType, userId, Int32.Parse(catTypeId), today, "list", out priceMax);

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

        if (dt.Rows.Count > 0)
        {
            max  = Math.Ceiling(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 ? "," : "");
                itemNameValue += "{\"text\":\"" + DateTime.Parse(dr["ItemBuyDate"].ToString()).ToString("yyyy-MM-dd") + "\",\"rotate\":90}" + dot;
                itemPrice     += dr["ItemPrice"].ToString() + dot;
                i++;
            }
        }
        else
        {
            itemNameValue = "{\"text\":\"0\"},{\"text\":\"1\"}";
        }

        Response.Write(GetChartJsonString(itemNameValue, itemPrice, title, max, step));
        Response.End();
    }