Пример #1
0
def creditCardMain():
    ID = login('carduserdb')  #需完善登陆逻辑,登录失败后返回主程序
    while ID:
        print '''----------信用卡中心-----------'''
        print '用户名:%s' % ID
        for i in cardMenu:
            print '----%d\t%s-----' % (cardMenu.index(i) + 1, i)
        print '''---------------------'''
        choice = getSelection(cardMenu)
        if choice == 1:
            MyCard(ID)
        elif choice == 2:
            Withdraws(ID)
        elif choice == 3:
            Transfers()
            print 'Transfers'
        elif choice == 4:
            Repayment(ID)
        elif choice == 5:
            CardLog(ID)
        else:
            print '用户 %s退出,返回主菜单' % ID
            break
    else:
        print '登录失败,返回主菜单'
Пример #2
0
def adminMain():
    '''后台管理主程序
    '''
    adminMenu = [
        'createAccount', 'lockAccount', 'unlockAccount', 'createCreditCard',
        'lockCreditCard', 'unlockCreditCard', 'enhanceCreditLimit'
    ]
    if not adminLogin():
        return
    while True:
        print u'''----------后台管理中心-----------'''
        for i in adminMenu:
            print '----%d\t%s-----' % (adminMenu.index(i) + 1, i)
        print '''---------------------'''
        choice = getSelection(adminMenu)
        if choice == 1:
            createAccount()
        elif choice == 2:
            lockAccount()
        elif choice == 3:
            unlockAccount()
        elif choice == 4:
            createCreditCard()
        elif choice == 5:
            lockCreditCard()
        elif choice == 6:
            unlockCreditCard()
        elif choice == 7:
            enhanceCreditLimit()
        else:
            print '返回主菜单'
            break
Пример #3
0
def shoppingMain():
    '''购物中心主程序
    '''
    shoppingMenu = ['Buy', 'EmptyCart', 'Pay', 'PersonalCenter', 'shopBack']
    ID = login('shopping_userdb')
    while ID:
        print '''----------购物中心-----------'''
        for i in shoppingMenu:
            print '----%d\t%s-----' % (shoppingMenu.index(i) + 1, i)
        print '''---------------------'''
        choice = getSelection(shoppingMenu)
        if choice == 1:
            Buy(ID)
        elif choice == 2:
            emptyCart(ID)
        elif choice == 3:
            Pay(ID)
        elif choice == 4:
            PersonalCenter(ID)
            print 'PersonalCenter'
        else:
            print 'shopBack'
            break
    else:
        print '登录错误,返回主菜单'
Пример #4
0
def PersonalCenter(userid):
    '''个人中心 :绑定信用卡,购物日志'''
    personcenterMenu = ['BindCard', 'ShoppingLog', 'Return']
    print '''----------个人中心-----------'''
    for i in personcenterMenu:
        print '----%d\t%s-----' % (personcenterMenu.index(i) + 1, i)
    print '''---------------------'''
    choice = getSelection(personcenterMenu)
    if choice == 1:
        BindCard(userid)
    elif choice == 2:
        ShoppingLog(userid)
    else:
        print 'Return'
Пример #5
0
def main():
    mainList = ['Shopping', 'CreditCard', 'BackendAdmin']
    while True:
        print '''----------主菜单-----------'''
        for i in mainList:
            print '----%d\t%s-----' % (mainList.index(i) + 1, i)
        print '''---------------------'''
        choice = getSelection(mainList)
        if choice == 1:
            print '进入购物中心........'
            shoppingMain()
        elif choice == 2:
            print '进入信用卡中心........'
            creditCardMain()
        else:
            print '进入后台管理.........'
            adminMain()