예제 #1
0
    private void PopulateControls()
    {
        int     pageNumber    = 1;
        int     pagePerNumber = Convert.ToInt32(WebConfiguration.PagePerNumber);
        decimal priceMax      = 0m;

        DataTable lists = bll.GetJiaGeFenXiList(userId, pageNumber, pagePerNumber, out howManyItems, out priceMax);

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

        this.hidChartData.Value = ItemHelper.GetChartData(lists, "PageUrl");
    }
예제 #2
0
    private void PopulateControls()
    {
        int     userId        = Convert.ToInt32(Session["UserID"]);
        int     pageNumber    = 1;
        int     pagePerNumber = Convert.ToInt32(WebConfiguration.PagePerNumber);
        int     howManyItems  = 0;
        decimal priceMax      = 0m;

        MonthBLL  bll = new MonthBLL();
        DataTable dt  = bll.GetJiaGeFenXiList(userId, pageNumber, pagePerNumber, out howManyItems, out priceMax);

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

        if (dt.Rows.Count > 0)
        {
            max  = Math.Floor(priceMax).ToString();
            step = Math.Floor(Convert.ToDouble(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;
                itemPrice += dr["ItemPrice"].ToString() + dot;
                i++;
            }
        }

        Response.Write(GetChartJsonString(itemName, itemPrice, max, step));
        Response.End();
    }
예제 #3
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (Request.QueryString["page"] != "" && Request.QueryString["page"] != null)
        {
            int     userId        = Convert.ToInt32(Session["UserID"]);
            int     pageNumber    = Convert.ToInt32(Request.QueryString["page"]);
            int     pagePerNumber = Convert.ToInt32(WebConfiguration.PagePerNumber);
            int     howManyItems  = 0;
            decimal priceMax      = 0m;

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

            MonthBLL  bll = new MonthBLL();
            DataTable dt  = bll.GetJiaGeFenXiList(userId, pageNumber, pagePerNumber, 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("\"ItemType\":" + "\"" + dr["ItemType"].ToString() + "\",");
                    items.Append("\"ItemTypeName\":" + "\"" + dr["ItemTypeName"].ToString() + "\",");
                    items.Append("\"ItemName\":" + "\"" + dr["ItemName"].ToString() + "\",");
                    items.Append("\"ItemBuyDate\":" + "\"" + Convert.ToDateTime(dr["ItemBuyDate"]).ToString("yyyy-MM-dd") + "\",");
                    items.Append("\"ItemPrice\":" + "\"" + Convert.ToDouble(dr["ItemPrice"]).ToString("0.0##") + "\"");
                    items.Append("},");
                }
                items.Remove(items.ToString().LastIndexOf(','), 1);
            }

            items.Append("]");

            Response.Write(items.ToString());
            Response.End();
        }
    }