Beispiel #1
0
def addProjectDetails():
    projectdata = json.loads(request.data)
    projectname = projectdata[0].get('projectname')
    clientname = projectdata[0].get('clientname')
    industrygroup = projectdata[0].get('industrygroup')
    worklocation = projectdata[0].get('worklocation')
    db = databases()
    return db.insertProjectDetails(projectname, clientname, industrygroup,
                                   worklocation, config)
Beispiel #2
0
def do_login(soc, data):  # 从客户端发送过来的name和code解析提交至数据库进行处理,如果与数据库匹配则返回相应的值。
    tem = data.decode().split(" ")
    key_1 = tem[1]
    key_2 = tem[2]
    db = databases(database='dict')  # 建立数据库对象,将name 和 code 交由数据库比对,给出比对结果。
    back_value = db.do_login(key_1, key_2)
    if back_value:
        soc.send(b"OK")
    else:
        soc.send(b"FAILURE")
Beispiel #3
0
def do_query(soc, data):
    name = data.decode().split(" ")[1]
    words = data.decode().split(" ")[2]
    db = databases(database='dict')
    # 设置返回值为单词解释或者是False
    back_value = db.do_query(name, words)
    if back_value:
        soc.send(back_value.encode())
    else:
        soc.send(b"False")
Beispiel #4
0
def do_register(soc, data):
    tem = data.decode().split(" ")
    key_1 = tem[1]
    key_2 = tem[2]
    db = databases(database='dict')
    back_value = db.do_register(key_1, key_2)
    print(back_value)
    if back_value == True:
        soc.send(B"OK")
    else:
        soc.send(B"failure")
Beispiel #5
0
def do_history(soc, data):
    name = data.decode().split(" ")[1]
    db = databases(database='dict')
    back_value = db.history(name)
    data_send = ""
    if back_value:
        for item in back_value:
            data_send += (item[0] + "*")
        soc.send(data_send.encode())
    else:
        soc.send(b"False")
Beispiel #6
0
def deleteProject():
    projectUUID = request.args.get('projectUUID')
    db = databases()
    return db.deleteProject(projectUUID, config)
Beispiel #7
0
def getCalculatedProjects():
    db = databases()
    return db.getCalculatedProjects(config)
Beispiel #8
0
def updateMetricValues():
    metricdata = json.loads(request.data, use_decimal=True)
    projectUUID = request.args.get('projectUUID')
    db = databases()
    db.updateMetricValues(metricdata, projectUUID, config)
    return "Helloooo"
Beispiel #9
0
def getMetricValues():
    projectUUID = request.args.get('projectUUID')
    db = databases()
    return db.getMetricValues(projectUUID, config)