Пример #1
0
    def returnBorrowBook(self):
        printLine('Podaj tytuł publikacji którą chcesz zwrócić: ')
        self.printBorrowBook()
        title = input('Podaj tytuł: ')

        try:
            self.libraryUser.checkIfTheBookIsBorrowByTitle(title)
            self.libraryUser.returnBook(title)
        except PublicationNoBorrow as p:
            printLine(p.args)
Пример #2
0
 def getOption(self):
     optionOk = True
     option: Option
     while optionOk:
         try:
             option = Option.getOptionById(self.dataReader.getValueNumber())
             optionOk = False
         except ValueError:
             printLine(
                 "Wprowadzono wartość, która nie jest liczbą, podaj ponownie:"
             )
         except UnboundLocalError:
             print('Brak opcji o takim id')
     return option
Пример #3
0
    def borrowPublication(self):
        try:
            title = self.__chooseBookToBorrow()
            self.library.findPublicationByTitle(title)
            self.libraryUser.findBorrowPublicationByTitle(title)

            idUser = self.__chooseTheUserWhoBorrow()
            user = self.libraryUser.findUserById(idUser)
            idBH = Generator.generateID(self.libraryUser.getBorrowHistory())
            borrowPublication = BorrowHistory(idBH, user.getPesel(), title)
            self.libraryUser.borrowBook(borrowPublication)

        except PublicationNoExistsException as p:
            printLine(p.args)
        except PublicationIsBorrow as b:
            printLine(b.args)
        except UserNoExistsException as u:
            printLine(u.args)
Пример #4
0
 def addBook(self):
     try:
         book = self.dataReader.reandAdCreateBook()
         self.library.addPublication(book)
     except PublicationAlreadyExistsException as p:
         printLine(p.args)
Пример #5
0
 def exit(self):
     printLine("Koniec programu żegnam")
Пример #6
0
 def printOptions(self):
     printLine("Wybierz opcje: ")
     for option in Option:
         printLine(Option.toString(option.value))
Пример #7
0
 def __chooseTheUserWhoBorrow(self):
     printLine('Podaj id osoby która wypożycza książke: ')
     self.printUser()
     idUser = int(input('Podaj id: '))
     return idUser
Пример #8
0
 def __chooseBookToBorrow(self):
     printLine('Podaj tytuł książki którą chcesz wypozyczyć: ')
     self.printMagazine()
     self.printBook()
     title = input('Tytuł')
     return title
Пример #9
0
 def addUser(self):
     try:
         user = self.dataReader.readAndCreatUser()
         self.libraryUser.addUser(user)
     except UserAlreadyExistsException as u:
         printLine(u.args)
Пример #10
0
 def getTitlePublication(self):
     printLine("Podaj tytuł publikacji która chcesz usunać")
     self.printBook()
     self.printMagazine()
     title_publication = input("Tytuł publikacji")
     return title_publication
Пример #11
0
 def addMagazine(self):
     try:
         magazine = self.dataReader.readAndCreateMagazine()
         self.library.addPublication(magazine)
     except PublicationAlreadyExistsException as p:
         printLine(p.args)