Example #1
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)
Example #2
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)