def addClient(self): #asks the user for data regarding the client and calls the add function from services clientId = input("Client ID: ") clientName = input("Client Name: ") self._validateinteger.validate_integer(clientId) self._srv.add_client(clientId, clientName, True) RedoManager.delete()
def updateClient(self): #updates a given client by its ID #asks the user for the id of the client he wants to modify and for the new data clientId = input("Client ID: ") self._validateinteger.validate_integer(clientId) clientName = input("New client Name: ") self._srv.update_client(clientId, clientName, True) RedoManager.delete()
def addBook(self): #asks the user for data regarding the book and calls the add function from services bookId = input("Book ID: ") bookTitle = input("Book Title: ") bookAuthor = input("Book Author: ") self._validateinteger.validate_integer(bookId) bookId = int(bookId) self._srv.add_book(bookId, bookTitle, bookAuthor, True) RedoManager.delete()
def updateBook(self): #updates a given book by its ID #asks the user for the id of the book he wants to modify and for the new data bookId = input("Book ID: ") self._validateinteger.validate_integer(bookId) bookTitle = input("New book Title: ") bookAuthor = input("New book Author: ") self._srv.update_book(bookId, bookTitle, bookAuthor, True) RedoManager.delete()
def rentBook(self): rentalId = input("Enter rental ID: ") bookId = input("Enter book ID: ") clientId = input("Enter client ID: ") self._validateinteger.validate_integer(bookId) self._validateinteger.validate_integer(clientId) self._validateinteger.validate_integer(rentalId) rentedDate = datetime.date.today() self._srv.add_rental(rentalId, bookId, clientId, rentedDate, None, True) RedoManager.delete()
def returnBook(self): rentalId = input("Enter rental ID: ") self._validateinteger.validate_integer(rentalId) print("Enter returned date... ") returned_day = input("Enter returned day: ") returned_month = input("Enter returned month: ") returned_year = input("Enter returned year: ") self._validateinteger.validate_integer(returned_day) self._validateinteger.validate_integer(returned_month) self._validateinteger.validate_integer(returned_year) self._validatedate.validate_date(int(returned_day), int(returned_month), int(returned_year)) self._srv.update_rental( int(rentalId), datetime.date(int(returned_year), int(returned_month), int(returned_day)), True) RedoManager.delete()
def removeBook(self): #asks the user for the id of the book he wants to delete and calls the remove function from services bookId = input("Book ID: ") self._validateinteger.validate_integer(bookId) self._srv.remove_book(bookId, True) RedoManager.delete()
def removeClient(self): #asks the user for the id of the client he wants to delete and calls the remove function from services clientId = input("Client ID: ") self._validateinteger.validate_integer(clientId) self._srv.remove_client(clientId, True) RedoManager.delete()