def complainReply(): if session['loginRole'] != 'admin': return redirect(url_for('login')) complainDAO = ComplainDAO() complainVO = ComplainVO() complainVO.complainStatus = 'replied' complainVO.complainReply = request.form['complainReply'] complainVO.complainTo_LoginId = session['loginId'] complainVO.complainId = request.form['complainId'] complainDAO.updateComplain(complainVO) return redirect(url_for('loadManageComplain'))
def adminInsertReply(): try: if adminLoginSession() == 'admin': complainId = request.form['complainId'] complainVO = ComplainVO() complainDAO = ComplainDAO() replysubject = request.form['replysubject'] replyDescription = request.form['replyDescription'] replyFile = request.files['replyFile'] uploadTime = datetime.now().strftime("%H:%M:%S") uploadDate = date.today() # settting path of admin reply attachment UPLOAD_FOLDER = 'project/static/userResources/reply/' # setting path of storage data app.config[ 'UPLOAD_FOLDER'] = UPLOAD_FOLDER # update config path of folder replyFilename = secure_filename(replyFile.filename) replyFilepath = os.path.join( app.config['UPLOAD_FOLDER']) # setting value in variable replyFile.save(os.path.join(replyFilepath, replyFilename)) replyFilepath = replyFilepath.replace("project", "..") complainVO.complainId = complainId complainVO.replysubject = replysubject complainVO.replyDescription = replyDescription complainVO.replyFilename = replyFilename complainVO.replyFilePath = replyFilepath complainVO.replyDate = uploadDate complainVO.replyTime = uploadTime complainVO.complainStatus = "replied" complainVO.complainTo_LoginId = session['session_LoginId'] complainDAO.updateComplain(complainVO) return redirect(url_for('adminViewComplain')) else: adminLogoutSession() except Exception as ex: print(ex)