Esempio n. 1
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)
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)
Esempio n. 3
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)
Esempio n. 5
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)
Esempio n. 6
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)
def adminLoadReply():
    try:
        complainVO = ComplainVO()
        complainId = request.args.get("complainId")
        complainVO.complainId = complainId
        print("++++++++++++++++++++")
        return render_template('admin/addComplainReply.html',
                               complainId=complainVO.complainId)

    except Exception as ex:
        print(ex)
Esempio n. 8
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)
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)
Esempio n. 11
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 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)
Esempio n. 13
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)
Esempio n. 14
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)
Esempio n. 15
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)
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)
Esempio n. 17
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)
Esempio n. 18
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)
Esempio n. 19
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)
Esempio n. 20
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)
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)
Esempio n. 22
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)
def userViewComplain():
    try:
        if adminLoginSession() == 'user':
            complainVO = ComplainVO()
            complainDAO = ComplainDAO()

            complainVO.complainFrom_LoginId = session['session_loginId']

            complainList = complainDAO.viewComplain(complainVO)

            # print("__________________", complainVOList)

            return render_template('user/viewComplain.html',
                                   complainList=complainList)
        else:
            return redirect('/admin/logoutSession')
    except Exception as ex:
        print(ex)
def userviewComplainReply():
    try:
        if adminLoginSession() == 'user':
            complainDAO = ComplainDAO()
            complainVO = ComplainVO()

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

            complainVOList = complainDAO.viewComplainReply_User(complainVO)

            print("____________", complainVOList)
            return render_template('user/viewComplainReply.html', complainVOList=complainVOList)
        else:
            return adminLogoutSession()

    except Exception as ex:
        print(ex)
Esempio n. 26
0
def bloodbankViewUserComplaint():
    try:
        if adminLoginSession() == "bloodbank":
            complainDAO = ComplainDAO()
            complainVO = ComplainVO()

            complainStatus = "Pending"

            complainVO.complainStatus = complainStatus
            complainVOList = complainDAO.viewUserComplain(complainVO)
            print(complainVOList)

            return render_template('bloodbank/viewUserComplain.html',
                                   complainVOList=complainVOList)
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
Esempio n. 27
0
def userLoadComplaint():
    try:
        if adminLoginSession() == "user":
            #_____________________________________________COMPLAIN_________________________________________________
            complainDAO = ComplainDAO()
            complainVO = ComplainVO()

            complainVO.complainFrom_LoginId = session['session_loginId']

            complainVOList = complainDAO.viewComplain(complainVO)
            #_____________________________________________COMPLAIN_REPLY____________________________________________

            return render_template('user/addComplain.html',
                                   complainVOList=complainVOList)
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
def insertcomplain():

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

        # app.config['UPLOAD_FILE'] = 'C:/Users/RetailAdmin/PycharmProjects/hardik/project/static/adminResources/complaindataset/'
        #
        # file = request.files['complainImageName']

        complainDAO = ComplainDAO()

        complainVO = ComplainVO()

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

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

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

        complainVO.complainFrom_loginId = str(session['loginDictId'])

        complainVO.complainDate = str(datetime.today().strftime("%d-%m-%y"))

        complainVO.complainTime = str(datetime.today().hour) + ":" + str(
            datetime.now().minute)

        complainVO.complainStatus = 'Pending'

        complainVO.complainActiveStatus = 'Activate'

        # filename = secure_filename(file.filename)
        # file.save(app.config['UPLOAD_FILE'] + filename)
        #
        # filepath = os.path.join(app.config['UPLOAD_FILE'])
        #
        # complainVO.complainPath = filepath
        # complainVO.complainImageName = filename

        complainDAO.insertcomplain(complainVO)

        return render_template("seller/complain.html")

    else:

        return render_template("admin/login.html")
def userInsertComplain():
    try:
        if adminLoginSession() == 'user':
            complainDAO = ComplainDAO()
            complainVO = ComplainVO()

            complainSubject = request.form['complainSubject']
            complainDescription = request.form['complainDescription']

            complainDate = datetime.today().strftime("%d/%m/%Y")

            complainTime = datetime.now().strftime("%H:%M:%S")

            complainStatus = 'Pending'

            file = request.files['file']

            complainFileName = secure_filename(file.filename)

            complainFilePath = os.path.join(
                app.config['COMPLAIN_UPLOAD_FOLDER'])

            file.save(os.path.join(complainFilePath, complainFileName))

            complainFrom_LoginId = session['session_loginId']

            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.userInsertComplain(complainVO)

            return redirect(url_for('userViewComplain'))
        else:
            return adminLogoutSession()

    except Exception as ex:
        print(ex)
def userLoadDashboard():
    try:
        if adminLoginSession() == 'user':
            complainVO = ComplainVO()
            complainDAO = ComplainDAO()

            feedbackVO = FeedbackVO()
            feedbackDAO = FeedbackDAO()

            pendingComplainCount = 0
            repliedComplainCount = 0
            totalFeedbackCount = 0
            reviewFeedbackCount = 0

            loginId = session['session_loginId']
            complainVO.complainFrom_LoginId = loginId

            complainVOList = complainDAO.userViewComplain(complainVO)

            for i in complainVOList:
                if i.complainStatus == 'Pending':
                    pendingComplainCount += 1
                elif i.complainStatus == 'Replied':
                    repliedComplainCount += 1

            feedbackVO.feedbackFrom_LoginId = loginId
            feedbackVOList = feedbackDAO.userViewFeedback(feedbackVO)

            for i in feedbackVOList:
                if i.feedbackTo_LoginId is not None:
                    reviewFeedbackCount += 1
                totalFeedbackCount += 1

            return render_template('user/Index.html',
                                   pendingComplainCount=pendingComplainCount,
                                   repliedComplainCount=repliedComplainCount,
                                   totalFeedbackCount=totalFeedbackCount,
                                   reviewFeedbackCount=reviewFeedbackCount)
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)