예제 #1
0
def adminDeleteDataset():
    try:
        if adminLoginSession() == 'admin':
            datasetVO = DatasetVO()

            datasetDAO = DatasetDAO()

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

            datasetVO.datasetId = datasetId

            datasetlist = datasetDAO.deleteDataset(datasetVO)

            path = datasetlist.datasetFilePath.replace(
                '..', 'project') + datasetlist.datasetFilename
            try:
                os.remove(path)
            except Exception as ex:
                print(ex)

            return redirect(url_for('adminViewDataset'))
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
def adminDeleteDataset():
    try:
        if adminLoginSession() == 'admin':
            datasetVO = DatasetVO()

            datasetDAO = DatasetDAO()

            datasetId = request.args.get('datasetId')
            datasetFileName = request.args.get('datasetFileName')

            print(datasetFileName)

            datasetVO.datasetId = datasetId
            datasetVO.datasetFileName = datasetFileName

            os.remove(
                os.path.join(app.config['UPLOAD_FOLDER'], datasetFileName))
            datasetDAO.deleteDataset(datasetVO)

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

    except Exception as ex:
        print(ex)
예제 #3
0
def adminDeleteDataset():
    try:
        if adminLoginSession() == 'admin':
            datasetVO = DatasetVO()

            datasetDAO = DatasetDAO()

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

            datasetVO.datasetId = datasetId
            datasetList = datasetDAO.deleteDataset(datasetVO)

            print(datasetList)

            datasetFileName = datasetList.datasetFileName
            datasetFilePath = datasetList.datasetFilePath

            fullPath = datasetFilePath.replace('..',
                                               'project') + datasetFileName
            os.remove(fullPath)

            return redirect(url_for('adminViewDataset'))
        elif adminLoginSession() == 'user':
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #4
0
def adminDeleteDataset():
    try:
        if adminLoginSession() == "admin":
            datasetVO = DatasetVO()

            datasetDAO = DatasetDAO()

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

            datasetVO.datasetId = datasetId

            datasetList = datasetDAO.deleteDataset(datasetVO)

            datasetFileName = datasetList.datasetFileName
            datasetFilePath = datasetList.datasetFilePath

            path = datasetFilePath.replace("..", "project") + datasetFileName

            os.remove(path)

            return redirect(url_for('adminViewDataset'))
        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
def deleteDataset():

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

    datasetVO = DatasetVO()
    datasetDAO = DatasetDAO()
    datasetVO.datasetId = request.args.get('datasetId')
    datasetVO.datasetActiveStatus = 'deactive'
    datasetDAO.deleteDataset(datasetVO)

    return redirect(url_for('viewDataset'))
def deleteDataSet():

    try:
        if session['loginRole'] == 'admin':
            datasetVO = DatasetVO()
            datasetDAO = DatasetDAO()
            datasetVO.datasetId = request.args.get('datasetId')
            datasetVO.datasetActiveStatus = 'deactive'
            datasetDAO.deleteDataset(datasetVO)
            return redirect(url_for('viewDataset'))
        else:
            return render_template('admin/login.html')
    except:
        return render_template('admin/login.html')
예제 #7
0
def deleteDataset():
    try:
        if session['sessionloginDict']['loginRole'] == 'admin':
            datasetDAO=DatasetDAO()
            datasetVO=DatasetVO()
            datasetVO.datasetId=request.args.get('datasetId')
            datasetVO.datasetActiveStatus="deactive"
            datasetDAO.deleteDataset(datasetVO)
            return redirect(url_for("viewDataset"))
        else:
            flash('you are not admin !, Please Login as Admin. ', 'danger')
            return redirect(url_for('loadLogin'))
    except:
        flash('Plese Login First !', 'danger')
        return redirect(url_for('loadLogin'))
def adminDeleteDataset():
    try:
        if adminLoginSession() == 'admin':
            datasetVO = DatasetVO()

            datasetDAO = DatasetDAO()

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

            print('datasetId::', datasetId)

            datasetVO.datasetId = datasetId

            datasetDAO.deleteDataset(datasetVO)

            return redirect(url_for('adminViewDataset'))

        else:
            return adminLogoutSession()
    except Exception as ex:
        print(ex)
def insertDataset():

    try:
        if session['loginRole'] == 'admin':
            datasetVO = DatasetVO()
            datasetDAO = DatasetDAO()
            UPLOAD_FOLDER = 'C:/project/admin/project/static/adminResources/dataset'

            app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER

            file = request.files['datasetFile']

            filename = secure_filename(file.filename)

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

            file.save(os.path.join(app.config['UPLOAD_FOLDER'], filename))
            datasetVO.datasetFilename = filename
            datasetVO.datasetFilepath = filepath
            datasetVO.datasetDescription = request.form['datasetDescription']
            datasetVO.datasetActiveStatus = 'active'

            datasetDAO.insertDataset(datasetVO)
            return render_template('admin/addDataset.html')
        else:
            return render_template('admin/login.html')
    except:
        return render_template('admin/login.html')
def adminInsertDataset():
    try:
        if adminLoginSession() == 'admin':
            datasetVO = DatasetVO()
            datasetDAO = DatasetDAO()

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

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

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

            file.save(os.path.join(datasetFilePath, datasetFileName))

            datasetUploadDate = datetime.date(datetime.now())
            datasetUploadTime = datetime.time(datetime.now())

            datasetVO.datasetFileName = datasetFileName
            datasetVO.datasetFilePath = datasetFilePath.replace("project", "..")

            datasetVO.datasetUploadDate = datasetUploadDate
            datasetVO.datasetUploadTime = datasetUploadTime

            datasetDAO.insertDataset(datasetVO)

            return redirect(url_for('adminViewDataset'))

        else:
            return adminLogoutSession()

    except Exception as ex:
        print(ex)
예제 #11
0
def adminInsertDataset():
    try:
        if adminLoginSession() == 'admin':

            UPLOAD_FOLDER = 'project/static/adminResources/dataset/'  # setting path of storage data
            app.config[
                'UPLOAD_FOLDER'] = UPLOAD_FOLDER  # update config path of folder
            datasetVO = DatasetVO()
            datasetDAO = DatasetDAO()

            file = request.files['file']  # getting filename from addDataset
            datasetFilename = secure_filename(file.filename)
            datasetFilepath = os.path.join(
                app.config['UPLOAD_FOLDER'])  # setting value in variable
            file.save(os.path.join(datasetFilepath, datasetFilename)
                      )  # saving file in dataset folder with filename

            datasetVO.datasetFilename = datasetFilename  # saving filename in database
            todayDate = date.today()
            datasetVO.uploadDate = todayDate  # saving current date in database
            nowTime = datetime.now()
            datasetVO.uploadTime = nowTime.strftime(
                "%H:%M:%S")  # saving current date in database
            filepath = datasetFilepath.replace("project", "..")
            datasetVO.datasetFilePath = str(
                filepath)  # saving filepath in database

            datasetDAO.insertDataset(datasetVO)

            return redirect(url_for('adminViewDataset'))
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #12
0
def userInsertDataset(file):
    try:
        if adminLoginSession() == 'user':
            datasetVO = DatasetVO()
            datasetDAO = DatasetDAO()

            file = file  # getting filename from addDataset
            datasetFilename = secure_filename(file.filename)
            datasetFilepath = os.path.join(
                app.config['UPLOAD_FOLDER'])  # setting value in variable
            file.save(os.path.join(datasetFilepath, datasetFilename))

            datasetVO.datasetFilename = datasetFilename  # saving filename in database
            todayDate = date.today()
            datasetVO.uploadDate = todayDate  # saving current date in database
            nowTime = datetime.now()
            datasetVO.uploadTime = nowTime.strftime(
                "%H:%M:%S")  # saving current date in database
            filepath = datasetFilepath.replace("project", "..")
            datasetVO.datasetFilePath = str(
                filepath)  # saving filepath in database
            filepath = str(filepath)

            datasetDAO.insertDataset(datasetVO)
            return datasetFilename, filepath
        else:
            adminLogoutSession()
    except Exception as ex:
        print(ex)
예제 #13
0
def insertDataset():
    try:
        if session['sessionloginDict']['loginRole'] == 'admin':
            datasetDAO=DatasetDAO()
            datasetVO=DatasetVO()

            UPLOAD_FOLDER = r'C:\Users\User\PycharmProjects\gbsc\project\static\dataset'
            app.config['UPLOAD_FOLDER'] = UPLOAD_FOLDER

            print("kreykfjsdkmlerksd.j,m")
            file = request.files['datasetFile']


            print(file)
            datasetVO.datasetName = secure_filename(file.filename)

            datasetVO.datasetPath = os.path.join(app.config['UPLOAD_FOLDER'])

            file.save(os.path.join(app.config['UPLOAD_FOLDER'],datasetVO.datasetName))
            datasetVO.datasetDescription = request.form['datasetDescription']
            datasetVO.datasetActiveStatus='active'
            datasetDAO.insertDataset(datasetVO)

            return  render_template("admin/addDataset.html")
        else:
            flash('you are not admin !, Please Login as Admin. ', 'danger')
            return redirect(url_for('loadLogin'))
    except:
        flash('Plese Login First !', 'danger')
        return redirect(url_for('loadLogin'))
예제 #14
0
def viewDataset():
    try:
        if session['sessionloginDict']['loginRole'] == 'admin':
            datasetDAO=DatasetDAO()
            datasetVO=DatasetVO()
            datasetDict=datasetDAO.viewDataset(datasetVO)
            return render_template('admin/viewDataset.html',datasetDict=datasetDict)
        else:
            flash('you are not admin !, Please Login as Admin. ', 'danger')
            return redirect(url_for('loadLogin'))
    except:
        flash('Plese Login First !', 'danger')
        return redirect(url_for('loadLogin'))