def increment_user_bonus(value): bonus = helper.session_get('user_bonus') total = float(bonus) + float(value)*0.03 helper.session_set({'user_bonus':str(total)}) c = con.cursor(buffered=True) c.execute("UPDATE client SET bonus='"+str(total)+"' WHERE id='"+helper.session_get('user_id')+"'") con.commit()
def delete_account(): if helper.session_get('login'): db.delete_account() helper.session_clear() return render_template("app/index.html") else: return page_not_found(404)
def create_reservation(): if helper.session_get('basket'): helper.create_reservation() basket_clear() return user() else: return page_not_found(404)
def a_hotel(): roles = helper.session_get('user_roles') if (roles != "admin"): return page_not_found(404) hotels = db.get_all_hotels() areas = db.get_all_areas() return render_template("admin/hotel.html", hotels=hotels, areas=areas)
def add_hotel(): roles = helper.session_get('user_roles') if (roles != "admin"): return page_not_found(404) if request.method == 'POST': helper.add_hotel(request) return a_hotel() else: return page_not_found(404)
def delete_account(): param = helper.session_get('user_id') c = con.cursor() c.execute("Delete from client where id ='"+param+"'") con.commit()
def user(): if helper.session_get('login'): data = db.get_reservation_by_user(helper.session_get('user_id')) return render_template("app/user.html", data=data) else: return page_not_found(404)
def delete_reservation(): roles = helper.session_get('user_roles') if (roles != "admin"): return index() helper.delete_reservation(request) return a_reservation()
def delete_user(): roles = helper.session_get('user_roles') if (roles != "admin"): return index() helper.delete_user(request) return a_users()
def a_users(): roles = helper.session_get('user_roles') if (roles != "admin"): return page_not_found(404) reservation = db.get_all_users() return render_template("admin/user.html", data=reservation)
def admin(): roles = helper.session_get('user_roles') if (roles != "admin"): return page_not_found(404) data = db.admin_home_static() return render_template("admin/index.html", data=data)