def adminEditCropMedicine(): try: if adminLoginSession() == 'admin': print("in edit") cropTypeDAO = CropTypeDAO() cropTypeVOList = cropTypeDAO.viewCropType() cropNameDAO = CropNameDAO() cropNameVOList = cropNameDAO.viewCropName() cropMedicineVO = CropMedicineVO() cropMedicineDAO = CropMedicineDAO() cropMedicineId = request.args.get('cropMedicineId') print(cropMedicineId) cropMedicineVO.cropMedicineId = cropMedicineId cropMedicineVOList = cropMedicineDAO.editCropMedicine( cropMedicineVO) print(cropMedicineVOList) return render_template('admin/editCropMedicine.html', cropMedicineVOList=cropMedicineVOList, cropTypeVOList=cropTypeVOList, cropNameVOList=cropNameVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def adminViewCropName(): try: if adminLoginSession() == 'admin': cropNameDAO = CropNameDAO() cropNameVOList = cropNameDAO.viewCropName() print(cropNameVOList) return render_template('admin/viewCropName.html', cropNameVOList=cropNameVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def adminDeleteCropName(): try: if adminLoginSession() == 'admin': cropNameDAO = CropNameDAO() cropNameId = request.args.get('cropNameId') cropNameDAO.deleteCropName(cropNameId) return redirect(url_for('adminViewCropName')) else: return adminLogoutSession() except Exception as ex: print(ex)
def adminLoadCropMedicine(): try: if adminLoginSession() == 'admin': cropTypeDAO = CropTypeDAO() cropTypeVOList = cropTypeDAO.viewCropType() cropNameDAO = CropNameDAO() cropNameVOList = cropNameDAO.viewCropName() return render_template('admin/addCropMedicine.html', cropTypeVOList=cropTypeVOList, cropNameVOList=cropNameVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def userLoadImage(): try: if adminLoginSession() == 'user': cropTypeDAO = CropTypeDAO() cropTypeVOList = cropTypeDAO.viewCropType() cropNameDAO = CropNameDAO() cropNameVOList = cropNameDAO.viewCropName() return render_template('user/addImage.html', cropTypeVOList=cropTypeVOList, cropNameVOList=cropNameVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def adminInsertCropName(): try: if adminLoginSession() == 'admin': cropName = request.form['cropName'] cropNameDescription = request.form['cropNameDescription'] cropName_CropTypeId = request.form['cropName_CropTypeId'] cropNameVO = CropNameVO() cropNameDAO = CropNameDAO() cropNameVO.cropName = cropName cropNameVO.cropNameDescription = cropNameDescription cropNameVO.cropName_CropTypeId = cropName_CropTypeId cropNameDAO.insertCropName(cropNameVO) return redirect(url_for('adminViewCropName')) else: return adminLogoutSession() except Exception as ex: print(ex)