示例#1
0
def main():
    database.make_all_tables()
    database.reset_withdrawals()
    choice = 1

    while choice != 0:

        print("--- Main Menu --- ")
        print("1. Sign Up (New Customer) ")
        print("2. Sign In (Existing Customer) ")
        print("3. Admin Sign In ")
        print("0. Quit ")

        try:
            choice = int(input())

        except:
            print("Invalid Choice")
            choice = 1
            continue

        if choice == 1:
            functions.sign_up()

        elif choice == 2:
            functions.sign_in()

        elif choice == 3:
            functions.admin_sign_in()

        elif choice == 0:
            print("Application Closed")

        else:
            print("Invalid Choice")
示例#2
0
文件: main.py 项目: Arunabha97/bank
def main():

    database.make_all_tables()
    database.reset_withdrawals()
    choice = 1

    print("\n##### Welcome To ONLINE BANKING TERMINAL #####\n")
    while choice != 0:
        print("\t--- Main Menu ---\n ")
        print("1. Sign Up (New Customer) ")
        print("2. Sign In (Existing Customer) ")
        print("3. Admin Sign In ")
        print("4. Quit ")
        print("\nEnter Your Choice: ", end='')
        try:
            choice = int(input())
            system('CLS')
            print("\n##### Welcome To ONLINE BANKING TERMINAL #####\n")
        except:
            system('CLS')
            print("\n##### Welcome To ONLINE BANKING TERMINAL #####\n")
            print("\tERROR: Invalid Input! ENTER AGAIN\n")
            choice = 1
            continue

        if choice == 1:
            functions.sign_up()

        elif choice == 2:
            functions.sign_in()

        elif choice == 3:
            functions.admin_sign_in()

        elif choice == 4:
            print("Saving Transaction ...\nClosing Terminal ...\n\n")
            break

        else:
            system('CLS')
            print("\n##### Welcome To ONLINE BANKING TERMINAL #####")
            print("ERROR: Unknown Choice! ENTER AGAIN\n")
示例#3
0
def login(request):
    input_dict = json.loads(request.body)
    op = int(input_dict["op"])
    print input_dict
    if op == 0:
        name = input_dict["name"]
        pwd = input_dict["password"]
        phone = input_dict["phone"]
        regid = input_dict["regid"]
        try:
            functions.Feature3_create_new_user(name, phone, pwd,regid)
        except IntegrityError:
            return HttpResponse("User Already Exists")
        return HttpResponse("User created")

    elif op == 1:
        phone = input_dict["phone"]
        pwd = input_dict["password"]
        status = functions.sign_in(phone, pwd)

        if status == 1:
            n = User.objects.get(phone_number=phone)
            print "1::"+n.name+"::"+str(n.date_creation).split()[0]
            return HttpResponse("1::"+n.name+"::"+str(n.date_creation).split()[0])
        elif status == 2:
            return HttpResponse("2::User does not exist")
        elif status == 3:
            return HttpResponse("3::Incorrect password")
        elif status == 4:
            return HttpResponse("4::Already Logged In")
        else:
            return HttpResponse("Error")

    elif op == 2:
        phone = input_dict["phone"]
        try:
            response = functions.sign_out(phone)
            return HttpResponse(response)
        except:
            print("Unknown Error")
        return HttpResponse("Error")