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)
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)