Exemplo n.º 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // set title for page
            Page.Title = "Borrowing - BookShare";
            User user = (User)Session["currentUser"];

            if (user == null)
            {
                Response.Redirect("Login.aspx");
            }

            listQuery.Add("Pending");
            listQuery.Add("Borrowing");
            listQuery.Add("Completed");

            filter = Request.QueryString["filter"] == null ? "Pending" : Request.QueryString["filter"];
            page   = Request.QueryString["page"] == null ? 1 : int.Parse(Request.QueryString["page"]);
            int id = Request.QueryString["id"] == null ? -1 : int.Parse(Request.QueryString["id"]);

            int point = Request.QueryString["point"] == null ? -1 : int.Parse(Request.QueryString["point"]);


            FillData(filter, user.Id);
            if (id != -1)
            {
                lenderID          = users[id].Id;
                myModal.Visible   = true;
                info.InnerHtml    = "Trading no: " + (id + 1) + "<br/>Lender: " + users[id].FullName + "<br/>";
                trading.InnerText = tradings[id].Id + "";
            }

            if (point != -1)
            {
                int        tradingID  = int.Parse(Request.QueryString["trading"]);
                TradingDAO tradingDAO = new TradingDAO();
                tradingDAO.UpdateLenderRatePoint(tradingID, point);
                Response.Redirect("Borrowing.aspx?filter=Completed");
            }
        }