def adminEditPackage():
    try:
        if adminLoginSession() == 'admin':
            packageVO = PackageVO()

            packageDAO = PackageDAO()

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

            print('packageId::', packageId)

            packageVO.packageId = packageId

            packageVOList = packageDAO.editPackage(packageVO)

            print("=======packageVOList=======", packageVOList)

            print("=======type of packageVOList=======", type(packageVOList))

            return render_template('admin/editPackage.html', packageVOList=packageVOList)

        else:
            return adminLogoutSession()

    except Exception as ex:
        print(ex)
def adminViewPurchase():
    try:
        if adminLoginSession() == 'admin':
            purchaseDAO = PurchaseDAO()
            purchaseVOList = purchaseDAO.viewPurchase()
            print("__________________", purchaseVOList)
            loginVO = LoginVO()
            loginDAO = LoginDAO()
            packageVO = PackageVO()
            packageDAO = PackageDAO()
            purchaseDictList = [i.as_dict() for i in purchaseVOList]
            print('$$$$$$$$$$$$$$$$', purchaseDictList)

            loginVO.loginId = purchaseDictList[0]['purchase_loginId']
            packageVO.packageId = purchaseDictList[0]['purchase_packageId']

            packageVOList = packageDAO.viewUserPackage(packageVO)
            loginVOList = loginDAO.registerLogin(loginVO)
            print('ok')
            return render_template('admin/viewPurchase.html',
                                   purchaseVOList=purchaseVOList,
                                   packageVOList=packageVOList,
                                   loginVOList=loginVOList)
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
Exemple #3
0
def adminUpdatePackage():
    try:
        if adminLoginSession() == 'admin':
            packageId = request.form['packageId']
            packageName = request.form['packageName']
            # packageDescription = request.form['packageDescription']
            packagePrice = request.form['packagePrice']
            # packageDuration = request.form['packageDuration']

            packageVO = PackageVO()
            packageDAO = PackageDAO()

            packageVO.packageId = packageId
            packageVO.packageName = packageName
            # packageVO.packageDescription = packageDescription
            packageVO.packagePrice = packagePrice
            # packageVO.packageDuration = packageDuration

            packageDAO.updatePackage(packageVO)

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

    except Exception as ex:
        print(ex)
def adminDeletePackage():
    try:
        if adminLoginSession() == 'admin':
            packageVO = PackageVO()

            packageDAO = PackageDAO()

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

            packageVO.packageId = packageId

            packageDAO.deletePackage(packageVO)

            return redirect(url_for('adminViewPackage'))
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
def adminInsertpackage():
    try:
        if adminLoginSession() == 'admin':
            packageName = request.form['packageName']
            packagePrice = request.form['packagePrice']
            packageDuration = request.form['packageDuration']

            packageVO = PackageVO()
            packageDAO = PackageDAO()

            packageVO.packageName = packageName
            packageVO.packagePrice = packagePrice
            packageVO.packageDuration = packageDuration

            packageDAO.insertPackage(packageVO)

            return redirect(url_for('adminViewPackage'))
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
def userViewPurchase():
    try:
        if adminLoginSession() == 'user':
            purchaseDAO = PurchaseDAO()
            purchaseVO = PurchaseVO()
            packageVO = PackageVO()
            packageDAO = PackageDAO()
            purchaseVO.purchase_loginId = session['session_LoginId']
            purchaseVOList = purchaseDAO.viewUserPurchase(purchaseVO)
            print("__________________", purchaseVOList)
            purchaseDictList = [i.as_dict() for i in purchaseVOList]
            print(purchaseDictList)
            packageVO.packageId = purchaseDictList[0]['purchase_packageId']
            packageVOList = packageDAO.viewUserPackage(packageVO)
            print("__________________", packageVOList)
            return render_template('user/viewPurchase.html',
                                   purchaseVOList=purchaseVOList,
                                   packageVOList=packageVOList)
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
def userInsertpurchase():
    try:
        print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
        packageVO = PackageVO()
        purchaseDate = date.today()
        purchaseTime = datetime.now().strftime("%H:%M:%S")

        packageId = request.form['packageId']
        print(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>", packageId)
        purchaseVO = PurchaseVO()
        purchaseDAO = PurchaseDAO()

        purchaseVO.purchaseDate = purchaseDate
        purchaseVO.purchaseTime = purchaseTime
        purchaseVO.purchase_PackageId = packageId
        purchaseVO.purchase_LoginId = session['session_loginId']

        purchaseDAO.insertPurchase(purchaseVO)

        return redirect(url_for('userViewPurchase'))
    except Exception as ex:
        print(ex)