Ejemplo n.º 1
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)
Ejemplo n.º 2
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)
Ejemplo n.º 3
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 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':
            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 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")
Ejemplo n.º 7
0
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)