def adminInsertMedicine(): try: if adminLoginSession() == 'admin': diseaseName = request.form['diseaseName'] diseaseCause = request.form['diseaseCause'] medicineName = request.form['medicineName'] medicine_CropTypeId = request.form['medicine_CropTypeId'] medicine_CropId = request.form['medicine_CropId'] medicineVO = MedicineVO() medicineDAO = MedicineDAO() medicineVO.diseaseName = diseaseName medicineVO.diseaseCause = diseaseCause medicineVO.medicineName = medicineName medicineVO.medicine_CropTypeId = medicine_CropTypeId medicineVO.medicine_CropId = medicine_CropId medicineDAO.insertMedicine(medicineVO) return redirect(url_for('adminViewMedicine')) elif adminLoginSession() == 'user': 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 adminDeleteDataset(): try: if adminLoginSession() == 'admin': datasetVO = DatasetVO() datasetDAO = DatasetDAO() datasetId = request.args.get('datasetId') datasetVO.datasetId = datasetId datasetList = datasetDAO.deleteDataset(datasetVO) print(datasetList) datasetFileName = datasetList.datasetFileName datasetFilePath = datasetList.datasetFilePath fullPath = datasetFilePath.replace('..', 'project') + datasetFileName os.remove(fullPath) return redirect(url_for('adminViewDataset')) elif adminLoginSession() == 'user': return adminLogoutSession() except Exception as ex: print(ex)
def adminDeleteComplain(): try: if adminLoginSession() == 'user': complainVO = ComplainVO() complainDAO = ComplainDAO() complainId = request.args.get('complainId') complainVO.complainId = complainId complainList = complainDAO.deleteComplain(complainVO) print(complainList) complainFileName = complainList.complainFileName complainFilePath = complainList.complainFilePath complainFullPath = complainFilePath.replace( '..', 'project') + complainFileName os.remove(complainFullPath) if complainList.complainStatus == "Replied": replyFilePath = complainList.replyFilePath replyFileName = complainList.replyFileName replyFullPath = replyFilePath.replace( "..", "project") + replyFileName os.remove(replyFullPath) return redirect(url_for('UserViewComplain')) elif adminLoginSession() == 'admin': pass except Exception as ex: print(ex)
def adminLoadDataset(): try: if adminLoginSession() == 'admin': return render_template('admin/addDataset.html') elif adminLoginSession() == 'user': return adminLogoutSession() except Exception as ex: print(ex)
def userLoadComplain(): try: if adminLoginSession() == 'user': return render_template('user/addComplain.html') elif adminLoginSession() == 'admin': pass except Exception as ex: print(ex)
def adminloadComplainReply(): try: if adminLoginSession() == 'admin': complainId = request.args.get('complainId') return render_template('admin/addComplainReply.html', complainId=complainId) elif adminLoginSession() == 'user': pass except Exception as ex: print(ex)
def adminLoadMedicine(): try: if adminLoginSession() == 'admin': cropTypeDAO = CropTypeDAO() cropTypeVOList = cropTypeDAO.viewCropType() return render_template('admin/addMedicine.html', cropTypeVOList=cropTypeVOList) elif adminLoginSession() == 'user': return adminLogoutSession() except Exception as ex: print(ex)
def adminViewMedicine(): try: if adminLoginSession() == 'admin': medicineDAO = MedicineDAO() medicineVOList = medicineDAO.viewMedicine() print("__________________", medicineVOList) return render_template('admin/viewMedicine.html', medicineVOList=medicineVOList) elif adminLoginSession() == 'user': return adminLogoutSession() except Exception as ex: print(ex)
def adminViewDataset(): try: if adminLoginSession() == 'admin': datasetDAO = DatasetDAO() datasetVOList = datasetDAO.viewDataset() return render_template('admin/viewDataset.html', datasetVOList=datasetVOList) elif adminLoginSession() == 'user': return adminLogoutSession() except Exception as ex: print(ex)
def UserViewComplain(): try: if adminLoginSession() == 'user': complainDAO = ComplainDAO() complainVO = ComplainVO() complainVO.complainFrom_LoginId = session['session_loginId'] complainVOlist = complainDAO.userViewComplain(complainVO) return render_template('user/viewComplain.html', complainVOlist=complainVOlist) elif adminLoginSession() == 'admin': pass except Exception as ex: print(ex)
def UserViewComplainReply(): try: if adminLoginSession() == 'user': complainVO = ComplainVO() complainDAO = ComplainDAO() complainId = request.args.get('complainId') complainVO.complainId = complainId # complainVO.complainFrom_LoginId = session['session_loginId'] replyVOList = complainDAO.viewComplainReply(complainVO) return render_template('user/viewComplainReply.html', replyVOList=replyVOList) elif adminLoginSession() == 'admin': pass except Exception as ex: print(ex)
def adminEditCamera(): try: if adminLoginSession() == 'admin': print('in adminEditCamera') cameraVO = CameraVO() cameraDAO = CameraDAO() cameraId = request.args.get('cameraId') cameraVO.cameraId = cameraId cameraVOList = cameraDAO.editCamera(cameraVO) areaDAO = AreaDAO() crossroadDAO = CrossroadDAO() areaVOList = areaDAO.viewArea() crossroadVOList = crossroadDAO.viewCrossroad() print("=======cameraVOList=======", cameraVOList, areaVOList, crossroadVOList) print("=======type of cameraVOList=======", type(cameraVOList)) return render_template('admin/editCamera.html', cameraVOList=cameraVOList, crossroadVOList=crossroadVOList, areaVOList=areaVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def userInsertFeedback(): try: if adminLoginSession() == 'user': feedbackSubject = request.form['feedbackSubject'] feedbackDescription = request.form['feedbackDescription'] feedbackRating = request.form['feedbackRating'] feedbackDate = date.today() feedbackTime = datetime.now().strftime("%H:%M:%S") feedbackFrom_LoginId = session['session_loginId'] feedbackVO = FeedbackVO() feedbackDAO = FeedbackDAO() feedbackVO.feedbackSubject = feedbackSubject feedbackVO.feedbackDescription = feedbackDescription feedbackVO.feedbackRating = feedbackRating feedbackVO.feedbackDate = feedbackDate feedbackVO.feedbackTime = feedbackTime feedbackVO.feedbackFrom_LoginId = feedbackFrom_LoginId feedbackDAO.insertFeedback(feedbackVO) return redirect(url_for('userViewFeedback')) else: return adminLogoutSession() except Exception as ex: print(ex)
def bloodbankInsertTimeSlot(): try: if adminLoginSession() == "bloodbank": timeSlotName = request.form['timeSlotName'] timeSlot = request.form['timeSlot'] timeSlotVO = TimeSlotVO() timeSlotDAO = TimeSlotDAO() loginId = session['session_loginId'] bloodBankVOList = timeSlotDAO.searchBloodBank(loginId) bloodbankDictList = [i.as_dict() for i in bloodBankVOList] timeSlot_BloodBankId = bloodbankDictList[0]["bloodBankId"] print(timeSlot_BloodBankId) timeSlotVO.timeSlotName = timeSlotName timeSlotVO.timeSlot = timeSlot timeSlotVO.timeSlot_BloodBankId = timeSlot_BloodBankId timeSlotDAO.insertTimeSlot(timeSlotVO) return redirect(url_for('bloodBankViewTimeSlot')) else: return adminLogoutSession() except Exception as ex: print(ex)
def userDeleteComplain(): try: if adminLoginSession() == 'user': complainVO = ComplainVO() complainDAO = ComplainDAO() complainId = request.args.get('complainId') complainVO.complainId = complainId complainList = complainDAO.userDeleteComplain(complainVO) if complainList.complainStatus == 'Replied': replyPath = complainList.replyFilePath.replace( "..", "project") + complainList.replyFileName os.remove(replyPath) complainPath = complainList.complainFilePath.replace( "..", "project") + complainList.complainFileName os.remove(complainPath) return redirect(url_for('userViewComplain')) else: return adminLogoutSession() except Exception as ex: print(ex)
def adminInsertDataset(): try: if adminLoginSession() == 'admin': datasetVO = DatasetVO() datasetDAO = DatasetDAO() file = request.files['file'] print(file) datasetFileName = secure_filename(file.filename) print(datasetFileName) datasetFilePath = os.path.join(app.config['UPLOAD_FOLDER']) print(datasetFilePath) file.save(os.path.join(datasetFilePath, datasetFileName)) datasetUploadDate = datetime.date(datetime.now()) datasetUploadTime = datetime.time(datetime.now()) datasetVO.datasetFileName = datasetFileName datasetVO.datasetFilePath = datasetFilePath.replace("project", "..") datasetVO.datasetUploadDate = datasetUploadDate datasetVO.datasetUploadTime = datasetUploadTime datasetDAO.insertDataset(datasetVO) return redirect(url_for('adminViewDataset')) else: return adminLogoutSession() except Exception as ex: print(ex)
def adminInsertCamera(): try: if adminLoginSession() == 'admin': print('inside cameraconroller') cameraCode = request.form['cameraCode'] camera_AreaId = request.form['camera_AreaId'] camera_CrossroadId = request.form['camera_CrossroadId'] print("++++++++++++++++", cameraCode, camera_AreaId, camera_CrossroadId) cameraVO = CameraVO() cameraDAO = CameraDAO() cameraVO.cameraCode = cameraCode cameraVO.camera_AreaId = camera_AreaId cameraVO.camera_CrossroadId = camera_CrossroadId print('dataset') cameraDAO.insertCamera(cameraVO) return redirect(url_for('adminViewCamera')) else: return adminLogoutSession() except Exception as ex: print(ex)
def userInsertPurchase(): try: if adminLoginSession() == 'user': purchase_LoginId = session.get('session_loginId') purchase_PackageId = request.args.get('packageId') purchaseDate = date.today() print(purchaseDate) purchaseTime = datetime.now().strftime("%H:%M:%S") print(purchaseTime) purchaseVO = PurchaseVO() purchaseDAO = PurchaseDAO() purchaseVO.purchaseDate = purchaseDate purchaseVO.purchaseTime = purchaseTime purchaseVO.purchase_LoginId = purchase_LoginId purchaseVO.purchase_PackageId = purchase_PackageId purchaseDAO.insertPurchase(purchaseVO) return redirect(url_for('userViewPurchase')) else: return redirect(url_for('adminLogoutSession')) except Exception as ex: print(ex)
def adminInsertCropMedicine(): try: if adminLoginSession() == 'admin': cropMedicineName = request.form['cropMedicineName'] cropMedicinePower = request.form['cropMedicinePower'] cropMedicineDescription = request.form['cropMedicineDescription'] cropMedicine_CropTypeId = request.form['cropMedicine_CropTypeId'] cropMedicine_CropNameId = request.form['cropMedicine_CropNameId'] cropMedicineVO = CropMedicineVO() cropMedicineDAO = CropMedicineDAO() cropMedicineVO.cropMedicineName = cropMedicineName cropMedicineVO.cropMedicinePower = cropMedicinePower cropMedicineVO.cropMedicineDescription = cropMedicineDescription cropMedicineVO.cropMedicine_CropTypeId = cropMedicine_CropTypeId cropMedicineVO.cropMedicine_CropNameId = cropMedicine_CropNameId cropMedicineDAO.insertCropMedicine(cropMedicineVO) return redirect(url_for('adminViewCropMedicine')) else: return adminLogoutSession() except Exception as ex: print(ex)
def bloodbankEditBloodQuantity(): try: if adminLoginSession() == "bloodbank": bloodQuantityVO = BloodQuantityVO() bloodQuantityDAO = BloodQuantityDAO() bloodGroupDAO = BloodGroupDAO() bloodQuantityId = request.args.get('bloodQuantityId') bloodQuantityVO.bloodQuantityId = bloodQuantityId bloodQuantityVOList = bloodQuantityDAO.editBloodQuantity( bloodQuantityVO) bloodGroupVOList = bloodGroupDAO.viewBloodGroup() return render_template('bloodbank/editBloodQuantity.html', bloodGroupVOList=bloodGroupVOList, bloodQuantityVOList=bloodQuantityVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def bloodbankUpdateBloodQuantity(): try: if adminLoginSession() == "bloodbank": bloodQuantity = request.form['bloodQuantity'] bloodQuantity_BloodGroupId = request.form[ 'bloodQuantity_BloodGroupId'] bloodQuantityId = request.form['bloodQuantityId'] bloodQuantityMonth = request.form['bloodQuantityMonth'] bloodQuantityYear = request.form['bloodQuantityYear'] bloodQuantityVO = BloodQuantityVO() bloodQuantityDAO = BloodQuantityDAO() bloodQuantityVO.bloodQuantityId = bloodQuantityId bloodQuantityVO.bloodQuantity = bloodQuantity bloodQuantityVO.bloodQuantity_BloodGroupId = bloodQuantity_BloodGroupId bloodQuantityVO.bloodQuantityMonth = bloodQuantityMonth bloodQuantityVO.bloodQuantityYear = bloodQuantityYear bloodQuantityDAO.updateBloodQuantity(bloodQuantityVO) return redirect(url_for('bloodbankViewBloodQuantity')) else: return adminLogoutSession() except Exception as ex: print(ex)
def adminUpdatePackage(): try: if adminLoginSession() == 'admin': packageId = request.form['packageId'] packageName = request.form['packageName'] packageDuration = request.form['packageDuration'] packagePrice = request.form['packagePrice'] packageVO = PackageVO() packageDAO = PackageDAO() packageVO.packageId = packageId packageVO.packageName = packageName packageVO.packageDuration = packageDuration packageVO.packagePrice = packagePrice packageDAO.updatePackage(packageVO) return redirect(url_for('adminViewPackage')) else: return adminLogoutSession() except Exception as ex: print(ex)
def userLoadAppointment(): try: if adminLoginSession() == "user": cityDAO = CityDAO() cityVOList = cityDAO.viewCity() areaDAO = AreaDAO() areaVOList = areaDAO.viewArea() bloodBankDAO = BloodBankDAO() bloodBankVOList = bloodBankDAO.viewAdminBloodBank() bloodGroupDAO = BloodGroupDAO() bloodGroupVOList = bloodGroupDAO.viewBloodGroup() timeSlotDAO = TimeSlotDAO() timeSlotVOList = timeSlotDAO.viewTimeSlot() return render_template('user/addAppointment.html', cityVOList=cityVOList, areaVOList=areaVOList, bloodBankVOList=bloodBankVOList, bloodGroupVOList=bloodGroupVOList, timeSlotVOList=timeSlotVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def bloodbankViewAppointment(): try: if adminLoginSession() == "bloodbank": appointmentVO = AppointmentVO() appointmentDAO = AppointmentDAO() bloodBankDAO = BloodBankDAO() loginId = session['session_loginId'] bloodBankVOList = bloodBankDAO.getBloodBank(loginId) bloodBankDictList = [i.as_dict() for i in bloodBankVOList] appointment_BloodBankId = bloodBankDictList[0]['bloodBankId'] appointmentVO.appointment_BloodBankId = appointment_BloodBankId print(appointment_BloodBankId) appointmentVOList = appointmentDAO.viewAppointmentByBloodBank( appointmentVO) print("11111111111111:", appointmentVOList) return render_template('bloodbank/viewAppointment.html', appointmentVOList=appointmentVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def adminEditPackage(): try: if adminLoginSession() == 'admin': packageVO = PackageVO() packageDAO = PackageDAO() packageId = request.args.get('packageId') print('packageId::', packageId) packageVO.packageId = packageId packageVOList = packageDAO.editPackage(packageVO) print("=======packageVOList=======", packageVOList) print("=======type of packageVOList=======", type(packageVOList)) return render_template('admin/editPackage.html', packageVOList=packageVOList) else: return adminLogoutSession() except Exception as ex: print(ex)
def adminInsertDataset(): try: if adminLoginSession() == 'admin': UPLOAD_FOLDER = 'project/static/adminResources/dataset/' # setting path of storage data app.config[ 'UPLOAD_FOLDER'] = UPLOAD_FOLDER # update config path of folder datasetVO = DatasetVO() datasetDAO = DatasetDAO() file = request.files['file'] # getting filename from addDataset datasetFilename = secure_filename(file.filename) datasetFilepath = os.path.join( app.config['UPLOAD_FOLDER']) # setting value in variable file.save(os.path.join(datasetFilepath, datasetFilename) ) # saving file in dataset folder with filename datasetVO.datasetFilename = datasetFilename # saving filename in database todayDate = date.today() datasetVO.uploadDate = todayDate # saving current date in database nowTime = datetime.now() datasetVO.uploadTime = nowTime.strftime( "%H:%M:%S") # saving current date in database filepath = datasetFilepath.replace("project", "..") datasetVO.datasetFilePath = str( filepath) # saving filepath in database datasetDAO.insertDataset(datasetVO) return redirect(url_for('adminViewDataset')) else: adminLogoutSession() except Exception as ex: print(ex)
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 userInsertDataset(file): try: if adminLoginSession() == 'user': datasetVO = DatasetVO() datasetDAO = DatasetDAO() file = file # getting filename from addDataset datasetFilename = secure_filename(file.filename) datasetFilepath = os.path.join( app.config['UPLOAD_FOLDER']) # setting value in variable file.save(os.path.join(datasetFilepath, datasetFilename)) datasetVO.datasetFilename = datasetFilename # saving filename in database todayDate = date.today() datasetVO.uploadDate = todayDate # saving current date in database nowTime = datetime.now() datasetVO.uploadTime = nowTime.strftime( "%H:%M:%S") # saving current date in database filepath = datasetFilepath.replace("project", "..") datasetVO.datasetFilePath = str( filepath) # saving filepath in database filepath = str(filepath) datasetDAO.insertDataset(datasetVO) return datasetFilename, filepath else: adminLogoutSession() except Exception as ex: print(ex)
def adminDeleteDataset(): try: if adminLoginSession() == 'admin': datasetVO = DatasetVO() datasetDAO = DatasetDAO() datasetId = request.args.get('datasetId') datasetVO.datasetId = datasetId datasetlist = datasetDAO.deleteDataset(datasetVO) path = datasetlist.datasetFilePath.replace( '..', 'project') + datasetlist.datasetFilename try: os.remove(path) except Exception as ex: print(ex) return redirect(url_for('adminViewDataset')) else: adminLogoutSession() except Exception as ex: print(ex)