Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["page"] != "" && Request.QueryString["page"] != null)
        {
            string itemName     = Request.QueryString["itemName"] ?? "";
            string itemType     = Request.QueryString["itemType"] ?? "";
            int    pageNumber   = Int32.Parse(Request.QueryString["page"]);
            int    userId       = Int32.Parse(Session["UserID"].ToString());
            double priceMax     = 0;
            int    howManyItems = 0;

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

            DataTable dt = ItemAccess.GetJiaGeFenXiMingXiList(itemName, itemType, userId, pageNumber, out howManyItems, out priceMax);
            if (dt.Rows.Count > 0)
            {
                foreach (DataRow dr in dt.Rows)
                {
                    items.Append("{");
                    items.Append("\"RowNumber\":" + "\"" + dr["RowNumber"].ToString() + "\",");
                    items.Append("\"ItemName\":" + "\"" + dr["ItemName"].ToString() + "\",");
                    items.Append("\"ItemBuyDate\":" + "\"" + DateTime.Parse(dr["ItemBuyDate"].ToString()).ToString("yyyy-MM-dd") + "\",");
                    items.Append("\"ItemPrice\":" + "\"" + Double.Parse(dr["ItemPrice"].ToString()).ToString("0.0##") + "\"");
                    items.Append("},");
                }
                items.Remove(items.ToString().LastIndexOf(','), 1);
            }

            items.Append("]");

            Response.Write(items.ToString());
            Response.End();
        }
    }
Exemplo n.º 2
0
    protected void PopulateControls()
    {
        int       pageNumber = 1;
        double    priceMax   = 0;
        DataTable dt         = ItemAccess.GetJiaGeFenXiMingXiList(itemName, itemType, userId, pageNumber, out howManyItems, out priceMax);

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

        this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate");
    }
Exemplo n.º 3
0
    protected void PopulateControls()
    {
        string    itemName     = Request.QueryString["itemName"] ?? "";
        string    itemType     = Request.QueryString["itemType"] ?? "";
        int       userId       = Int32.Parse(Session["UserID"].ToString());
        double    priceMax     = 0;
        int       pageNumber   = 1;
        int       howManyItems = 0;
        DataTable dt           = ItemAccess.GetJiaGeFenXiMingXiList(itemName, itemType, userId, pageNumber, out howManyItems, out priceMax);

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

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

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