コード例 #1
0
ファイル: mainproject.py プロジェクト: barryn10/finalproject
def neworder():
        if checkSession() == False:
            return redirect ('login')
        allProducts = productList()
        allProducts.getAll()
        if request.form.get('order') is None:
            p = productList()
            o = orderList()
            o.set('userID','')
            o.set('productID','')
            o.set('productName','')
            o.set('productSize','')
            o.set('Customer','')
            o.set('Address','')
            o.set('cardType','')
            o.add()
            return render_template('createOrder.html', title='New Order',order=o.data[0],pl=allProducts.data,product=p.data)
        else:
            o = orderList()
            o.set('userID',session['user']['userID'])
            o.set('productID',request.form.get('productID'))
            o.set('productName',request.form.get('productName'))
            o.set('productSize',request.form.get('productSize'))
            o.set('Customer',request.form.get('Customer'))
            o.set('Address',request.form.get('Address'))
            o.set('cardType',request.form.get('cardType'))
            o.add()
            if o.verifyNew():
                o.insert()
                print(o.data)
                return render_template('savedorder.html', title='Order Saved',order=o.data[0])
            else:
                return render_template('createOrder.html', title='Order Not Saved',order=o.data[0],msg=u.errorList)
コード例 #2
0
ファイル: mainproject.py プロジェクト: barryn10/finalproject
def createOrderByProduct():
    if checkSession() == False: #check to make sure the user is logged in
        return redirect('login')
    allProducts = productList()
    allProducts.getAll()
    u = userList()
    o = orderList()
    p = productList()
    if request.form.get('productID') is None:
        o = orderList()
        #o.set('productID','')
        o.set('productName','')
        o.set('productSize','')
        o.set('Customer','')
        o.set('Address','')
        o.set('cardType','')
        o.add()
        return render_template('createOrderByProduct.html', title='New Order',order=o.data[0],product=p.data[0])
    else:
        o = orderList()
        #o.set('productID',request.form.get('productID'))
        o.set('productName',request.form.get('productName'))
        o.set('productSize',request.form.get('productSize'))
        o.set('Customer',request.form.get('Customer'))
        o.set('Address',request.form.get('Address'))
        o.set('cardType',request.form.get('cardType'))

        o.add()
        #if o.verifyNew():
            #o.insert()
            #print(o.data)
            #return render_template('savedorder.html', title='Order Saved',order=o.data[0])
        #else:
            #return render_template('createOrder.html', title='Order Not Saved',order=o.data[0],msg=u.errorList)

    '''if request.args.get(p.pk) is None:
        return render_template('error.html', msg='No customer id given.')


    p.getById(request.args.get(p.pk))
    if len(p.data) <= 0:
        return render_template('error.html', msg='Customer not found.')


    p.update()
    print(p.data)
'''
    #sneakerwelcome = 'Hello, ' + session['user']['First'] + ' ' + 'I hope you are ready to shop today. Welcome to our store!'

    return render_template('createOrderByProduct.html', title='Creating an order...',msg ='',order=o.data,product=p.data,user=u.data)
コード例 #3
0
ファイル: mainproject.py プロジェクト: barryn10/finalproject
def myorders():
    if checkSession() == False: #check to make sure the user is logged in
        return redirect('login')
    #sneakerwelcome = 'Hello, ' + session['user']['First'] + ' ' + 'I hope you are ready to shop today. Welcome to our store!'
    o = orderList()
    o.getAll()
    print(o.data)
    return render_template('myorders.html', title='Orders',msg ='',orders=o.data)
コード例 #4
0
ファイル: mainproject.py プロジェクト: barryn10/finalproject
def deleteorder():
    if checkSession() == False:
        return redirect('login')
    print("orderID:",request.form.get('orderID'))
    #return ''
    o = orderList()
    o.deleteByID(request.form.get('orderID'))
    return render_template('confirmaction.html', title='Order Deleted',  msg='Order deleted.')

    '''
コード例 #5
0
ファイル: mainproject.py プロジェクト: barryn10/finalproject
def order():
    if checkSession() == False:
        return redirect('login')
    o = orderList()
    if request.args.get(o.pk) is None:
        return render_template('error.html', msg='No product id given.')

    o.getById(request.args.get(o.pk))
    if len(o.data) <= 0:
        return render_template('error.html', msg='Product not found.')

    #o.update()
    print(o.data)

    return render_template('orderedit.html', title='Order ',order=o.data[0])
コード例 #6
0
ファイル: mainproject.py プロジェクト: barryn10/finalproject
def saveorder():
    if checkSession() == False:
        return redirect('login')
    o = orderList()
    o.set('orderID',request.form.get('orderID'))
    o.set('productID',request.form.get('productID'))
    #o.set('productName',request.form.get('productName'))
    #o.set('productSize',request.form.get('productSize'))
    o.set('Customer',request.form.get('Customer'))
    o.set('Address',request.form.get('Address'))
    o.set('cardType',request.form.get('cardType'))
    o.set('orderStatus',request.form.get('orderStatus'))
    o.add()
    o.update()
    #o.insert()
    #p.insert()
    print(o.data)
        #return ''
    return render_template('savedorder.html', title='Order Saved',order=o.data[0])
コード例 #7
0
ファイル: unitTests3.py プロジェクト: barryn10/finalproject
from orders import orderList
import time
ol = orderList()  #instance of a customer list class (object)

#Be familiar with set, add, insert,delete,update, .data

ol.set('productID', '1')
ol.set('Item', 'Hyperdunk Elite 3')
ol.set('itemSize', '13')
ol.set('userID', '9')
ol.set('Address', '29 Meadow Street Atlanta, GA 09987')
ol.set('cardType', 'Credit')
ol.add()
ol.insert()