Exemplo n.º 1
0
def adminDeleteCropType():
    try:
        if adminLoginSession() == 'admin':
            cropTypeVO = CropTypeVO()
            cropTypeDAO = CropTypeDAO()

            cropTypeId = request.args.get('cropTypeId')
            print(cropTypeId)
            cropTypeVO.cropTypeId = cropTypeId
            cropTypeDAO.deleteCropType(cropTypeVO)
            return redirect(url_for('adminViewCropType'))
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
Exemplo n.º 2
0
def adminInsertCropType():
    try:
        if adminLoginSession() == 'admin':
            cropTypeName = request.form['cropTypeName']
            cropTypeDescription = request.form['cropTypeDescription']

            cropTypeVO = CropTypeVO()
            cropTypeDAO = CropTypeDAO()

            cropTypeVO.cropTypeName = cropTypeName
            cropTypeVO.cropTypeDescription = cropTypeDescription
            cropTypeDAO.insertCropType(cropTypeVO)
            return redirect(url_for('adminViewCropType'))
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
Exemplo n.º 3
0
def adminEditCropType():
    try:
        if adminLoginSession() == 'admin':
            cropTypeVO = CropTypeVO()
            cropTypeDAO = CropTypeDAO()

            cropTypeId = request.args.get('cropTypeId')

            cropTypeVO.cropTypeId = cropTypeId

            cropTypeVOList = cropTypeDAO.editCropType(cropTypeVO)

            return render_template('admin/editCropType.html',
                                   cropTypeVOList=cropTypeVOList)
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
Exemplo n.º 4
0
def adminUpdateCropType():
    try:
        if adminLoginSession() == 'admin':
            if request.method == 'POST':
                cropTypeId = request.form['cropTypeId']
                cropTypeName = request.form['cropTypeName']
                cropTypeDescription = request.form['cropTypeDescription']

                cropTypeVO = CropTypeVO()
                cropTypeDAO = CropTypeDAO()

                cropTypeVO.cropTypeId = cropTypeId
                cropTypeVO.cropTypeName = cropTypeName
                cropTypeVO.cropTypeDescription = cropTypeDescription

                cropTypeDAO.updateCropType(cropTypeVO)

            return redirect(url_for('adminViewCropType'))
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)