示例#1
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 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")