Exemplo n.º 1
0
 def update_thing2(self, code_things, description, num1, num2, localizacao,
                   price, situation, state, note):
     try:
         sql = "UPDATE patr_bens SET pabe_num_patr1 = '" + str(
             num1
         ) + "', pabe_num_patr2 = '" + str(
             num2
         ) + "', pabe_descricao = '" + str(
             description
         ) + "', pabe_loca_id = '" + str(
             localizacao
         ) + "', pabe_valor = '" + str(
             price
         ) + "', pabe_dt_cadastro = CURRENT_TIMESTAMP(), pabe_situacao = '" + str(
             situation
         ) + "', pabe_estado = '" + str(
             state
         ) + "', pabe_observacao = '" + str(
             note
         ) + "', pabe_data_atualizacao = CURRENT_TIMESTAMP() WHERE pabe_id = '" + str(
             code_things) + "'"
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         conn.rollback()
         print(e)
         return False
     finally:
         conn.close_connection()
Exemplo n.º 2
0
 def update_thing_location(self, pabe_id, loca_id, user):
     try:
         sql = "UPDATE patr_bens_x_localizacao SET pblo_loca_id = '"+str(loca_id)+"', pblo_usua_id = '"+str(user)+"' WHERE pblo_pabe_id = "+pabe_id
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         print(e)
         conn.rollback()
         return False
     finally:
         conn.close_connection()
Exemplo n.º 3
0
 def insert_patr_bens_x_localizacao(self, pabe_id, loca_id, user):
     try:
         sql = "INSERT INTO patr_bens_x_localizacao (pblo_pabe_id, pblo_loca_id, pblo_usua_id) VALUES('"+str(pabe_id)+"', '"+str(loca_id)+"', '"+str(user)+"')"
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         print(e)
         conn.rollback()
         return False
     finally:
         conn.close_connection()
Exemplo n.º 4
0
 def delete_location(self, loca_id):
     try:
         sql = "UPDATE localizacao set loca_excluido = 1, loca_data_atualizacao = CURRENT_TIMESTAMP() WHERE loca_id =  " + str(
             loca_id)
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         conn.rollback()
         print(e)
         return False
     finally:
         conn.close_connection()
Exemplo n.º 5
0
 def active_things_by_num1(self, nr_things1):
     try:
         sql = "UPDATE patr_bens set pabe_etiqueta_ativa = 1, pabe_data_atualizacao = CURRENT_TIMESTAMP() WHERE pabe_num_patr1 = " + str(
             nr_things1)
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         print(e)
         conn.rollback()
         return False
     finally:
         conn.close_connection()
Exemplo n.º 6
0
 def insert_location(self, loca_room):
     conn = Connection()
     try:
         sql = "INSERT INTO localizacao (loca_sala) VALUES('" + str(
             loca_room) + "')"
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         conn.rollback()
         print(e)
         return False
     finally:
         conn.close_connection()
Exemplo n.º 7
0
 def edit_user(self, id, name, email, password, permission):
     try:
         sql = "UPDATE usuarios set usua_nome = '" + str(name) + "', usua_email = '" + str(
             email) + "', usua_senha='" + str(password) + "', usua_permissao = '" + str(
             permission) + "' WHERE usua_id =  " + str(id) + ""
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         conn.rollback()
         print(e)
         return False
     finally:
         conn.close_connection()
Exemplo n.º 8
0
 def insert_new_user(self, name, email, password, token, permission='3'):
     try:
         sql = "INSERT INTO usuarios (usua_nome, usua_email, usua_senha, usua_permissao, usua_token) VALUES('" + str(
             name) + "','" + str(email) + "','" + str(password) + "', '" + str(permission) + "','" + str(
             token) + "')"
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         conn.rollback()
         print(e)
         return False
     finally:
         conn.close_connection()
Exemplo n.º 9
0
 def update_thing(self, code_things, situation, state, note):
     try:
         sql = "UPDATE patr_bens SET pabe_situacao = '" + str(
             situation) + "', pabe_estado = '" + str(
                 state) + "', pabe_observacao = '" + str(
                     note) + "' WHERE pabe_id = " + code_things
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         print(e)
         conn.rollback()
         return False
     finally:
         conn.close_connection()
Exemplo n.º 10
0
 def edit_location(self, loca_id, loca_room):
     try:
         sql = "UPDATE localizacao set loca_sala = '" + str(
             loca_room
         ) + "', loca_data_atualizacao = CURRENT_TIMESTAMP() WHERE loca_id =  " + str(
             loca_id) + ""
         print(sql)
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         conn.rollback()
         print(e)
         return False
     finally:
         conn.close_connection()
Exemplo n.º 11
0
 def insert_new_thing(self, thingNum1, thingNum2, thingName, thingPrice,
                      thingSituation, thingCondition, thingObservation):
     try:
         sql = "INSERT INTO patr_bens (pabe_num_patr1, pabe_num_patr2, pabe_descricao, pabe_valor, pabe_dt_cadastro, pabe_situacao, pabe_estado, pabe_observacao, pabe_etiqueta_ativa) VALUES('" + str(
             thingNum1) + "','" + str(thingNum2) + "','" + str(
                 thingName) + "','" + str(
                     thingPrice) + "', CURRENT_TIMESTAMP() ,'" + str(
                         thingSituation) + "','" + str(
                             thingCondition) + "','" + str(
                                 thingObservation) + "', '0')"
         print(sql)
         conn = Connection()
         conn.execute_sql(sql)
         conn.commit()
         return True
     except Exception as e:
         conn.rollback()
         print(e)
         return False
     finally:
         conn.close_connection()