Example #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);
        }
Example #2
0
        private DateTime myDueDate;                                   //the item’s due date

        public Loan(Library_Item li, DateTime bdate, DateTime rdate)
        {
            //set the construct
            myItem         = li;
            myDateBorrowed = bdate;
            myDueDate      = rdate;
        }
Example #3
0
        //method to find the library item from the list of borrowed items
        public Loan findBorrowedItem(Library_Item li)
        {
            Loan aitem = null;

            foreach (Loan theitem in myItems)
            {
                if (theitem.Item.Equals(li))
                {
                    aitem = theitem;
                }
            }
            return(aitem);
        }
Example #4
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);
        }
Example #5
0
        public Library_Item findItem(int callnum)
        {
            //find an item based on call number
            Library_Item anitem = null;

            //if two call number equals then it is the same one
            foreach (Library_Item theitem in myItems)
            {
                if (theitem.CallNum.Equals(callnum))
                {
                    anitem = theitem;
                }
            }
            return(anitem);
        }
Example #6
0
 public override void removeBorrowedItem(Library_Item bItem)
 {
     //method to remove borrowed item
     ItemsBorrowed.Remove(findBorrowedItem(bItem));
 }
Example #7
0
 //abstract method to remove borrowed item from the list
 public abstract void removeBorrowedItem(Library_Item bItem);
Example #8
0
        private static int nextID = 1000;    //variable used to generate unique ID

        //abstract method to check whether member is allowed to borrow library item
        public abstract bool CanBorrow(Library_Item li);