def do_register(self): try: self.data_base = MyDb() username = self.ent4.get() password = self.ent5.get() name = self.ent1.get() address = self.ent3.get() phone = self.ent2.get() email = self.ent00.get() if username == " " or password == '' or name == '' or address == '' or phone == '' or email == '': messagebox.showerror("Error", "Enter everyboxes carefully 😒 ") else: qry = """INSERT INTO registers (username, password, name, address, phone, email) VALUES (%s,%s,%s,%s,%s,%s)""" values = (username, password, name, address, phone, email) self.data_base.iud(qry, values) messagebox.showinfo("Success", "Registered Successfully 😊 ") self.send_mail(email) except Exception as e: print(e)
def __init__(self): self.buy = BuyBooks() self.log_in() self.data_base = MyDb() self.ab = AddBooks() self.see = SeeBooks() self.fetch = FetchBill()
def dataa(self): self.db = MyDb() qry = '''select * from bill''' data = self.db.get_data(qry) self.add_tree.delete(*self.add_tree.get_children()) for i in data: self.add_tree.insert("", "end", text=i[0], value=(i[0], i[7], i[9], i[1], i[2], i[4], i[5], i[6], i[8]))
def bookid(self,book, price): self.db = MyDb() book = self.book_ent.get() price = self.pr_ent.get() print(book) print(price) qry = '''select id from booksdetail where name=%s and price=%s''' values = (book,price) get= self.db.get_data_i(qry, values) print(type(get)) bipin =int(get[0]) print(type(bipin)) return bipin
def select(self): self.db = MyDb() user_chosen = self.cat.get() if user_chosen == '': messagebox.showerror('Error', 'Select first') elif user_chosen == 'Book Name': keyword = self.search_ent.get() qry = "SELECT * FROM bill WHERE bookname LIKE '" + keyword + "%'" values = (keyword) result = self.db.get_data_p(qry, values) self.add_tree.delete(*self.add_tree.get_children()) for i in result: self.add_tree.insert("", "end", text=i[0], value=(i[0], i[7], i[9], i[1], i[2], i[4], i[5], i[6], i[8])) elif user_chosen == 'Date (yyyy-mm-dd)': keyword = self.search_ent.get() qry = "SELECT * FROM bill WHERE date LIKE '" + keyword + "%'" values = (keyword) result = self.db.get_data_p(qry, values) self.add_tree.delete(*self.add_tree.get_children()) for i in result: self.add_tree.insert("", "end", text=i[0], value=(i[0], i[7], i[9], i[1], i[2], i[4], i[5], i[6], i[8])) elif user_chosen == 'Bill by': keyword = self.search_ent.get() qry = "SELECT * FROM bill WHERE bill_by LIKE '" + keyword + "%'" values = (keyword) result = self.db.get_data_p(qry, values) self.add_tree.delete(*self.add_tree.get_children()) for i in result: self.add_tree.insert("", "end", text=i[0], value=(i[0], i[7], i[9], i[1], i[2], i[4], i[5], i[6], i[8]))
def searchbook(self): self.db = MyDb() searchbook = self.search_book.get() if searchbook == '': messagebox.showerror('Empty', 'Insert some keyword please!') else: qry = "SELECT * FROM booksdetail WHERE name LIKE '" + searchbook + "%'" values = (searchbook) result = self.db.get_data_p(qry, values) self.add_tree.delete(*self.add_tree.get_children()) for i in result: self.add_tree.insert("", "end", text=i[0], value=(i[1], i[2], i[3], i[4], i[5], i[6], i[7])) self.add_tree.bind("<Double-1>", self.select_item)
def do_login(self): self.data_base = MyDb() username1 = self.ent1.get() password1 = self.ent2.get() qry = """SELECT * FROM registers WHERE username = %s and password = %s""" values = (username1, password1) user = self.data_base.get_data_p(qry, values) print(len(user)) if username1 == " " or password1 == '': messagebox.showerror("Error", "Enter everyboxes carefully!") else: if len(user) == 1: messagebox.showinfo('Success', 'BOOM!! Login successful!') self.aft_log() self.data_base.get_name(username1, password1) else: print("Wrong id or password") messagebox.showinfo('Sorry', 'INCORRECT Password or id')
def databill(self,cus_name,cus_phone,bookid,price,discount, total,date,book,billby): self.db = MyDb() qry = "INSERT INTO bill (cus_name, cus_phone, book, price, discount, total,date,bookname,bill_by) VALUES (%s,%s,%s,%s,%s,%s,%s,%s,%s)" values = (cus_name,cus_phone,bookid,price,discount, total,date,book,billby) return self.db.iud(qry, values)
def __init__(self): super().__init__() self.see=SeeBooks() self.db=MyDb()
def __init__(self): self.db = MyDb() self.update_index = ""
def __init__(self): self.db = MyDb()
def __init__(self): self.db=MyDb() self.ab=AddBooks()