예제 #1
0
 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()
예제 #2
0
 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()
예제 #3
0
 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()
예제 #4
0
 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()
예제 #5
0
 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()
예제 #6
0
 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()
예제 #7
0
 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()
예제 #8
0
 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()