def userinsertPurchase(): try: if adminLoginSession() == 'user': purchaseVO = PurchaseVO() purchaseDAO = PurchaseDAO() purchase_LoginId = session['session_loginId'] purchaseDate = datetime.date(datetime.now()) purchaseTime = datetime.time(datetime.now()) purchase_PackageId = request.args.get('purchase_PackageId') purchaseVO.purchase_LoginId = purchase_LoginId purchaseVO.purchaseDate = purchaseDate purchaseVO.purchaseTime = purchaseTime purchaseVO.purchase_PackageId = purchase_PackageId purchaseDAO.insertPurchase(purchaseVO) return redirect(url_for('userViewPurchase')) else: return adminLogoutSession() except Exception as ex: print(ex)
def userInsertPurchase(): try: if adminLoginSession() == 'user': purchase_LoginId = session.get('session_loginId') purchase_PackageId = request.args.get('packageId') purchaseDate = date.today() print(purchaseDate) purchaseTime = datetime.now().strftime("%H:%M:%S") print(purchaseTime) purchaseVO = PurchaseVO() purchaseDAO = PurchaseDAO() purchaseVO.purchaseDate = purchaseDate purchaseVO.purchaseTime = purchaseTime purchaseVO.purchase_LoginId = purchase_LoginId purchaseVO.purchase_PackageId = purchase_PackageId purchaseDAO.insertPurchase(purchaseVO) return redirect(url_for('userViewPurchase')) else: return redirect(url_for('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)
def userLoadVideo(): try: if adminLoginSession() == 'user': videoDAO = VideoDAO() videoVOList = videoDAO.viewLocalData() purchaseVO = PurchaseVO() purchaseDAO = PurchaseDAO() purchaseVO.purchase_loginId = session['session_LoginId'] purchaseVOList = purchaseDAO.viewUserPurchase(purchaseVO) purchaseVODict = [[i[0].as_dict(), i[1].as_dict()] for i in [j for j in purchaseVOList]] purchaseDate = [i[0]['purchaseDate'] for i in purchaseVODict] if len(purchaseDate) > 0: dateMax = max(purchaseDate) index = purchaseDate.index(dateMax) purchaseDuration = purchaseVODict[index][1]['packageDuration'] purchaseDuration, _ = purchaseDuration.split(' ') currentDate = date.today() dateDifference = currentDate - dateMax if int(purchaseDuration) * 28 > int(dateDifference.days): return render_template('user/addVideo.html', videoVOList=videoVOList) else: return redirect( url_for( 'userLoadPurchase', msg= 'Current Package Is Expired, Purchase Package To Continue using System' )) else: adminLogoutSession() except Exception as ex: print(ex)
def adminViewPurchase(): try: if adminLoginSession() == 'admin': purchaseDAO = PurchaseDAO() purchaseVOList = purchaseDAO.adminViewPurchase() return render_template('admin/viewPurchase.html', purchaseVOList=purchaseVOList) else: adminLogoutSession() except Exception as ex: print(ex)
def userViewPurchase(): try: purchaseDAO = PurchaseDAO() purchaseVO = PurchaseVO() purchaseVO.purchase_LoginId = session['session_loginId'] purchaseVOList = purchaseDAO.viewUserPurchase(purchaseVO) print("__________________", purchaseVOList) return render_template('user/viewPurchase.html', purchaseVOList=purchaseVOList) except Exception as ex: print(ex)
def userViewPurchase(): try: if adminLoginSession() == 'user': purchaseDAO = PurchaseDAO() purchaseVO = PurchaseVO() purchaseVO.purchase_loginId = session['session_LoginId'] purchaseVOList = purchaseDAO.viewUserPurchase(purchaseVO) return render_template('user/viewPurchase.html', purchaseVOList=purchaseVOList) else: adminLogoutSession() except Exception as ex: print(ex)
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)
def adminViewPurchase(): try: if adminLoginSession() == 'admin': purchaseDAO = PurchaseDAO() purchaseVO = PurchaseVO() loginVO = LoginVO() purchase_LoginId = session['session_loginId'] purchaseVO.purchase_LoginId = purchase_LoginId purchaseVOList = purchaseDAO.viewPurchase_Admin() return render_template('admin/viewPurchase.html', purchaseVOList=purchaseVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def userViewPurchase(): try: if adminLoginSession() == 'user': purchaseDAO = PurchaseDAO() purchaseVO = PurchaseVO() purchase_PackageId = request.args.get('purchase_PackageId') purchaseVO.purchase_PackageId = purchase_PackageId purchase_LoginId = session['session_loginId'] purchaseVO.purchase_LoginId = purchase_LoginId purchaseVOList = purchaseDAO.viewPurchase_User() return render_template('user/viewPurchase.html', purchaseVOList=purchaseVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
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)
def adminInsertpurchase(): try: if adminLoginSession() == 'user': purchaseDate = date.today() purchaseTime = datetime.now().strftime("%H:%M:%S") purchase_loginId = session['session_LoginId'] packageId = request.form['packageId'] purchaseVO = PurchaseVO() purchaseDAO = PurchaseDAO() purchaseVO.purchaseDate = purchaseDate purchaseVO.purchaseTime = purchaseTime purchaseVO.purchase_loginId = purchase_loginId purchaseVO.purchase_packageId = int(packageId) purchaseDAO.insertPurchase(purchaseVO) return redirect(url_for('userLoadPayment')) 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)
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)