Esempio n. 1
0
 def finish_transfer(self, username, amount):
     target_id = Bank_system().get_target_account_id(username)
     Bank_system().transfer_assets(self.account_id, target_id, amount)
     self.username_entry.delete(0, 'end')
     self.amount_entry.delete(0, 'end')
     self.transfer_window.geometry('480x160')
     self.error_label.config(fg='green',
                             text='The transfer was successfully made')
 def register_user(self):
     import time
     username = self.temp_username.get()
     password = self.temp_password.get()
     lower_bound = '180'
     self.register_screen.geometry('450x{}'.format(lower_bound))
     if ((" " in username) or (" " in password)):
         self.error_label.config(fg='red', text='Spaces are not allowed')
     elif (username == '' and password == ''):
         self.error_label.config(
             fg='red', text='Please enter a username and a password')
     elif (username == ''):
         self.error_label.config(fg='red', text='Please enter a username')
     elif (password == ''):
         self.error_label.config(fg='red', text='Please enter a password')
     elif (Bank_system().check_username(username)):
         self.error_label.config(fg='red', text='Username is already taken')
     elif (not (Bank_system().check_username(username))):
         Bank_system().add_user_to_db(username, password)
         self.remove_register_GUI()
         self.register_screen.update()
         time.sleep(1)
         self.close()
Esempio n. 3
0
 def check_user_input(self, username, amount):
     lower_bound = '180'
     horozontal_bound = '480'
     if ((" " in username) or (" " in amount)):
         print('Spaces are not allowed')
         self.transfer_window.geometry('{}x{}'.format(
             horozontal_bound, lower_bound))
         self.error_label.config(fg='red', text='Spaces are not allowed')
         return False
     elif (username == '' and amount == ''):
         self.transfer_window.geometry('{}x{}'.format(
             horozontal_bound, lower_bound))
         self.error_label.config(
             fg='red', text='Please enter a username and the amount')
         return False
     elif (username == ''):
         self.transfer_window.geometry('{}x{}'.format(
             horozontal_bound, lower_bound))
         self.error_label.config(fg='red', text='Please enter a username')
         return False
     elif (username == '' and amount == ''):
         self.transfer_window.geometry('{}x{}'.format(
             horozontal_bound, lower_bound))
         self.error_label.config(fg='red', text='Please enter the amount')
         return False
     elif (not (amount.isdecimal())):
         self.transfer_window.geometry('{}x{}'.format(
             horozontal_bound, lower_bound))
         self.error_label.config(
             fg='red', text='The ammount has to be given in numbers')
         return False
     elif (Bank_system().check_target_user(username)):
         return True
     else:
         self.transfer_window.geometry('{}x{}'.format(
             horozontal_bound, lower_bound))
         self.error_label.config(fg='red', text='The user does not exist')
         return False
Esempio n. 4
0
 def finish_withdraw(self, amount):
     Bank_system().withdraw(self.account_id, amount)
     self.withdraw_entry.delete(0, 'end')
     self.withdraw_window.geometry('420x150')
     self.hidden_label.config(fg='green',
                              text='The withdraw was successfull')
 def finish_deposit(self, amount):
     Bank_system().deposit(self.account_id, amount)
     self.deposit_entry.delete(0, 'end')
     self.deposit_window.geometry('400x150')
     self.hidden_label.config(fg='green',
                              text='The deposit was successfully made')
 def get_assets(self):
     print('assets window', self.account_id)
     return Bank_system().get_assets(self.account_id)
Esempio n. 7
0
 def finish_delete_account(self):
     username = self.temp_username.get()
     password = self.temp_password.get()
     if (self.check_user_input(username, password)):
         Bank_system().delete_account(self.account_id)
         self.user_window.destroy()