Exemplo n.º 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));
            }
        }
Exemplo n.º 2
0
        public List <Trading> NewFeed(int page)
        {
            int numPage = tradingdao.getPages();

            page = page > numPage ? numPage : page;
            List <Trading> tradings = tradingdao.getLastedTrading(page);

            return(tradings);
        }
Exemplo n.º 3
0
        private void FillData(string filter, int userID)
        {
            TradingDAO tradingDAO = new TradingDAO();
            BookDAO    bookDAO    = new BookDAO();
            UserDAO    userDAO    = new UserDAO();

            if (filter == "Available")
            {
                tradings   = tradingDAO.GetAvailableLending(userID, page);
                totalPages = tradingDAO.getPages("AvailableLending", userID);
            }
            else if (filter == "Pending")
            {
                tradings   = tradingDAO.GetPendingLending(userID, page);
                totalPages = tradingDAO.getPages("PendingLending", userID);
            }
            else if (filter == "Lending")
            {
                tradings   = tradingDAO.GetLending(userID, page);
                totalPages = tradingDAO.getPages("Lending", userID);
            }
            else if (filter == "Completed")
            {
                tradings   = tradingDAO.GetCompletedLending(userID, page);
                totalPages = tradingDAO.getPages("CompletedLending", userID);
            }

            foreach (Trading t in tradings)
            {
                books.Add(bookDAO.GetById(t.BookID));
                if (filter != "Available")
                {
                    borrowers.Add(userDAO.GetById(t.BorrowerID));
                }
            }
        }