Example #1
0
def withdraw_request(conn):
    print "WITHDRAWING SOME DOUGH \n"
    print "enter an account number 1-100:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue

        if (netBuffer > 0 and netBuffer <= 100):
            act = netBuffer
            break

    print "enter an amount to withdraw:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue
        if (netBuffer >= 0 and netBuffer < maxint):
            bal = netBuffer
            break
    package = xml.client_package(version, 40, [act, bal])
    send_message(package, conn)
    return
Example #2
0
def create_request(conn):

    print "CREATING AN ACCOUNT \n"
    print "enter a an account number 1-100:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue

        if (netBuffer > 0 and netBuffer <= 100):
            act = netBuffer
            break
    print "enter a starting balance:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue
        if (netBuffer >= 0 and netBuffer < maxint):
            bal = netBuffer
            break

    # should refactor opcodes
    package = xml.client_package(version, 10, [act, bal])
    send_message(package, conn)

    return
Example #3
0
def withdraw_request(conn):
    print "WITHDRAWING SOME DOUGH \n"
    print "enter an account number 1-100:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue

        if(netBuffer > 0 and netBuffer <= 100):
            act = netBuffer
            break

    print "enter an amount to withdraw:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue
        if(netBuffer >= 0 and netBuffer < maxint):
            bal = netBuffer
            break
    package = xml.client_package(version, 40, [act,bal])
    send_message(package,conn)
    return
Example #4
0
def create_request(conn):

    print "CREATING AN ACCOUNT \n"
    print "enter a an account number 1-100:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue

        if(netBuffer > 0 and netBuffer <= 100):
            act = netBuffer
            break
    print "enter a starting balance:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue
        if(netBuffer >= 0 and netBuffer < maxint):
            bal = netBuffer
            break
    
    # should refactor opcodes
    package = xml.client_package(version, 10, [act,bal])
    send_message(package,conn)

    return
Example #5
0
def delete_request(conn):
    print "DELETING AN ACCOUNT \n"
    print "enter a an account number 1-100:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue

        if (netBuffer > 0 and netBuffer <= 100):
            act = netBuffer
            break

    package = xml.client_package(version, 20, [act])
    send_message(package, conn)
    return
Example #6
0
def balance_request(conn):
    print "CHECKING THE BALANCE OF AN ACCOUNT \n"
    print "enter an account number 1-100:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue

        if (netBuffer > 0 and netBuffer <= 100):
            act = netBuffer
            break

    package = xml.client_package(version, 50, [act])
    send_message(package, conn)
    return
Example #7
0
def delete_request(conn):
    print "DELETING AN ACCOUNT \n"
    print "enter a an account number 1-100:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue

        if(netBuffer > 0 and netBuffer <= 100):
            act = netBuffer
            break

    package = xml.client_package(version, 20, [act])
    send_message(package,conn)
    return
Example #8
0
def balance_request(conn):
    print "CHECKING THE BALANCE OF AN ACCOUNT \n"
    print "enter an account number 1-100:"
    while True:
        try:
            netBuffer = int(raw_input('>> '))
        except ValueError:
            continue

        if(netBuffer > 0 and netBuffer <= 100):
            act = netBuffer
            break

    package = xml.client_package(version, 50, [act])
    send_message(package,conn)
    return
Example #9
0
def end_session(conn):
    package = xml.client_package(version, 60, [])
    send_message(package, conn)
    return
Example #10
0
def end_session(conn):
    package = xml.client_package(version, 60, [])
    send_message(package,conn)
    return