Exemple #1
0
    def book_return(self, book_barcode):
        book = Book()
        book.number = book_barcode
        bookdboperation = getAdapter(book, IDbOperation)
        book = bookdboperation.get()[0]

        circulation = Circulation()
        circulation.book = book
        circulationdboperation = getAdapter(circulation, IDbOperation)
        circulationdboperation.delete()
 def on_add_clicked(self, *args):
     barcode = self.barcode.get_text()
     author = self.author.get_text()
     title = self.title.get_text()
     book = Book()
     book.barcode = barcode
     book.author = author
     book.title = title
     self.add(book)
     self.list_store.append((book, barcode, author, title))
    def book_return(self, book_barcode):
        book = Book()
        book.number = book_barcode
        bookdboperation = getAdapter(book, IDbOperation)
        book = bookdboperation.get()[0]

        circulation = Circulation()
        circulation.book = book
        circulationdboperation = getAdapter(circulation, IDbOperation)
        circulationdboperation.delete()
Exemple #4
0
    def book_issue(self, member_number, book_barcode):
        member = Member()
        member.number = member_number
        memberdboperation = getAdapter(member, IDbOperation)
        member = memberdboperation.get()[0]

        book = Book()
        book.number = book_barcode
        bookdboperation = getAdapter(book, IDbOperation)
        book = bookdboperation.get()[0]

        circulation = Circulation()
        circulation.member = member
        circulation.book = book
        circulationdboperation = getAdapter(circulation, IDbOperation)
        circulationdboperation.add()
    def book_issue(self, member_number, book_barcode):
        member = Member()
        member.number = member_number
        memberdboperation = getAdapter(member, IDbOperation)
        member = memberdboperation.get()[0]

        book = Book()
        book.number = book_barcode
        bookdboperation = getAdapter(book, IDbOperation)
        book = bookdboperation.get()[0]

        circulation = Circulation()
        circulation.member = member
        circulation.book = book
        circulationdboperation = getAdapter(circulation, IDbOperation)
        circulationdboperation.add()
 def populate_list_store(self):
     self.list_store.clear()
     book = Book()
     bookdboperation = getAdapter(book, IDbOperation)
     books = bookdboperation.get()
     for book in books:
         barcode = book.barcode
         author = book.author
         title = book.title
         self.list_store.append((book, barcode, author, title))
Exemple #7
0
 def get(self):
     db = getUtility(IRelationalDatabase)
     cr = db.cursor()
     barcode = self.book.barcode
     if barcode:
         cr.execute("""SELECT
                         id,
                         barcode,
                         author,
                         title
                       FROM books
                       WHERE barcode = ?""",
                    (barcode,))
     else:
         cr.execute("""SELECT
                         id,
                         barcode,
                         author,
                         title
                       FROM books""")
     rst = cr.fetchall()
     cr.close()
     books = []
     for record in rst:
         id = record['id']
         barcode = record['barcode']
         author = record['author']
         title = record['title']
         book = Book()
         book.id = id
         book.barcode = barcode
         book.author = author
         book.title = title
         books.append(book)
     return books