示例#1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["page"] != "" && Request.QueryString["page"] != null)
        {
            int pageNumber   = Int32.Parse(Request.QueryString["page"]);
            int userId       = Int32.Parse(Session["UserID"].ToString());
            int notBuyMax    = 0;
            int howManyItems = 0;

            StringBuilder items = new StringBuilder();
            items.Append("[");

            DataTable dt = ItemAccess.GetJianGeFenXiList(userId, pageNumber, out howManyItems, out notBuyMax);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    items.Append("{");
                    items.Append("\"RowNumber\":" + "\"" + dr["RowNumber"].ToString() + "\",");
                    items.Append("\"ItemType\":" + "\"" + dr["ItemType"].ToString() + "\",");
                    items.Append("\"ItemName\":" + "\"" + dr["ItemName"].ToString() + "\",");
                    items.Append("\"ItemBuyDate\":" + "\"" + DateTime.Parse(dr["ItemBuyDate"].ToString()).ToString("yyyy-MM-dd") + "\",");
                    items.Append("\"ItemBuyDateMax\":" + "\"" + DateTime.Parse(dr["ItemBuyDateMax"].ToString()).ToString("yyyy-MM-dd") + "\",");
                    items.Append("\"NotBuy\":" + "\"" + dr["NotBuy"].ToString() + "\"");
                    items.Append("},");
                }
                items.Remove(items.ToString().LastIndexOf(','), 1);
            }

            items.Append("]");

            Response.Write(items.ToString());
            Response.End();
        }
    }
    protected void PopulateControls()
    {
        int       userId       = Int32.Parse(Session["UserID"].ToString());
        int       notBuyMax    = 0;
        int       pageNumber   = 1;
        int       howManyItems = 0;
        DataTable dt           = ItemAccess.GetJianGeFenXiList(userId, pageNumber, out howManyItems, out notBuyMax);

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

        if (dt.Rows.Count > 0)
        {
            max  = notBuyMax.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;
                notBuy   += dr["NotBuy"].ToString() + dot;
                i++;
            }
        }

        Response.Write(GetChartJsonString(itemName, notBuy, max, step));
        Response.End();
    }
示例#3
0
    protected void PopulateControls()
    {
        int       notBuyMax  = 0;
        int       pageNumber = 1;
        DataTable dt         = ItemAccess.GetJianGeFenXiList(userId, pageNumber, out howManyItems, out notBuyMax);

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

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