|
|
|
@ -2,11 +2,23 @@
|
|
|
|
|
import sqlite3
|
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
def deluser(a):
|
|
|
|
|
userIn = input("Which user would you like to delete? ")
|
|
|
|
|
connDb = sqlite3.connect(a)
|
|
|
|
|
cur = connDb.cursor()
|
|
|
|
|
cur.execute("""UPDATE account SET active = 0 where username = ?""", (userIn,))
|
|
|
|
|
connDb.commit()
|
|
|
|
|
connDb.close()
|
|
|
|
|
|
|
|
|
|
def listuser():
|
|
|
|
|
print("needs code")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def addUser(a):
|
|
|
|
|
connDb = sqlite3.connect(a)
|
|
|
|
|
cur = connDb.cursor()
|
|
|
|
|
userIn = input('What user would you like to add? ')
|
|
|
|
|
cur.execute("INSERT INTO account (username) VALUES(?)", (userIn,))
|
|
|
|
|
cur.execute("INSERT INTO account (username,active) VALUES(?,1)", (userIn,))
|
|
|
|
|
cur.execute("INSERT INTO balance (balance) VALUES(0.00)")
|
|
|
|
|
cur.execute("INSERT INTO banktrans (username) VALUES(?)", (userIn,))
|
|
|
|
|
connDb.commit()
|
|
|
|
@ -25,7 +37,7 @@ def manageBankmenu(a):
|
|
|
|
|
if menuOption == '1':
|
|
|
|
|
addUser(a)
|
|
|
|
|
elif menuOption == '2':
|
|
|
|
|
print('delete a user')
|
|
|
|
|
deluser(a)
|
|
|
|
|
elif menuOption == '3':
|
|
|
|
|
print('list users')
|
|
|
|
|
elif menuOption == '4':
|
|
|
|
@ -63,7 +75,7 @@ def addBank():
|
|
|
|
|
connDb.execute('''CREATE TABLE account
|
|
|
|
|
(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
|
USERNAME TEXT NOT NULL,
|
|
|
|
|
TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP);''')
|
|
|
|
|
TIMESTAMP DATETIME DEFAULT CURRENT_TIMESTAMP, ACTIVE BOOLEAN NOT NULL);''')
|
|
|
|
|
connDb.execute('''CREATE TABLE balance
|
|
|
|
|
(ID INTEGER PRIMARY KEY AUTOINCREMENT,
|
|
|
|
|
BALANCE REAL NOT NULL,
|
|
|
|
|