コード例 #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        IDAL.IUsers iu = BllFactory.BllAccess.CreateIUsersBLL();

        if (!IsPostBack)
        {
            int    pageIndex   = 1;
            int    recordCount = 0;
            int    userId      = Convert.ToInt32(HttpContext.Current.User.Identity.Name);
            string url         = Request.Url.AbsolutePath + "?page=";

            if (Request.QueryString["page"] != null)
            {
                pageIndex = Convert.ToInt32(Request.QueryString["page"]);
            }
            repHaveProp.DataSource = iu.getUserHaveProp(userId, pageIndex, 6, out recordCount);
            repHaveProp.DataBind();


            List <Model.UsersInfo> list = iu.getBookMoney(userId);

            int pageNumber = (int)Math.Ceiling((double)recordCount / 6);

            if (recordCount == 0)
            {
                lblUserProp.Text  = "&nbsp&nbsp&nbsp&nbsp您目前没有任何道具!" + "书币剩余:" + Convert.ToInt32(list[0].BookMoney) + "&nbsp;&nbsp;&nbsp;&nbsp;";
                LastPage.Visible  = false;
                NewxtPage.Visible = false;
            }
            else
            {
                lblUserProp.Text = "&nbsp&nbsp&nbsp&nbsp您共有" + recordCount + "种道具,书币剩余:" + Convert.ToInt32(list[0].BookMoney) + "&nbsp;&nbsp;&nbsp;&nbsp;当前第 " + pageIndex + "/" + pageNumber + " 页";
            }

            FirstPage.NavigateUrl = url + 1;
            NewxtPage.NavigateUrl = url + (pageIndex + 1);
            PrvPage.NavigateUrl   = url + (pageIndex - 1);
            LastPage.NavigateUrl  = url + pageNumber;

            if (pageIndex == 1)
            {
                FirstPage.Visible = false;
                PrvPage.Visible   = false;
            }

            if (pageIndex == pageNumber)
            {
                NewxtPage.Visible = false;
                LastPage.Visible  = false;
            }
        }
    }
コード例 #2
0
ファイル: ShopCart.aspx.cs プロジェクト: daonidedie/-
    protected void Page_Load(object sender, EventArgs e)
    {
        string userID = string.Empty;

        if (Request.QueryString["UID"] == null)
        {
            Response.Redirect("err.aspx?err=1");
        }


        if (Request.QueryString["UID"] != null)
        {
            if (HttpContext.Current.User.Identity.Name != "")
            {
                userID = HttpContext.Current.User.Identity.Name;
                List <Model.UsersInfo> list = iu.getBookMoney(Convert.ToInt32(HttpContext.Current.User.Identity.Name));
                repallmoney.DataSource = list;
                repallmoney.DataBind();
            }

            if (Request.QueryString["UID"].ToString() != userID)
            {
                Response.Redirect("err.aspx?err=2");
            }
        }



        if (!IsPostBack)
        {
            int recordCount = 0;
            repshopcart.DataSource = iu.getUserShopCart(BLL.ShopCartAccess.getCartID, 1, 6, out recordCount);
            repshopcart.DataBind();

            if (recordCount == 0)
            {
                this.form1.Visible = false;
                this.FindControl("noprop").Visible = true;
            }



            Label lballprice = (Label)this.FindControl("lballprice");
            lballprice.Text = "需支付书币:" + allprice.ToString() + "&nbsp;&nbsp;&nbsp;&nbsp;";
        }
    }