Example #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // get total number of users
            UserDAO userDao = new UserDAO();

            UserNum = userDao.GetRowCount();

            // get total pending books
            BookDAO bookDao = new BookDAO();

            TotalPendings = bookDao.GetRowCountBookByStatus(Book.STATUS_PENDING);
            TotalAccepted = bookDao.GetRowCountBookByStatus(Book.STATUS_ACCEPTED);

            // get number of lastest avaible tradings
            TradingDAO tradingDao = new TradingDAO(5);

            N_LastestAvailableTradings = tradingDao.Get_N_BookNumByStatus(tradingNum, Trading.STATUS_AVAILABLE);

            // get list of Lastest Tradings
            LastestCompletedTradings = tradingDao.GetTradingByCommand("select top 5 * from Trading order by (completedTime) desc");
            foreach (Trading trading in LastestCompletedTradings)
            {
                Lenders.Add(userDao.GetById(trading.LenderID));
                Borrowers.Add(userDao.GetById(trading.BorrowerID));
                Books.Add(bookDao.GetById(trading.BookID));
            }

            // set status
        }