Exemplo n.º 1
0
    protected void PopulateControls()
    {
        double    priceMax = 0;
        DataTable dt       = ItemAccess.GetItemDateTopList(today, userId, "list", out priceMax);

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

        this.hidChartData.Value = ItemHelper.GetChartData(dt, "ItemBuyDate");
    }
Exemplo n.º 2
0
    protected void PopulateControls()
    {
        string    today    = Session["TodayDate"].ToString();
        int       userId   = Int32.Parse(Session["UserID"].ToString());
        string    orderBy  = Request.QueryString["orderBy"] ?? "chart";
        double    priceMax = 0;
        DataTable dt       = ItemAccess.GetItemDateTopList(today, userId, orderBy, out priceMax);

        string max         = "1";
        string step        = "1";
        string itemBuyDate = "";
        string shouruPrice = "";
        string zhichuPrice = "";

        string tip = (orderBy == "list" ? "#x_label#" : DateTime.Parse(today).ToString("yyyy-MM-") + "#x_label#");

        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)
            {
                string dot    = (i < dt.Rows.Count - 1 ? "," : "");
                string date   = (orderBy == "list" ? DateTime.Parse(dr["ItemBuyDate"].ToString()).ToString("yyyy-MM-dd") : DateTime.Parse(dr["ItemBuyDate"].ToString()).ToString("dd"));
                int    rotate = (orderBy == "list" ? 90 : 0);
                itemBuyDate += "{\"text\":\"" + date + "\",\"rotate\":" + rotate + "}" + dot;
                shouruPrice += dr["ShouRuPrice"].ToString() + dot;
                zhichuPrice += dr["ZhiChuPrice"].ToString() + dot;
                i++;
            }
        }
        else
        {
            itemBuyDate = "{\"text\":\"0\"},{\"text\":\"1\"}";
        }

        Response.Write(GetChartJsonString(itemBuyDate, shouruPrice, zhichuPrice, max, step, tip));
        Response.End();
    }
Exemplo n.º 3
0
    protected void BindGrid()
    {
        if (Request.QueryString["date"] != null && Request.QueryString["date"] != "")
        {
            if (!ValidHelper.CheckDate(Request.QueryString["date"]))
            {
                Session["TodayDate"] = DateTime.Now.ToString("yyyy-MM-dd");
            }
            else
            {
                Session["TodayDate"] = Request.QueryString["date"];
            }
        }

        string today  = Session["TodayDate"].ToString();
        int    userId = Int32.Parse(Session["UserID"].ToString());

        //图表点击事件
        double    priceMax = 0;
        DataTable dd       = ItemAccess.GetItemDateTopList(today, userId, "chart", out priceMax);

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

        #region 每日消费代码
        double    shouruPrice      = 0;
        double    zhichuPrice      = 0;
        double    shouruPriceMonth = 0;
        double    zhichuPriceMonth = 0;
        double    shouruPriceYear  = 0;
        double    zhichuPriceYear  = 0;
        DataTable total            = ItemAccess.GetItemListShouZhi(today, userId, out shouruPrice, out zhichuPrice, out shouruPriceMonth, out zhichuPriceMonth, out shouruPriceYear, out zhichuPriceYear);
        this.Label2.Text  = shouruPrice.ToString("0.0##");
        this.Label4.Text  = zhichuPrice.ToString("0.0##");
        this.Label1.Text  = shouruPriceMonth.ToString("0.0##");
        this.Label3.Text  = zhichuPriceMonth.ToString("0.0##");
        this.Label11.Text = shouruPriceYear.ToString("0.0##");
        this.Label12.Text = zhichuPriceYear.ToString("0.0##");

        double    jiechuPrice  = 0;
        double    huanruPrice  = 0;
        double    jieruPrice   = 0;
        double    huanchuPrice = 0;
        DataTable jiehuan      = ItemAccess.GetItemListJieHuanYear(today, userId, out jiechuPrice, out huanruPrice, out jieruPrice, out huanchuPrice);
        this.Label5.Text = jiechuPrice.ToString("0.##");
        this.Label6.Text = huanruPrice.ToString("0.##");
        this.Label7.Text = jieruPrice.ToString("0.##");
        this.Label8.Text = huanchuPrice.ToString("0.##");

        this.Label9.Text  = (jiechuPrice - huanruPrice).ToString("0.##");
        this.Label10.Text = (jieruPrice - huanchuPrice).ToString("0.##");
        #endregion

        //首页功能链接
        string userFunction = "";
        if (Session["UserFunction"] != null)
        {
            userFunction = Session["UserFunction"].ToString();
        }
        this.Label13.Text = UserAccess.GetUserFunctionText(userFunction);

        //钱包列表
        this.CardList.DataSource     = CardAccess.GetCardList(userId);
        this.CardList.DataTextField  = "CardName";
        this.CardList.DataValueField = "CardID";
        this.CardList.DataBind();
        if (Request.Cookies["CardID"] != null)
        {
            string cardId = Request.Cookies["CardID"].Value;
            this.CardList.SelectedValue = cardId;
        }
        CardList_SelectionChanged(this.CardList, null);
    }