예제 #1
0
def userLoadDashboard():
    try:
        if adminLoginSession() == 'user':
            pendingComplainCount = 0
            repliedComplainCount = 0

            loginID = session['session_loginId']
            complainDAO = ComplainDAO()

            complainList = complainDAO.viewComplain(loginID)
            print('complainList>>>>>', complainList)

            for i in complainList:
                if i.complainStatus == 'replied':
                    repliedComplainCount += 1
                elif i.complainStatus == 'Pending':
                    pendingComplainCount += 1

            feedbackVO = FeedbackVO()
            feedbackDAO = FeedbackDAO()
            feedbackVO.feedbackFrom_LoginId = loginID
            feedbackList = feedbackDAO.viewFeedback(feedbackVO)
            feedbackCount = len(feedbackList)

            return render_template('user/index.html',
                                   pendingComplainCount=pendingComplainCount,
                                   repliedComplainCount=repliedComplainCount,
                                   feedbackCount=feedbackCount)
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #2
0
def adminLoadDashboard():
    try:
        if adminLoginSession() == 'admin':
            complainCount = 0
            feedbackCount = 0
            userCount = 0

            complainDAO = ComplainDAO()
            complainList = complainDAO.complainCount()
            print('complainList>>>>>', complainList)
            complainCount = complainList[0][0]

            feedbackDAO = FeedbackDAO()
            feedbackList = feedbackDAO.adminViewFeedback()
            feedbackCount = len(feedbackList)

            registerDAO = RegisterDAO()
            registerList = registerDAO.viewRegister()
            userCount = len(registerList)

            return render_template('admin/index.html',
                                   complainCount=complainCount,
                                   feedbackCount=feedbackCount,
                                   userCount=userCount)
        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.deleteComplain(complainVO)
            complainFileName = complainList.complainFileName
            complainFilePath = complainList.complainFilePath

            complainFilePath = complainFilePath.replace('..', 'project') + complainFileName
            os.remove(complainFilePath)

            if complainList.replyFileName is not None:
                replyFilePath = complainList.replyFilePath.replace('..', 'project') + complainList.replyFileName
                os.remove(replyFilePath)

            return redirect(url_for('userviewComplain'))

        else:
            return adminLogoutSession()

    except Exception as ex:
        print(ex)
예제 #4
0
def bloodbankDeleteComplain():
    try:
        if adminLoginSession() == "bloodbank":
            complainDAO = ComplainDAO()

            complainVO = ComplainVO()

            complainId = request.args.get('complainId')

            complainVO.complainId = complainId
            print(complainId)

            complainList = complainDAO.deleteComplain(complainVO)

            complainFileName = complainList.complainFileName
            complainFilePath = complainList.complainFilePath

            path = complainFilePath.replace("..", "project") + complainFileName
            os.remove(path)

            if complainList.complainStatus == 'Replied':
                replyFileName = complainList.replyFileName
                replyFilePath = complainList.replyFilePath

                path = replyFilePath.replace("..", "project") + replyFileName
                os.remove(path)

            return redirect(url_for('bloodbankViewComplain'))

        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #5
0
def adminLoadDashboard():
    try:
        if adminLoginSession() == 'admin':
            feedbackDAO = FeedbackDAO()
            feedbackCount = feedbackDAO.adminFeedbackCount()

            complainDAO = ComplainDAO()
            complainCount = complainDAO.adminComplainCount()

            areaDAO = AreaDAO()
            areaCount = areaDAO.adminAreaCount()

            cameraDAO = CameraDAO()
            camaraCount = cameraDAO.adminCameraCount()

            trafficPoliceStationDAO = TrafficPoliceStationDAO()
            trafficPoliceStationVOList = trafficPoliceStationDAO.viewTrafficPoliceStation()
            print('TPSL >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ', trafficPoliceStationVOList)
            return render_template('admin/index.html', trafficPoliceStationVOList=trafficPoliceStationVOList,
                                   feedbackCount=feedbackCount,complainCount=complainCount, areaCount=areaCount,
                                   camaraCount=camaraCount)
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #6
0
def userDeleteComplain():
    try:
        if adminLoginSession() == 'user':
            complainVO = ComplainVO()
            complainDAO = ComplainDAO()

            complainId = request.args.get('complainId')
            complainVO.complainId = complainId
            complainVOList = complainDAO.viewComplain(complainVO)
            complainDictList = [i.as_dict() for i in complainVOList]
            complainFilePath = complainDictList[0]['complainFilePath']
            complainFilename = complainDictList[0]['complainFilename']
            replyFilePath = complainDictList[0]['replyFilePath']
            replyFilename = complainDictList[0]['replyFilename']

            try:
                path = complainFilePath.replace('..',
                                                'project') + complainFilename
                os.remove(path)
            except Exception as ex:
                print("complain file not deleted")

            try:
                path = replyFilePath.replace('..', 'project') + replyFilename
                os.remove(path)
            except Exception as ex:
                print("reply file not deleted")

            complainDAO.deleteComplain(complainVO)
            return redirect(url_for('userLoadComplain'))
        else:
            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)
예제 #8
0
def adminViewComplain():
    complainDAO = ComplainDAO()
    complainVO = ComplainVO()
    complainVO.complainTo_LoginId = session['session_LoginId']
    complainVOList = complainDAO.viewAdminComplain(complainVO)
    return render_template('admin/viewComplain.html',
                           complainVOList=complainVOList)
예제 #9
0
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)
예제 #10
0
def loadManageComplain():

    if session['loginRole']!= 'admin':
        return redirect(url_for('login'))

    complainDAO = ComplainDAO()

    complainDict = complainDAO.searchComplain()

    return render_template('admin/manageComplain.html',complainDict=complainDict)
예제 #11
0
def viewUserComplain():

    if session['loginRole']!= 'user':
        return redirect(url_for('login'))

    complainDAO = ComplainDAO()
    complainVO = ComplainVO()

    complainVO.complainFrom_LoginId = session['loginId']
    complainDict = complainDAO.searchComplainById(complainVO)

    return render_template('user/viewComplain.html',complainDict=complainDict)
예제 #12
0
def loadComplainReply():

    if session['loginRole']!= 'admin':
        return redirect(url_for('login'))

    complainDAO = ComplainDAO()
    complainVO = ComplainVO()

    complainVO.complainId = request.args.get('complainId')

    complainDict = complainDAO.editComplain(complainVO)

    return render_template('admin/complainReply.html',complainDict=complainDict)
def deleteComplain():

    if session['loginDictrole'] == "seller":

        complainDAO = ComplainDAO()

        complainVO = ComplainVO()

        complainVO.complainId = request.form['complainId']

        complainDAO.deleteComplain(complainVO)

        return redirect('/viewcomplain')
def loadReplyComplain():

    if session['loginDictrole'] == 'admin':

        complainDAO = ComplainDAO()

        complainVO = ComplainVO()

        complainVO.complainId = str(request.args.get('complainId'))

        complainDict = complainDAO.searchreplycomplain(complainVO)

        return render_template("admin/reply.html", complainDict1=complainDict)
예제 #15
0
def adminViewComplain():
    try:
        if adminLoginSession() == 'admin':
            complainVO = ComplainVO()
            complainDAO = ComplainDAO()
            complainVO.complainStatus = "pending"
            complainVOList = complainDAO.adminViewComplain(complainVO)
            return render_template('admin/viewComplain.html',
                                   complainVOList=complainVOList)

        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #16
0
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 userViewComplain():
    try:
        if adminLoginSession() == "user":
            complainDAO = ComplainDAO()
            complainVO = ComplainVO()
            complainFrom_LoginId = session['session_loginId']
            complainVO.complainFrom_LoginId = complainFrom_LoginId
            complainVOList = complainDAO.userViewComplain(complainVO)
            return render_template('user/viewComplain.html',
                                   complainVOList=complainVOList)
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #18
0
def userLoadComplain():
    try:
        if adminLoginSession() == 'user':
            complainDAO = ComplainDAO()
            complainVO = ComplainVO()
            complainVO.complainFrom_LoginId = session['session_LoginId']
            complainVOList = complainDAO.viewUserComplain(complainVO)

            return render_template('user/addComplain.html',
                                   complainVOList=complainVOList)

        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
def userViewComplainReplay():
    try:
        if adminLoginSession() == "user":
            complainDAO = ComplainDAO()
            complainVO = ComplainVO()
            complainId = request.args.get('complainId')
            complainVO.complainId = complainId
            complainVOList = complainDAO.userViewComplainReply(complainVO)
            print(complainVOList)
            return render_template("user/viewComplainReply.html",
                                   complainVOList=complainVOList)
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #20
0
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)
예제 #21
0
def userViewReply():
    try:
        if adminLoginSession() == 'user':
            complainDAO = ComplainDAO()
            complainVO = ComplainVO()
            complainId = request.args.get('complainId')
            complainVO.complainId = complainId
            replyVOList = complainDAO.viewComplain(complainVO)

            return render_template('user/viewReply.html',
                                   replyVOList=replyVOList)
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #22
0
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)
예제 #23
0
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 adminViewComplain():
    try:
        if adminLoginSession() == 'admin':

            complainDAO = ComplainDAO()

            complainList = complainDAO.adminViewComplain()

            # print("__________________", complainVOList)
            return render_template('admin/viewComplain.html',
                                   complainList=complainList)

        else:
            return redirect('/admin/logoutSession')
    except Exception as ex:
        print(ex)
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 admininsertComplainReply():
    try:
        if adminLoginSession() == 'admin':

            complainVO = ComplainVO()
            complainDAO = ComplainDAO()

            complainId = request.form['complainId']
            replySubject = request.form['replySubject']
            replyMessage = request.form['replyMessage']
            complainStatus = 'REPLIED'
            complainTo_LoginId = session['session_loginId']

            file = request.files['reply']
            print(file)

            replyFileName = secure_filename(file.filename)
            print(replyFileName)

            replyFilePath = os.path.join(app.config['UPLOAD_FOLDER_REPLY'])
            print(replyFilePath)

            file.save(os.path.join(replyFilePath, replyFileName))

            replyDate = datetime.date(datetime.now())
            replyTime = datetime.time(datetime.now())

            complainVO.complainId = complainId
            complainVO.replySubject = replySubject
            complainVO.replyMessage = replyMessage
            complainVO.replyFileName = replyFileName
            complainVO.replyFilePath = replyFilePath.replace("project", "..")
            complainVO.complainStatus = complainStatus
            complainVO.replyDate = replyDate
            complainVO.replyTime = replyTime

            complainVO.complainTo_LoginId = complainTo_LoginId

            complainDAO.insertComplainReply_Admin(complainVO)

            return redirect(url_for('adminviewComplain'))

        else:
            return adminLogoutSession()

    except Exception as ex:
        print(ex)
예제 #27
0
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 userViewComplainReply():
    try:
        if adminLoginSession() == 'user':
            complainVO = ComplainVO()
            complainDAO = ComplainDAO()

            complainId = request.args.get("complainId")

            complainVO.complainId = complainId
            complainReplyList = complainDAO.viewComplainReply(complainVO)

            return render_template("user/viewComplainReply.html",
                                   complainReplyList=complainReplyList)
        else:
            return redirect('/admin/logoutSession')
    except Exception as ex:
        print(ex)
예제 #29
0
def adminInsertComplainReply():
    try:
        if adminLoginSession() == 'admin':
            UPLOAD_FOLDER = 'project/static/adminResources/complainReply/'
            app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER

            complainId = request.form['complainId']
            replySubject = request.form['replySubject']
            replyMessage = request.form['replyMessage']
            file = request.files['replyFile']

            now = datetime.now()
            replyDate = now.strftime("%d/%m/%Y")
            replyTime = now.strftime("%H:%M:%S")

            complainDAO = ComplainDAO()
            complainVO = ComplainVO()
            print(file)

            replyFileName = secure_filename(file.filename)
            print(replyFileName)

            replyFilePath = os.path.join(app.config['UPLOAD_FOLDER'])
            print(replyFilePath)

            file.save(os.path.join(replyFilePath, replyFileName))

            complainVO.complainId = complainId
            complainVO.replySubject = replySubject
            complainVO.replyMessage = replyMessage
            complainVO.replyDate = replyDate
            complainVO.replyTime = replyTime
            complainVO.replyFileName = replyFileName
            complainVO.replyFilePath = replyFilePath.replace("project", "..")
            complainVO.complainStatus = "Replied"

            print("just before admin's complain reply insert")
            complainDAO.adminInsertComplain(complainVO)

            return redirect(url_for('adminViewComplain'))

        elif adminLoginSession() == 'user':
            pass
    except Exception as ex:
        print(ex)
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)