Exemple #1
0
def add(req, data):
    matricula = {
        'idAluno': data.get('idAluno'),
        'idTurma': data.get('idTurma')
    }
    dao = DAOMatricula()
    conn = Connector()
    req.sendJSON(dao.add(conn, matricula))


add_POST('/matricula/add', add)


def list(req, data):
    dao = DAOMatricula()
    conn = Connector()
    req.sendJSON(dao.list(conn))


add_GET('/matricula/list', list)


def remove(req, data):
    id = data.get('id')
    dao = DAOMatricula()
    conn = Connector()
    req.sendJSON(dao.remove(conn, id))


add_POST('/matricula/remove', remove)
Exemple #2
0
from connector import Connector
from src.avaliacao.dao import DAOAvaliacao
from server import add_POST, add_GET


def add(req, data):
    avaliacao = {
        'nome': data.get('nome'),
        'nota': data.get('nota'),
        'idTurma': data.get('idTurma')
    }
    dao = DAOAvaliacao()
    conn = Connector()
    req.sendJSON(dao.add(conn, avaliacao))


add_POST('/avaliacao/add', add)


def list(req, data):
    idTurma = data.get('idTurma')
    dao = DAOAvaliacao()
    conn = Connector()
    if idTurma != None:
        req.sendJSON(dao.listByTurma(conn, idTurma))
    else:
        req.sendJSON(dao.list(conn))


add_GET('/avaliacao/list', list)
Exemple #3
0
	conn = Connector()
	dao = DAOTurma()
	req.sendJSON(dao.add(conn, turma))
add_POST('/turma/add', add)

def update(req, data):
	turma = {
		'id': data.get('id'),
		'nome': data.get('nome'),
		'idDisciplina': data.get('idDisciplina')
	}
	DAOTurma().update(Connector(), turma)
	req.sendJSON(True)
add_POST('/turma/update', update)

def list(req, data):
	conn = Connector()
	dao = DAOTurma()
	req.sendJSON(dao.list(conn))
add_GET('/turma/list', list)

def get(req, data):
	id = data.get('id')
	req.sendJSON(DAOTurma().get(Connector(), id))
add_GET('/turma/get', get)

def remove(req, data):
	id = data.get('id')
	DAOTurma().remove(Connector(), id)
	req.sendJSON(True)
add_POST('/turma/remove', remove)
Exemple #4
0

def list(req, data):

    idAvaliacao = data.get('idAvaliacao')

    conn = Connector()
    dao = DAONota()

    if idAvaliacao != None:
        req.sendJSON(dao.listByAvaliacao(conn, idAvaliacao))
    else:
        req.sendJSON(dao.list(conn))


add_GET('/nota/list', list)

# def get(req, data):
# 	id = data.get('id')
# 	req.sendJSON(DAONota().get(Connector(), id))
# add_GET('/nota/get', get)

# def update(req, data):
# 	nota = {
# 		'id': data.get('id'),
# 		'nome': data.get('nome')
# 	}
# 	dao = DAONota()
# 	conn = Connector()
# 	req.sendJSON(dao.update(conn, nota))
# add_POST('/nota/update', update)
Exemple #5
0
    curso = {'nome': data.get('nome')}
    conn = Connector()
    dao = DAOCurso()
    req.sendJSON(dao.add(conn, curso))


add_POST('/curso/add', add)


def list(req, data):
    conn = Connector()
    dao = DAOCurso()
    req.sendJSON(dao.list(conn))


add_GET('/curso/list', list)


def get(req, data):
    id = data.get('id')
    req.sendJSON(DAOCurso().get(Connector(), id))


add_GET('/curso/get', get)


def update(req, data):
    curso = {'id': data.get('id'), 'nome': data.get('nome')}
    dao = DAOCurso()
    conn = Connector()
    req.sendJSON(dao.update(conn, curso))
Exemple #6
0
    dao.add(conn, frequencias)
    req.sendJSON(True)


add_POST('/frequencia/add', add)


def parseData(rows):
    for row in rows:
        row['data'] = str(row['data'])
    return rows


def list(req, args):

    dao = DAOFrequencia()
    conn = Connector()

    data = args.get('data')
    idTurma = args.get('idTurma')

    if (data != None) and (idTurma != None):
        rows = dao.listByTurmaData(conn, idTurma, data)
        req.sendJSON(parseData(rows))
    else:
        req.sendJSON(False)


add_GET('/frequencia/list', list)
Exemple #7
0
    dao = DAOAluno()
    conn = Connector()
    idCurso = data.get('idCurso')
    idTurma = data.get('idTurma')
    idDisciplina = data.get('idDisciplina')
    if (idCurso != None):
        req.sendJSON(dao.listByCurso(conn, idCurso))
    elif (idTurma != None):
        req.sendJSON(dao.listByTurma(conn, idTurma))
    elif (idDisciplina != None):
        req.sendJSON(dao.listByDisciplina(conn, idDisciplina))
    else:
        req.sendJSON(dao.list(conn))


add_GET('/aluno/list', list)


def get(req, data):
    id = data.get('id')
    print(id)
    req.sendJSON(DAOAluno().get(Connector(), id))


add_GET('/aluno/get', get)


def update(req, data):
    aluno = {
        'id': data.get('id'),
        'nome': data.get('nome'),
Exemple #8
0
add_POST('/disciplina/update', update)


def list(req, data):
    conn = Connector()
    dao = DAODisciplina()
    idCurso = data.get('idCurso')
    if (idCurso == None):
        array = dao.list(conn)
    else:
        array = dao.listByCurso(conn, idCurso)
    req.sendJSON(array)


add_GET('/disciplina/list', list)


def get(req, data):
    id = data.get('id')
    req.sendJSON(DAODisciplina().get(Connector(), id))


add_GET('/disciplina/get', get)


def remove(req, data):
    id = data.get('id')
    DAODisciplina().remove(Connector(), id)
    req.sendJSON(True)