def UserInsertComplain(): try: if adminLoginSession() == 'user': UPLOAD_FOLDER = 'project/static/adminResources/complain/' app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER complainSubject = request.form['complainSubject'] complainDescription = request.form['complainDescription'] file = request.files['complainFile'] now = datetime.now() complainDate = now.strftime("%d/%m/%Y") complainTime = now.strftime("%H:%M:%S") complainStatus = 'Pending' complainDAO = ComplainDAO() complainVO = ComplainVO() print(file) complainFileName = secure_filename(file.filename) print(complainFileName) complainFilePath = os.path.join(app.config['UPLOAD_FOLDER']) print(complainFilePath) file.save(os.path.join(complainFilePath, complainFileName)) complainVO.complainSubject = complainSubject complainVO.complainDescription = complainDescription complainVO.complainDate = complainDate complainVO.complainTime = complainTime complainVO.complainFileName = complainFileName complainVO.complainFilePath = complainFilePath.replace( "project", "..") complainVO.complainStatus = complainStatus complainVO.complainFrom_LoginId = session['session_loginId'] # print("just before insert") complainDAO.insertComplain(complainVO) return redirect(url_for('UserViewComplain')) else: return adminLogoutSession() except Exception as ex: print(ex)
def userInsertComplain(): try: if adminLoginSession() == "user": complainVO = ComplainVO() complainDAO = ComplainDAO() complainSubject = request.form['complainSubject'] complainDescription = request.form['complainDescription'] file = request.files['file'] print(file) complainFileName = secure_filename(file.filename) print(complainFileName) complainFilePath = os.path.join( app.config['UPLOAD_FOLDER_USER_COMPLAIN']) print(complainFilePath) now = datetime.now() complainDate = now.strftime("%d/%m/%Y") complainTime = now.strftime("%H:%M:%S") file.save(os.path.join(complainFilePath, complainFileName)) complainVO.complainSubject = complainSubject complainVO.complainDescription = complainDescription complainVO.complainFileName = complainFileName complainVO.complainFilePath = complainFilePath.replace( "project", "..") complainVO.complainDate = complainDate complainVO.complainTime = complainTime complainVO.complainStatus = 'Pending' complainVO.complainFrom_LoginId = session['session_loginId'] complainDAO.insertComplain(complainVO) return redirect(url_for('userLoadComplaint')) else: return adminLogoutSession() except Exception as ex: print(ex)
def insertComplain(): if session['loginRole'] != 'user': return redirect(url_for('login')) complainDAO = ComplainDAO() complainVO = ComplainVO() complainVO.complainSubject = request.form['complainSubject'] complainVO.complainDescription = request.form['complainDescription'] complainVO.complainDate, complainVO.complainTime = str(datetime.now()).split(' ') complainVO.complainStatus = 'pending' complainVO.complainActiveStatus = 'active' complainVO.complainFrom_LoginId = session['loginId'] complainDAO.insertComplain(complainVO) return redirect(url_for('complain'))
def userinsertComplain(): try: if adminLoginSession() == 'user': complainVO = ComplainVO() complainDAO = ComplainDAO() complainSubject = request.form['complainSubject'] complainDescription = request.form['complainDescription'] complainFrom_LoginId = session['session_loginId'] file = request.files['file'] print(file) complainFileName = secure_filename(file.filename) print(complainFileName) complainFilePath = os.path.join(app.config['UPLOAD_FOLDER_COMPLAIN']) print(complainFilePath) file.save(os.path.join(complainFilePath, complainFileName)) complainDate = datetime.date(datetime.now()) complainTime = datetime.time(datetime.now()) complainStatus = 'PENDING' complainVO.complainSubject = complainSubject complainVO.complainDescription = complainDescription complainVO.complainDate = complainDate complainVO.complainTime = complainTime complainVO.complainStatus = complainStatus complainVO.complainFileName = complainFileName complainVO.complainFilePath = complainFilePath.replace("project", "..") complainVO.complainFrom_LoginId = complainFrom_LoginId complainDAO.insertComplain(complainVO) return redirect(url_for('userviewComplain')) else: return adminLogoutSession() except Exception as ex: print(ex)
def userInsertComplain(): try: if adminLoginSession() == 'user': complainVO = ComplainVO() complainDAO = ComplainDAO() complainSubject = request.form['complainSubject'] complainDescription = request.form['complainDescription'] complainFile = request.files['complainFile'] uploadTime = datetime.now().strftime("%H:%M:%S") uploadDate = date.today() # setting complain attachment folder UPLOAD_FOLDER = 'project/static/userResources/complain/' # setting path of storage data app.config[ 'UPLOAD_FOLDER'] = UPLOAD_FOLDER # update config path of folder complainFilename = secure_filename(complainFile.filename) complainFilePath = os.path.join( app.config['UPLOAD_FOLDER']) # setting value in variable complainFile.save(os.path.join(complainFilePath, complainFilename)) complainFilePath = complainFilePath.replace("project", "..") complainVO.complainSubject = complainSubject complainVO.complainDescription = complainDescription complainVO.complainFilename = complainFilename complainVO.complainFilePath = str(complainFilePath) complainVO.complainDate = uploadDate complainVO.complainTime = uploadTime complainVO.complainStatus = 'pending' complainVO.complainFrom_LoginId = session['session_LoginId'] complainDAO.insertComplain(complainVO) return redirect(url_for('userLoadComplain')) else: adminLogoutSession() except Exception as ex: print(ex)