示例#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 CostumerDeletion(firstname,lastname):
    for Costumer in CostumerList:
            if(Costumer.Firstname()==firstname and Costumer.Lastname()==lastname):
                shutil.rmtree("Costumers/"+firstname+" "+lastname)
                CostumerList.remove(Costumer)
                savecostumerDB()
示例#4
0
def btest():
    for Costumer in CostumerList:
        if (Costumer.Firstname()=="larry" and Costumer.Lastname()=="hogard"):
                print(Costumer.toString())
                ChangeBalance(Costumer)
示例#5
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()