Пример #1
0
def adminUpdatePurchase():
    try:
        if adminLoginSession() == 'admin':
            purchaseDate = date.today()
            purchaseTime = datetime.now().strftime("%H:%M:%S")
            purchase_loginId = session['session_LoginId']
            packageId = request.form['packageId']
            purchaseId = request.form['purchaseId']

            purchaseVO = PurchaseVO()
            purchaseDAO = PurchaseDAO()

            purchaseVO.purchaseId = purchaseId
            purchaseVO.purchaseDate = purchaseDate
            purchaseVO.purchaseTime = purchaseTime
            purchaseVO.purchase_loginId = purchase_loginId
            purchaseVO.purchase_packageId = packageId
            purchaseDAO.insertPurchase(purchaseVO)

            purchaseDAO.updatePurchase(purchaseVO)

            return redirect(url_for('adminViewPurchase'))
        else:
            adminLogoutSession()

    except Exception as ex:
        print(ex)
Пример #2
0
def userDeletePurchase():
    try:
        if adminLoginSession() == 'user':
            purchaseDAO = PurchaseDAO()
            purchaseVO = PurchaseVO()

            purchaseId = request.args.get('purchaseId')
            purchaseVO.purchaseId = purchaseId

            purchaseDAO.deletePurchase(purchaseVO)

            return redirect(url_for('userViewPurchase'))
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
Пример #3
0
def adminEditPurchase():
    try:
        if adminLoginSession() == 'admin':

            purchaseVO = PurchaseVO()

            purchaseDAO = PurchaseDAO()

            purchaseId = request.args.get('purchaseId')

            purchaseVO.purchaseId = purchaseId

            purchaseVOList = purchaseDAO.editPurchase(purchaseVO)

            return render_template('admin/editPurchase.html',
                                   purchaseVOList=purchaseVOList)
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)