예제 #1
0
def deposit_money(id):
    try:
        acc_no = int(input("Enter your account No\n"))
    except:
        print("Invalid Account No")
        return
    account = database.get_all_info_account(acc_no,id,"deposit")
    if account is not None:
        try:
            amount = int(input("Enter amount to Deposit\n"))
        except:
            print("Invalid Amount")
            return
        if account.deposit(amount) == True:
            try:
                database.money_deposit_customer(account,amount)
            except cx_Oracle.DatabaseError as e:
                print("Sorry something went Wrong")
                print(e)
                con.rollback()
                return
            print("Rs ",amount,"Successfully deposited");
            print("Balance : Rs ",account.get_balance())

    else:
        print("Sorry Account No doesn't match")
예제 #2
0
def open_new_account(id):
    account = None
    print("\n --- Menu --- ")
    print("1. Open Savings Account")
    print("2. Open Current Account")
    print("3. Open Fixed Deposit Account")

    try:
        ch = int(input())
    except:
        print("Invalid Choice")
        return

    account = get_new_account(ch,id)
    if account is not None:
        try:
            database.open_new_account_customer(account,id)
        except cx_Oracle.DatabaseError as e:
            print("Sorry something went Wrong")
            print(e)
            con.rollback()
            return
        if ch == 3:
            res = db_admin.get_fd_report(id)
            print("Account No \t\t\t\t Amount \t\t\t\t Deposit Term")
            for i in range(0,len(res)):
                print(res[i][0],"   \t\t\t\t\t   ",res[i][1],"   \t\t\t\t   ",res[i][2])

    else:
        print("Invalid Choice")
예제 #3
0
def change_address(id):
    ch = 1
    addr = ""

    print("-- Menu --")
    print("1. Change Address Line 1")
    print("2. Change Address Line 2")
    print("3. Change State")
    print("4. Change City")
    print("5. Change Pincode")
    print("6. Quit")

    while ch != 6:

        try:
            ch = int(input())
        except:
            print("Invalid Choice")
            ch = 1
            continue

        if ch == 1:
            addr = input("Enter New Address Line 1\n")

        elif ch == 2:
            addr = input("Enter New Address Line 2\n")

        elif ch == 3:
            addr = input("Enter New State\n")

        elif ch == 4:
            addr = input("Enter New City\n")

        elif ch == 5:
            try:
                addr = int(input("Enter New Pincode\n"))
                if addr < 100000 or addr > 999999 :
                    print("Invalid Pincode")
                    break
            except:
                print("Invalid Pincode")
                break


        elif ch == 6:
            break

        if type(addr) != int and len(addr) == 0:
            print("Field can't be blank")
            break

        try:
            database.change_address_customer(ch,id,addr)
        except cx_Oracle.DatabaseError as e:
            print("Sorry something went Wrong")
            print(e)
            con.rollback()
            return
예제 #4
0
def avail_loan(id):
    try:
        acc_no = int(input("\nEnter Your Savings Account No : "))
    except:
        print("Invalid Account No")
        return
    account = database.get_all_info_account(acc_no,id,"loan")
    if account is not None:
        max_loan = 2*account.get_balance()
        msg = "\nEnter loan amount (Max Amount : Rs "+ str(max_loan) + " ) (in multiples of 1000) : "
        try:
            loan_amt = int(input(msg))
        except:
            print("Invalid Amount")
            return
        if loan_amt <= max_loan and loan_amt > 0 and loan_amt % 1000 == 0 :
            try:
                loan_term = int(input("\nEnter repayment term (in months) : "))
            except:
                print("Invalid repayment term")
                return
            if loan_term > 0:
                try:
                    database.get_loan_customer(account.get_account_no(),loan_amt,loan_term)
                except cx_Oracle.DatabaseError as e:
                    print("Sorry something went wrong")
                    print(e)
                    con.rollback()
                    return

                res = db_admin.get_loan_report(id)
                print("Account No \t\t\t\t Amount \t\t\t\t Repay Term")
                for i in range(0,len(res)):
                    print(res[i][0],"   \t\t\t\t\t   ",res[i][1],"   \t\t\t\t   ",res[i][2])
            else:
                print("Sorry ! Invalid Loan Term")

        else:
            print("Sorry ! Invalid Loan Amount")

    else:
        print("Sorry! Account No Doesn't match")
예제 #5
0
def sign_up():

    customer = Customer()
    first_name = input("Enter First Name\n")
    if len(first_name) == 0:
        print("Field can't be blank")
        return
    last_name = input("Enter Last Name\n")
    if len(last_name) == 0:
        print("Field can't be blank")
        return
    add_line1 = input("Enter Address Line 1\n")
    if len(add_line1) == 0:
        print("Field can't be blank")
        return
    add_line2 = input("Enter Address Line 2\n")
    if len(add_line2) == 0:
        print("Field can't be blank")
        return
    city = input("Enter City\n")
    if len(city) == 0:
        print("Field can't be blank")
        return
    state = input("Enter State\n")
    if len(state) == 0:
        print("Field can't be blank")
        return
    try:
        pincode = int(input("Enter Pincode\n"))
        if pincode < 100000 or pincode > 999999:
            print("Invalid Pincode")
            return
    except:
        print("Invalid Pincode")
        return

    password = input("Enter password (min 8 char and max 20 char)\n")
    while len(password) < 8 or len(password) > 20:
        print("Please Enter password in given range\n")
        password = input()

    customer.set_first_name(first_name)
    customer.set_last_name(last_name)
    customer.set_password(password)
    customer.set_status("open")
    customer.set_login_attempts(3)

    addr = Address()
    addr.set_line_1(add_line1)
    addr.set_line_2(add_line2)
    addr.set_city(city)
    addr.set_state(state)
    addr.set_pincode(pincode)

    customer.set_address(addr)
    try:
        database.sign_up_customer(customer)
    except cx_Oracle.DatabaseError as e:
        print("Sorry something went Wrong")
        print(e)
        con.rollback()
        return