def adminViewPackage(): try: if adminLoginSession() == 'admin': packageDAO = PackageDAO() packageVOList = packageDAO.viewPackage() print("__________________", packageVOList) return render_template('admin/viewPackage.html', packageVOList=packageVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def userLoadPurchase(): try: if adminLoginSession() == 'user': packageDAO = PackageDAO() packageVOList = packageDAO.viewPackage() return render_template('user/addPurchase.html', packageVOList=packageVOList) else: 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 adminEditPackage(): try: if adminLoginSession() == 'admin': packageVO = PackageVO() packageDAO = PackageDAO() packageId = request.args.get('packageId') packageVO.packageId = packageId packageVOList = packageDAO.editPackage(packageVO) return render_template('admin/editPackage.html', packageVOList=packageVOList) 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)