def borrowBook(self, cloudDB, userName, bookID = -1): if bookID == -1: print('Please enter the ISBN number of the book you want to borrow:') bookID = TakeInput.inputInteger(1,cloudDB.getBookQuantity()) availabale = cloudDB.checkBookStatus(bookID) if availabale == False: print("Sorry, this book is current not availabale, please borrow another one..") else: borrowDate = datetime.now().strftime("%Y-%m-%d %H:%M:%S") returnDate = (datetime.now() + timedelta(days = 7)).strftime("%Y-%m-%d %H:%M:%S") userID = cloudDB.getUserID(userName) bookName = cloudDB.getBookName(bookID) eid = EventManager.insert(bookName,userName) print("") print('Book borrow detail') print("Borrow Date: "+borrowDate) print("Return Date: "+returnDate) print("Book detail:") cloudDB.printABookDetail(bookID) cloudDB.insertBookBorrowed(userID,bookID,borrowDate,eid) print("") print('Book Borrowed Successfull! Please return it within 7 days!') print("") return