Exemplo n.º 1
0
def changeFactorStatus(DBConnection):
    if (not IsThereFactor(DBConnection)):
        aux_functions.showErrorMessage(3)
        return

    nameFactor = getsFactorNameChangeStatus(DBConnection)
    if (nameFactor == None):
        return
    status = bool(factorStatus(DBConnection, nameFactor))
    if (status):
        statusStr = ANSI_GREEN_INITIAL_CODE + VAL_ON_STATUS_FATOR + ANSI_DEFAULT_FINAL_COLOR_CODE
    else:
        statusStr = ANSI_RED_INITIAL_CODE + VAL_OFF_STATUS_FATOR + ANSI_DEFAULT_FINAL_COLOR_CODE

    print(PHROUT_CURRENT_VALUE_CHANGE_FACTOR_STATUS + statusStr)
    newStatus = getsNewStatusChangeStatus()
    newStatusStr = str(newStatus)
    if (status == newStatus):
        aux_functions.showErrorMessage(15)
        return

    cursor = DBConnection.cursor()
    cursor.execute("UPDATE FATOR SET STATUS = " + newStatusStr + " WHERE NOME = '" + nameFactor + "'")
    DBConnection.commit()
    aux_functions.showOkMessage(3)
Exemplo n.º 2
0
def handlesSelectedMainMenuOption(option, DBConnection):
    if (option == MAIN_MENU_NUM_OPTION1):
        sql_functions.InsertTupleTableFator(DBConnection)
        return
    if (option == MAIN_MENU_NUM_OPTION2):
        sql_functions.InsertTupleTablePeso(DBConnection)
        return
    if (option == MAIN_MENU_NUM_OPTION3):
        sql_functions.InsertTupleTableTime(DBConnection)
        return
    if (option == MAIN_MENU_NUM_OPTION4):
        sql_functions.changeFactorStatus(DBConnection)
        return
    if (option == MAIN_MENU_NUM_OPTION5):
        sql_functions.presentsAllFactors(DBConnection)
        return
    if (option == MAIN_MENU_NUM_OPTION6):
        sql_functions.presentsAllWeights(DBConnection)
        return
    if (option == MAIN_MENU_NUM_OPTION7):
        sql_functions.presentsAllTeams(DBConnection)
        return
    if (option == MAIN_MENU_NUM_OPTION8):
        return
    if (option == MAIN_MENU_NUM_OPTION9):
        aux_functions.showOkMessage(4)
        return

    aux_functions.showErrorMessage(1)
Exemplo n.º 3
0
def InsertTupleTableTime(DBConnection):
    name = ''
    name = getsAttributeNameNewTupleTableTime(DBConnection)
    if (name == None):
        return

    cursor = DBConnection.cursor()
    cursor.execute("INSERT INTO time(nome) VALUES ('" + name + "')")
    DBConnection.commit()
    aux_functions.showOkMessage(5)
Exemplo n.º 4
0
def InsertTupleTableFator(DBConnection):
    name = ''
    status = False
    factorType = ''
    name = getsAttributeNameNewTupleTableFator(DBConnection)
    if (name == None):
        return
    status = getsAttributeStatusNewTupleTableFator()
    factorType = getsAttributeTypeNewTupleTableFator()
    cursor = DBConnection.cursor()
    cursor.execute("INSERT INTO fator(nome, status, tipo) VALUES ('" + name + "', " + str(status) + ", '" + factorType + "')")
    DBConnection.commit()
    aux_functions.showOkMessage(1)
Exemplo n.º 5
0
def InsertTupleTablePeso(DBConnection):
    name = ''
    factorName = ''
    valor = 0.00

    if (not IsThereFactor(DBConnection)):
        aux_functions.showErrorMessage(3)
        return
    name = getsAttributeNameNewTupleTablePeso(DBConnection)
    if (name == None):
        return
    factorName = getsAttributeFactorNameNewTupleTablePeso(DBConnection)
    if (factorName == None):
        return
    valor = getsAttributeValueNewTupleTablePeso()
    if (valor == None):
        return

    cursor = DBConnection.cursor()
    cursor.execute("INSERT INTO peso(nome, nomefator, valor) VALUES ('" + name + "', '" + factorName + "', " + str(valor) + ")")
    DBConnection.commit()
    aux_functions.showOkMessage(2)