コード例 #1
0
        public override bool CanBorrow(Library_Item li)
        {
            //method to check whether faculty member can borrow library item
            bool borrow = false;

            //library item could be book or journal, need to get type of a certain item.
            if (li.GetType() == typeof(Book))
            {
                // staff can only borrow up to four books and the item must available.
                if (BooksCount <= FacBookMax && li.isAvailable())
                {
                    borrow = true;
                }
            }

            if (li.GetType() == typeof(Journal))
            {
                //staff can only borrow up to two journals and the journal must available.
                if (JournalsCount <= FacJournalMax && li.isAvailable())
                {
                    borrow = true;
                }
            }

            return(borrow);
        }
コード例 #2
0
        public override bool CanBorrow(Library_Item li)
        {
            //method to check whether student can borrow library item
            bool borrow = false;

            if (li.GetType() == typeof(Book))
            {
                //student can only borrow up to two book and it must be available
                if (BookCount <= StudentBookMax && li.isAvailable())
                {
                    borrow = true;
                }
            }
            return(borrow);
        }