def updateBuyerAccountInfo(): if request.method == "POST": fname = request.form['fname'] lname = request.form['lname'] prefStore = request.form['prefStore'] email = request.form['email'] prefCard = request.form['prefCard'] routingNo = request.form['routingNo'] phone = request.form['phone'] houseNo = request.form['houseNo'] streetAddress = request.form['streetAddress'] city = request.form['city'] state = request.form['state'] zipp = request.form['zip'] arr = re.split(r'[@.]', email) error1 = "phone has incorrect number of digits" error2 = "zip code has incorrect number of digits" error3 = "email contains non-alphanumeric characters" dictry = db.selectBuyerInfo(currentUser) store = db.listStores() if (len(str(phone))) != 9: #10: return render_template("buyerAccountInfo7.html", error=error1, dictry=dictry, store=store) elif (len(str(zipp))) != 5: return render_template("buyerAccountInfo7.html", error=error2, dictry=dictry, store=store) elif (len(arr) != 3) or (arr[0].isalnum() and arr[1].isalnum() and arr[2].isalnum()) / 1 != 1: return render_template("buyerAccountInfo7.html", error=error3, dictry=dictry, store=store) else: val = db.updateBuyerInfo(currentUser, prefStore, email, prefCard, routingNo, phone, houseNo, streetAddress, city, state, zipp, fname, lname) dictry = db.selectBuyerInfo(currentUser) store = db.listStores() if val == 0: return render_template("buyerAccountInfo7.html", error="Updates Saved", dictry=dictry, store=store) else: return render_template("buyerAccountInfo7.html", error="SQL query error", dictry=dictry, store=store) return render_template("buyerFunctionality6.html", error="ah shit here we go again")
def updateManagerAccInfo(): if request.method == "POST": fname = request.form['fname'] lname = request.form['lname'] email = request.form['email'] arr = re.split(r'[@.]', email) '''error1 = "phone has incorrect number of digits" error2 = "zip code has incorrect number of digits"''' error1 = "email contains non-alphanumeric characters" dictry = db.selectManagerInfo(currentUser) stores = db.listStores() sel = () '''if (len(str(phone))) != 9:#10: return render_template("managerAccountInfo23.html", error=error1, dictry=dictry, stores=stores, sel=sel) elif (len(str(zipp))) != 5: return render_template("managerAccountInfo23.html", error=error2, dictry=dictry, stores=stores, sel=sel)''' if (len(arr) != 3) or (arr[0].isalnum() and arr[1].isalnum() and arr[2].isalnum()) / 1 != 1: return render_template("managerAccountInfo23.html", error=error1, dictry=dictry, stores=stores, sel=sel) else: val = db.updateManagerInfo(currentUser, email, fname, lname) dictry = db.selectManagerInfo(currentUser) stores = db.listStores() sel = () if val == 0: return render_template("managerAccountInfo23.html", error="Updates Saved", dictry=dictry, stores=stores, sel=sel) else: return render_template("managerAccountInfo23.html", error="SQL query error", dictry=dictry, stores=stores, sel=sel) return render_template("managerAccountInfo23.html", error="Something Wrong")
def buyerAccountInfo(): #currentUser = '******' dictry = db.selectBuyerInfo(currentUser) store = db.listStores() """ store = [] for i in range(1,36): if i == int(dictry['defaultStore']): store.append(" selected ") else: store.append(" ") """ return render_template("buyerAccountInfo7.html", dictry=dictry, store=store)
def managerAccInfo(): dictry = db.selectManagerInfo(currentUser) stores = db.listStores() sel = () """ print (stores) count = int(0) for i in range(1,len(stores[0])+1): if i == int(dictry['storeID']): sel = sel + ( stores[0,count], stores[1,count] , "selected"), else: sel = sel + ( stores[0,count], stores[1,count] , " "), count = count + 1 print(sel) """ return render_template('managerAccountInfo23.html', dictry=dictry, stores=stores, sel=sel)
def registerBuyer(): store = db.listStores() return render_template('registerBuyer3.html', store=store)
def listOfStores(): info = db.listStores() return render_template('listOfStores8.html', info=info)
def registerManager(): store = db.listStores() return render_template('registerManager5.html', store=store)