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 userViewDiseaseMedicine(): try: if adminLoginSession() == 'user': medicineDAO = MedicineDAO() cropTypeDAO = CropTypeDAO() cropDAO = CropDAO() imageVO = ImageVO() diseaseName = request.args.get('cropDisease') imageVO.cropDisease = diseaseName medicineVOList = medicineDAO.userViewMedicine(imageVO) cropTypeVOList = cropTypeDAO.viewCropType() cropVOList = cropDAO.viewCrop() print("=======MedicineVOList=======", medicineVOList) print("=======type of MedicineVOList=======", type(medicineVOList)) return render_template('user/viewDiseaseMedicine.html', cropTypeVOList=cropTypeVOList, cropVOList=cropVOList, medicineVOList=medicineVOList) elif adminLoginSession() == 'admin': return adminLogoutSession() except Exception as ex: print(ex)
def adminLoadCrop(): try: if adminLoginSession() == 'admin': cropTypeDAO = CropTypeDAO() cropTypeVOList = cropTypeDAO.viewCropType() return render_template('admin/addcrop.html', cropTypeVOList=cropTypeVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
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)
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 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)
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)
def adminEditCrop(): try: if adminLoginSession() == 'admin': cropVO = CropVO() cropDAO = CropDAO() cropTypeDAO = CropTypeDAO() cropId = request.args.get('cropId') cropVO.cropId = cropId cropVOList = cropDAO.editCrop(cropVO) cropTypeVOList = cropTypeDAO.viewCropType() print("=======CropVOList=======", cropVOList) print("=======type of CropVOList=======", type(cropVOList)) return render_template('admin/editCrop.html', cropTypeVOList=cropTypeVOList, cropVOList=cropVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
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)
def adminEditMedicine(): try: if adminLoginSession() == 'admin': medicineVO = MedicineVO() medicineDAO = MedicineDAO() cropTypeDAO = CropTypeDAO() cropDAO = CropDAO() medicineId = request.args.get('medicineId') medicineVO.medicineId = medicineId medicineVOList = medicineDAO.editMedicine(medicineVO) cropTypeVOList = cropTypeDAO.viewCropType() cropVOList = cropDAO.viewCrop() print("=======MedicineVOList=======", medicineVOList) print("=======type of MedicineVOList=======", type(medicineVOList)) return render_template('admin/editMedicine.html', cropTypeVOList=cropTypeVOList, cropVOList=cropVOList, medicineVOList=medicineVOList) elif adminLoginSession() == 'user': return adminLogoutSession() except Exception as ex: print(ex)