示例#1
0
def ChangeAccountBalance():
    firstname=input("Please enter the costumer's firstname.\n")
    firstname=firstname.lower()
    while(CheckValidName(firstname)==False):
        firstname=input("This name is not valid, please enter a valid name.\n(Or enter 0 to go back to the Employee menu.)\n")
        firstname=firstname.lower()
        if(firstname=="0"):
            print("")
            Employee_menu()
            return
    lastname=input("Please enter the costumer's lastname.\n")
    lastname=lastname.lower()
    while(CheckValidName(lastname)==False):
        lastname=input("This name is not valid, please enter a valid name.\n(Or enter 0 to go back to the Employee menu.)\n")
        lastname=lastname.lower()
        if(lastname=="0"):
            print("")
            Employee_menu()
            return
    if(path.exists("Costumers/"+firstname+" "+lastname)==False):
        print("This costumer is not registered. Going back to the Employee menu")
        print("")
        Employee_menu()
        return
    else:
        for Costumer in CostumerList:
            if(Costumer.Firstname()==firstname and Costumer.Lastname()==lastname):
                ChangeBalance(Costumer)
示例#2
0
def DeleteCostumerAccount():
    firstname=input("Please enter the costumer's firstname.\n")
    firstname=firstname.lower()
    while(CheckValidName(firstname)==False):
        firstname=input("This name is not valid, please enter a valid name.\n(Or enter 0 to go back to the Employee menu.)\n")
        firstname=firstname.lower()
        if(firstname=="0"):
            print("")
            Employee_menu()
            return
    lastname=input("Please enter the costumer's lastname.\n")
    lastname=lastname.lower()
    while(CheckValidName(lastname)==False):
        lastname=input("This name is not valid, please enter a valid name.\n(Or enter 0 to go back to the Employee menu.)\n")
        lastname=lastname.lower()
        if(lastname=="0"):
            print("")
            Employee_menu()
            return
    if(path.exists("Costumers/"+firstname+" "+lastname)==False):
        print("This costumer is not registered. Going back to the Employee menu")
        print("")
        Employee_menu()
        return
    else:
        for Costumer in CostumerList:
            if(Costumer.Firstname()==firstname and Costumer.Lastname()==lastname):
                if(Costumer.Savings().Balance()==0.00 and Costumer.Current().Balance()==0.00):
                    shutil.rmtree("Costumers/"+firstname+" "+lastname)
                    CostumerList.remove(Costumer)
                    savecostumerDB()
                    print("The costumer "+firstname+" "+lastname+" was successfully deleted.\nGoing back to the Employee menu")
                    print("")
                    Employee_menu()
                    return
                else:
                    print("Cannot delete that costumer, check their account balances.\nGoing back to the Employee menu")
                    print("")
                    Employee_menu()
                    return
示例#3
0
def Costumer_login():
    a=input("Please enter your first name.\n")
    a=a.lower()
    b=input("Please enter your last name.\n")
    b=b.lower()
    account_number=input("Please enter your account number \n" )
    pincode=input("Please enter your pincode \n")
    if(path.exists("Costumers/"+a+" "+b)==False):
        print('This account is not registered, going back to the main menu.\n')
        print("")
        main_menu()
        return
    else:
        if (account_number==Costumer.GenerateAccountNumber(a,b)) and (pincode==Costumer.GeneratePinCode(a,b)):
            for costumer in CostumerList:
                if(costumer.Firstname()==a and costumer.Lastname()==b):
                    Costumer_menu(costumer)
        else:
            print("Account number or pincode incorrect. Going back to the main menu.")
            print("")
            main_menu()
            return
示例#4
0
def CostumerCreation(firstname,lastname,email):
    os.mkdir("Costumers/"+firstname+" "+lastname)
    c=Costumer(firstname,lastname,email)
    CostumerList.append(c)
    savecostumerDB()
    details=open("Costumers/"+firstname+" "+lastname+"/"+firstname+" "+lastname+"-details.txt","w+")
    details.write(c.toString())
    details.close()
    savings=open("Costumers/"+firstname+" "+lastname+"/"+c.Accountnumber()+"-savings.txt","w+")
    savings.write(c.Savings().toString())
    savings.close()
    current=open("Costumers/"+firstname+" "+lastname+"/"+c.Accountnumber()+"-current.txt","w+")
    current.write(c.Current().toString())
    current.close()
    transactions=open("Costumers/"+firstname+" "+lastname+"/"+c.Accountnumber()+"-transactions.txt","w+")
    transactions.close()
示例#5
0
def CostumerDeletion(firstname,lastname):
    for Costumer in CostumerList:
            if(Costumer.Firstname()==firstname and Costumer.Lastname()==lastname):
                shutil.rmtree("Costumers/"+firstname+" "+lastname)
                CostumerList.remove(Costumer)
                savecostumerDB()
示例#6
0
def btest():
    for Costumer in CostumerList:
        if (Costumer.Firstname()=="larry" and Costumer.Lastname()=="hogard"):
                print(Costumer.toString())
                ChangeBalance(Costumer)
示例#7
0
def pickletest():
    for Costumer in CostumerList:
        print(Costumer.toString())
示例#8
0
def testcostumer():
    c1=Costumer("Hervé-Henri","Houzard","*****@*****.**")
    print(c1.toString())
示例#9
0
def GetCostumerList():
    for Costumer in CostumerList:
        print(Costumer.Firstname()+" "+Costumer.Lastname()+"  account number:"+Costumer.Accountnumber()+"  current:"
              + str(Costumer.Current().Balance())+ "  savings:"+str(Costumer.Savings().Balance()))
    print("")
    Employee_menu()
示例#10
0
def GetSavingAccountHistory():
    print("savings:"+str(Costumer.Savings().Balance()))
    print("")
    Costumer_menu()
示例#11
0
def GetCurrentAccountHistory():
    print("current:"+ str(Costumer.Current().Balance()))
    print("")
    Costumer_menu()
示例#12
0
from Costumer import Costumer
from BD import Base

joao = Costumer("Jp", "1234", 20)
bd = Base()
if (bd.show(joao) == ""):
    bd.insert(joao)
bd.show(joao)
joao = Costumer("Jp", "1234", 70)
bd.update(joao)
bd.show(joao)
bd.delete(joao)