def viewState(): stateDAO = StateDAO() stateDict = stateDAO.searchState() return render_template('admin/viewState.html', stateDict=stateDict)
def editState(): stateDAO = StateDAO() stateVO = StateVO() stateVO.stateId = request.args.get('stateId') stateDict = stateDAO.editState(stateVO) return render_template('admin/editState.html', stateDict=stateDict)
def deleteState(): stateDAO = StateDAO() stateVO = StateVO() stateVO.stateId = request.args.get('stateId') stateVO.stateActiveStatus = 'deactive' stateDAO.deleteState(stateVO) return redirect(url_for('viewState'))
def loadCity(): try: if session['loginRole'] != 'admin': return redirect(url_for('loadLogin')) except: return redirect(url_for('loadLogin')) stateDAO = StateDAO() stateDict = stateDAO.searchState() return render_template('admin/addCity.html', stateDict=stateDict)
def updateState(): stateVO = StateVO() stateDAO = StateDAO() stateVO.stateName = request.form['stateName'] stateVO.stateDescription = request.form['stateDescription'] stateVO.stateId = request.form['stateId'] stateDAO.updateState(stateVO) return redirect(url_for('viewState'))
def insertState(): stateVO = StateVO() stateDAO = StateDAO() stateVO.stateName = request.form['stateName'] stateVO.stateDescription = request.form['stateDescription'] stateVO.stateActiveStatus = "active" stateDAO.insertState(stateVO) return redirect(url_for('loadState'))
def loadPropertyAddress(): if session['loginRole']!= 'user': return redirect(url_for('login')) stateDAO = StateDAO() cityDAO = CityDAO() propertyBasicDetailsDAO = PropertyBasicDetailsDAO() stateDict = stateDAO.searchState() cityDict = cityDAO.searchCity() propertyDict = propertyBasicDetailsDAO.getMaxId() return render_template('user/propertyAddress.html',cityDict=cityDict,stateDict=stateDict,propertyDict=propertyDict)
def editCity(): if session['loginRole'] != 'admin': return redirect(url_for('login')) cityDAO = CityDAO() stateDAO = StateDAO() cityVO = CityVO() cityVO.cityId = request.args.get('cityId') cityDict = cityDAO.editCity(cityVO) stateDict = stateDAO.searchState() print(cityDict) return render_template('admin/editCity.html', cityDict=cityDict, stateDict=stateDict)