Пример #1
0
        //List borrowed by borrow Id
        public BorrowModel ListBorrowedByBID(int borrowId)
        {
            //empty list of media models to start us off
            List <BorrowModel> borrowedMedias = new List <BorrowModel>();

            MediaDS.TabBorrowDataTable borrowedTable = mediaDAO.ListBorrowed();

            foreach (MediaDS.TabBorrowRow row in borrowedTable.Rows)
            {
                if (row.BID == borrowId)
                {
                    BorrowModel media = BorrowModel.Parse(row);
                    borrowedMedias.Add(media);//add it to our list of media
                }
            }
            BorrowModel borrowed = null;

            if (borrowedMedias.Count == 0)
            {
                borrowedMedias = null;
            }
            else
            {
                borrowed = borrowedMedias[0];
            }
            return(borrowed);
        }
Пример #2
0
        //List Borrowed by actual return date
        public BorrowModel GetBorrowed(int mediaId)
        {
            List <BorrowModel> borrowedMedias = new List <BorrowModel>();

            MediaDS.TabBorrowDataTable borrowedTable = mediaDAO.ListBorrowed();

            foreach (MediaDS.TabBorrowRow row in borrowedTable.Rows)
            {
                if (row.MediaID == mediaId && row.ActualReturnDate < row.BorrowDate)
                {
                    BorrowModel borrowedMedia = BorrowModel.Parse(row);
                    borrowedMedias.Add(borrowedMedia);
                }
            }

            BorrowModel borrowed = null;

            if (borrowedMedias.Count == 0)
            {
                borrowedMedias = null;
            }
            else
            {
                borrowed = borrowedMedias[0];
            }
            return(borrowed);
        }
Пример #3
0
        public List <BorrowModel> ListBorrow()
        {
            List <BorrowModel> medias = new List <BorrowModel>();

            MediaDS.TabBorrowDataTable borrowTable = mediaDAO.ListBorrow();

            foreach (MediaDS.TabBorrowRow row in borrowTable.Rows)
            {
                BorrowModel media = BorrowModel.Parse(row);
                medias.Add(media);
            }

            return(medias);
        }
Пример #4
0
        //Borrowed medias <<<<<
        //Lista all borrowed medias
        public List <BorrowModel> ListAllMediasBorrowed()
        {
            //empty list of media models to start us off
            List <BorrowModel> borrowedMedias = new List <BorrowModel>();

            MediaDS.TabBorrowDataTable borrowedTable = mediaDAO.ListBorrowed();

            foreach (MediaDS.TabBorrowRow row in borrowedTable.Rows)
            {
                //create a model representing that row
                BorrowModel media = BorrowModel.Parse(row);
                borrowedMedias.Add(media);//add it to our list of media
            }
            return(borrowedMedias);
        }
Пример #5
0
        //List borrowed by media Id
        public List <BorrowModel> GetBorrowedByMediaId(int mediaId)
        {
            List <BorrowModel> borrowedMedias = new List <BorrowModel>();

            MediaDS.TabBorrowDataTable borrowedTable = mediaDAO.ListBorrowed();

            foreach (MediaDS.TabBorrowRow row in borrowedTable.Rows)
            {
                if (row.MediaID == mediaId)
                {
                    BorrowModel borrowedMedia = BorrowModel.Parse(row);
                    borrowedMedias.Add(borrowedMedia);
                }
            }

            if (borrowedMedias.Count == 0)
            {
                borrowedMedias = null;
            }
            return(borrowedMedias);
        }