Example #1
0
        private void FillData(string filter, int userID)
        {
            TradingDAO tradingDAO = new TradingDAO();
            BookDAO    bookDAO    = new BookDAO();
            UserDAO    userDAO    = new UserDAO();

            if (filter == "Pending")
            {
                tradings   = tradingDAO.GetPendingBorrowing(userID, page);
                totalPages = tradingDAO.getPages("PendingBR", userID);
            }
            else if (filter == "Borrowing")
            {
                tradings   = tradingDAO.GetBorrowing(userID, page);
                totalPages = tradingDAO.getPages("Borrowing", userID);
            }
            else if (filter == "Completed")
            {
                tradings   = tradingDAO.GetCompletedBorrow(userID, page);
                totalPages = tradingDAO.getPages("Borrowing", userID);
            }

            foreach (Trading t in tradings)
            {
                books.Add(bookDAO.GetById(t.BookID));
                users.Add(userDAO.GetById(t.LenderID));
            }
        }