def admin_edit_area(): try: if admin_login_session() == 'admin': area_vo = AreaVO() area_dao = AreaDAO() state_dao = StateDAO() state_vo = StateVO() city_vo = CityVO() city_dao = CityDAO() area_vo.area_id = request.args.get('areaId') city_vo.city_state_id = request.args.get('stateId') area_vo_list = area_dao.edit_area(area_vo) state_vo_list = state_dao.view_state() city_vo_list = city_dao.view_ajax_area_city(city_vo) return render_template('admin/editArea.html', state_vo_list=state_vo_list, area_vo_list=area_vo_list, city_vo_list=city_vo_list) else: return redirect(url_for('admin_logout_session')) except Exception as ex: print("in admin_edit_area route exception occured>>>>>>>>>>", ex)
def admin_view_city(): try: if admin_login_session() == 'admin': city_dao = CityDAO() city_vo_list = city_dao.view_city() return render_template('admin/viewCity.html', city_vo_list=city_vo_list) else: return redirect(url_for('admin_logout_session')) except Exception as ex: print("admin_view_city route exception occured>>>>>>>>>>", ex)
def admin_delete_city(): try: if admin_login_session() == 'admin': city_vo = CityVO() city_dao = CityDAO() city_id = request.args.get('cityId') city_vo.city_id = city_id city_dao.delete_city(city_vo) return redirect(url_for('admin_view_city')) else: return redirect(url_for('admin_logout_session')) except Exception as ex: flash('Area is connected to this entity') print("in admin_delete_city route exception occured>>>>>>>>>>", ex) return redirect(url_for('admin_view_city'))
def ajax_area_city(): try: city_dao = CityDAO() city_vo = CityVO() city_vo.city_state_id = request.args.get('stateId') city_vo_list = city_dao.view_ajax_area_city(city_vo) ajax_area_city = [i.as_dict() for i in city_vo_list] print(ajax_area_city) return jsonify(ajax_area_city) except Exception as ex: print('ajax_area_city route exception occured>>>>>>>>>>', ex)
def admin_update_city(): try: if admin_login_session() == 'admin': city_vo = CityVO() city_dao = CityDAO() city_vo.city_id = request.form.get('cityId') city_vo.city_name = request.form.get('cityName') city_vo.city_description = request.form.get('cityDescription') city_vo.city_state_id = request.form.get('cityStateId') city_dao.update_city(city_vo) return redirect(url_for('admin_view_city')) else: return redirect(url_for('admin_logout_session')) except Exception as ex: print("in admin_update_city route exception occured>>>>>>>>>>", ex)
def admin_edit_city(): try: if admin_login_session() == 'admin': city_vo = CityVO() city_dao = CityDAO() state_dao = StateDAO() city_vo.city_id = request.args.get('cityId') city_vo_list = city_dao.edit_city(city_vo) state_vo_list = state_dao.view_state() return render_template('admin/editCity.html', state_vo_list=state_vo_list, city_vo_list=city_vo_list) else: return redirect(url_for('admin_logout_session')) except Exception as ex: print("in admin_edit_city route exception occured>>>>>>>>>>", ex)
def admin_ajax_area_city(): try: if admin_login_session() == 'admin': city_dao = CityDAO() city_vo = CityVO() city_vo.city_state_id = request.args.get('stateId') city_vo_list = city_dao.view_ajax_area_city(city_vo) ajax_area_city = [i.as_dict() for i in city_vo_list] return jsonify(ajax_area_city) else: return redirect(url_for('admin_logout_session')) except Exception as ex: print('admin_ajax_area_city route exception occured>>>>>>>>>>', ex)