def vp_start_gui(): '''Starting point when module is the main routine.''' global val, w, root root = Tk() top = Login (root) LoginSupport.init(root, top) root.mainloop()
def create_Login(root, *args, **kwargs): '''Starting point when module is imported by another program.''' global w, w_win, rt rt = root w = Toplevel (root) top = Login (w) LoginSupport.init(w, top, *args, **kwargs) return (w, top)
def vp_start_gui(Accountid): '''Starting point when module is the main routine.''' global accountid accountid = Accountid global val, w, root root = Tk() top = UpdateInfo (root) LoginSupport.init(root, top) root.mainloop()
def create_UpdateInfo(AccountID): '''Starting point when module is imported by another program.''' global accountID accountID = AccountID global val, w, root root = Tk() top = UpdateInfo(root) LoginSupport.init(root, top) root.mainloop()
def vp_start_gui(Accountnum, accountid): '''Starting point when module is the main routine.''' global accountnum, accountID accountID = accountid accountnum = Accountnum global val, w, root root = Tk() top = Account (root) LoginSupport.init(root, top) root.mainloop()
def vp_start_gui(Accountid): '''Starting point when module is the main routine.''' global accountid accountid = Accountid global val, w, root root = Tk() LoginSupport.set_Tk_var() top = Request_a_loan (root) LoginSupport.init(root, top) root.mainloop()
def LogSubmitFun(self): #gets the account id and password accountID = self.LogAccountBox.get() pWord = self.LogPassBox.get() if (len(accountID)>0 and len(pWord) > 0): try: accountID = int(accountID) except: messagebox.showerror("Error", "Account ID must be an Integer") return cusid = 0 sql="SELECT customerid FROM customers" cursor.execute(sql) for(custids) in cursor: custids = str(custids) custids = custids.translate(table) custids = int(custids) if(custids == accountID): cusid = 1 if (cusid == 0): messagebox.showerror("Error", "That is not a account holder at our bank") return getpass = "******" %\ (accountID, pWord) cursor.execute(getpass) passcorrect = 0 for (custids) in cursor: passcorrect = passcorrect+1 if(passcorrect ==1): # load mainpage messagebox.showinfo("It Worked", "You successfully signed in") LoginSupport.destroy_window() LandingPage.vp_start_gui(accountID) else: messagebox.showerror("Error", "The password is incorrect") return else: messagebox.showerror("Error", "Both password and accountID are required fields")
def Submit(self): name = self.SeNameBox.get() address = self.SeAddressBox.get() city = self.SeCityBox.get() state = self.SeStateBox.get() zip = self.SeZipBox.get() country = self.SeCountryBox.get() phone = self.SePhoneBox.get() password = self.SePassBox.get() passwordConf = self.SePassConfBox.get() email = self.SeemailBox.get() if (len(name) == 0 or len(address) == 0 or len(city) == 0 or len(state) == 0 \ or len(zip) == 0 or len(country) == 0 or len(phone) == 0 or len(password) == 0 \ or len(passwordConf) == 0): messagebox.showinfo("Error", "No field can be left empty.") return elif (password != passwordConf): messagebox.showerror("Error", "The passwords do not match.") return # get highest customer id from database and increment it by one. #assign them the new id and submit into sql the customer information with the new id. #print message telling them what their id is sql = "SELECT MAX(customerid) FROM customers" highestid = 0 cursor.execute(sql) for (custids) in cursor: custids = str(custids) custids = custids.translate(table) custids = int(custids) highestid = custids + 1 sql = "INSERT INTO `customers` VALUES (%d,'%s','%s','%s','%s','%s','%s','%s','%s','%s')" % \ (highestid, name, password, address, city, state, zip, country, phone, email) print(sql) highestid = str(highestid) try: cursor.execute(sql) messagebox.showinfo("Congrats!", "Your account number is " + highestid) db.commit() db.close() LoginSupport.destroy_window() Main.vp_start_gui() except: messagebox.showerror("Error", "There was an error. Account not created.")
def recover(self): name = self.Namebox.get() email = self.Emailbox.get() sql = "SELECT customerid, password FROM customers WHERE customername = '%s' AND email = '%s'"%\ (name, email) returninfo = 0 cursor.execute(sql) for (id, password) in cursor: returninfo = 1 name = str(id) email = password if (returninfo == 1): messagebox.showinfo( "Account info", "Your Account ID is: %s\nYour Password is: %s" % (name, email)) LoginSupport.destroy_window() Main.vp_start_gui() else: messagebox.showinfo("Account info", "The information provided is incorrect")
def Submit(self): name = self.SeNameBox.get() address = self.SeAddressBox.get() city = self.SeCityBox.get() state = self.SeStateBox.get() zip = self.SeZipBox.get() country = self.SeCountryBox.get() phone = self.SePhoneBox.get() password = self.SePassBox.get() passwordConf = self.SePassConfBox.get() email = self.SeemailBox.get() if (len(name) == 0 or len(address) == 0 or len(city) == 0 or len(state) == 0 \ or len(zip) == 0 or len(country) == 0 or len(phone) == 0 or len(password) == 0 \ or len(passwordConf) == 0): print("stuff") messagebox.showinfo("Error", "No field can be left empty.") elif(password != passwordConf): messagebox.showinfo("Error", "The passwords do not match.") else: # get highest customer id from database and increment it by one. #assign them the new id and submit into sql the customer information with the new id. #print message telling them what their id is sql="UPDATE customers SET customername = '%s', password = '******', address = " \ "'%s', city = '%s', state = '%s', zip = '%s', country = '%s', phone ='%s',email ='%s' WHERE customerid" \ "=%d"%\ (name, password, address, city, state, zip, country, phone,email,accountid ) try: cursor.execute(sql) db.commit() db.close() messagebox.showinfo("note", "information successfully updated") LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid) except: messagebox.showerror("Error", "information could not be updated")
def cancel(self): LoginSupport.destroy_window() Main.vp_start_gui()
def killApp(self): messagebox.showinfo("note", "You have successfully signed out") db.close() LoginSupport.destroy_window() Main.vp_start_gui()
def returntolanding(self): LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid)
def intoloan(self, account): LoginSupport.destroy_window() Loan.vp_start_gui(account, accountid)
def intoAccount(self, account): LoginSupport.destroy_window() Account.vp_start_gui(account, accountid)
def createCustomer(self): LoginSupport.destroy_window() NewCustomer.vp_start_gui()
def recover(self): LoginSupport.destroy_window() ForgotInfo.vp_start_gui()
def loan(self): LoginSupport.destroy_window() RequestLoan.vp_start_gui(accountid)
def creditCard(self, account): LoginSupport.destroy_window() CreditCard.vp_start_gui(account, accountid)
def NewAccount(self): LoginSupport.destroy_window() NewAccount.vp_start_gui(accountid)
def cancelbutton(self): LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid)
def submit(self): name = self.Entry1.get() if (self.var1.get() == 1): accountnum = 1 getaccountnum = "SELECT MAX(accountnumber) FROM accounts WHERE accountnumber <2000000;" cursor.execute(getaccountnum) for (number) in cursor: number = str(number) table = str.maketrans(dict.fromkeys('(' ',)')) number = number.translate(table) accountnum += int(number) sql = "INSERT INTO `accounts` VALUES (%d, '%s',%d,0,0)" % \ (accountid, name, accountnum) cursor.execute(sql) try: db.commit() messagebox.showinfo("Congrats", "Account created") db.close() LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid) except: messagebox.showerror("Error", "Account could not be created") elif (self.var1.get() == 2): accountnum = 1 getaccountnum = "SELECT MAX(accountnumber) FROM accounts WHERE accountnumber <3000000;" cursor.execute(getaccountnum) for (number) in cursor: number = str(number) table = str.maketrans(dict.fromkeys('(' ',)')) number = number.translate(table) accountnum += int(number) sql = "INSERT INTO `accounts` VALUES (%d, '%s',%d,0,0)" % \ (accountid, name, accountnum) cursor.execute(sql) try: db.commit() messagebox.showinfo("Congrats", "Account created") db.close() LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid) except: messagebox.showerror("Error", "Account could not be created") elif (self.var1.get() == 3): accountnum = 1 getaccountnum = "SELECT MAX(accountnumber) FROM accounts WHERE accountnumber <4000000;" cursor.execute(getaccountnum) for (number) in cursor: number = str(number) table = str.maketrans(dict.fromkeys('(' ',)')) number = number.translate(table) accountnum += int(number) sql = "INSERT INTO `accounts` VALUES (%d, '%s',%d,0,0)" % \ (accountid, name, accountnum) cursor.execute(sql) try: db.commit() messagebox.showinfo("Congrats", "Account created") db.close() LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid) except: messagebox.showerror("Error", "Account could not be created")
def Requestcc(self): LoginSupport.destroy_window() RequestCC.vp_start_gui(accountid)
def makepayment(self): LoginSupport.destroy_window() MakePayment.vp_start_gui(accountid)
def submit(self): name = self.Entry1.get() initial = self.Entry2.get() initial = getdouble(initial) if(self.var1.get() ==1): sql = "SELECT MAX(accountnumber) FROM loans WHERE customerid = %d"%\ (accountid) loannumber = 1 cursor.execute(sql) for (number )in cursor: number = str(number) table = str.maketrans(dict.fromkeys('(' ',)')) number = number.translate(table) try: loannumber += int(number) except: loannumber = 1; sql = "INSERT INTO `loans` VALUES (%d, %d,'%s',9.5, %d,%d,NOW())" % \ (accountid,loannumber,name,initial, initial) print(sql) cursor.execute(sql) db.commit() sql = "UPDATE loans SET paymentdue = DATE_ADD(paymentdue, INTERVAL 1 month ) WHERE acountnumber =%d" %\ (loannumber) db.commit() db.close LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid) if (self.var1.get() == 2): sql = "SELECT MAX(accountnumber) FROM loans WHERE customerid = %d" % \ (accountid) loannumber = 1 cursor.execute(sql) for (number) in cursor: number = str(number) table = str.maketrans(dict.fromkeys('(' ',)')) number = number.translate(table) try: loannumber += int(number) except: loannumber = 1; sql = "INSERT INTO `loans` VALUES (%d, %d,'%s',4.5, %d,%d,NOW())" % \ (accountid, loannumber, name, initial, initial) print(sql) cursor.execute(sql) db.commit() sql = "UPDATE loans SET paymentdue = DATE_ADD(paymentdue, INTERVAL 1 month ) WHERE acountnumber =%d" % \ (loannumber) db.commit() db.close LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid) if (self.var1.get() == 3): sql = "SELECT MAX(accountnumber) FROM loans WHERE customerid = %d" % \ (accountid) loannumber = 1 cursor.execute(sql) for (number) in cursor: number = str(number) table = str.maketrans(dict.fromkeys('(' ',)')) number = number.translate(table) try: loannumber += int(number) except: loannumber = 1; sql = "INSERT INTO `loans` VALUES (%d, %d,'%s',90, %d,%d,NOW())" % \ (accountid, loannumber, name, initial, initial) print(sql) cursor.execute(sql) db.commit() sql = "UPDATE loans SET paymentdue = DATE_ADD(paymentdue, INTERVAL 1 month ) WHERE acountnumber =%d" % \ (loannumber) db.commit() db.close LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid) if (self.var1.get() == 4): sql = "SELECT MAX(accountnumber) FROM loans WHERE customerid = %d" % \ (accountid) loannumber = 1 cursor.execute(sql) for (number) in cursor: number = str(number) table = str.maketrans(dict.fromkeys('(' ',)')) number = number.translate(table) try: loannumber += int(number) except: loannumber = 1; sql = "INSERT INTO `loans` VALUES (%d, %d,'%s',30, %d,%d,NOW())" % \ (accountid, loannumber, name, initial, initial) print(sql) cursor.execute(sql) db.commit() sql = "UPDATE loans SET paymentdue = DATE_ADD(paymentdue, INTERVAL 1 month ) WHERE acountnumber =%d" % \ (loannumber) db.commit() db.close LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid) if (self.var1.get() == 5): sql = "SELECT MAX(accountnumber) FROM loans WHERE customerid = %d" % \ (accountid) loannumber = 1 cursor.execute(sql) for (number) in cursor: number = str(number) table = str.maketrans(dict.fromkeys('(' ',)')) number = number.translate(table) try: loannumber += int(number) except: loannumber = 1; sql = "INSERT INTO `loans` VALUES (%d, %d,'%s',.04, %d,%d,NOW())" % \ (accountid, loannumber, name, initial, initial) print(sql) cursor.execute(sql) db.commit() sql = "UPDATE loans SET paymentdue = DATE_ADD(paymentdue, INTERVAL 1 month ) WHERE acountnumber =%d" % \ (loannumber) db.commit() db.close LoginSupport.destroy_window() LandingPage.vp_start_gui(accountid)
def UpdateSettings(self): LoginSupport.destroy_window() UpdateInfo.vp_start_gui(accountid)