Commit fa168750 authored by Evenson Jeunesse's avatar Evenson Jeunesse
Browse files

Update prog.py

parent bb18f71e
......@@ -212,15 +212,20 @@ def updatePersonnel(idPersonnel, nom, prenom, dateNaissance, adresse, telephone,
print("An error occurs, please try again...")
return False
def updateAnimal(idAnimal, nom, dernierPoids, dernierTaille, dateNaissance, espece) :
sql = "UPDATE Animaux SET nom='{}', dernierPoids={}, derniereTaille={}, date_naissance={}, espece='{}' WHERE id={}".format(nom, dernierPoids, dernierTaille, dateNaissance, espece, idAnimal)
def updateAnimal(idAnimal, nom='nom', dernierPoids='dernierPoids', derniereTaille='derniereTaille', dateNaissance='date_naissance', espece='espece') :
if nom != 'nom':
nom = "'"+nom+"'"
if espece != 'espece':
espece = "'"+espece+"'"
sql = "UPDATE Animaux SET nom={}, dernierPoids={}, derniereTaille={}, date_naissance={}, espece={} WHERE id={}".format(nom, dernierPoids, derniereTaille, dateNaissance, espece, idAnimal)
if Execute(sql):
print("Animal updated successfully")
return True
print("An error occurs, please try again...")
return False
def updateProprietaire(client_id, animal_id, new_client_id, new_animal_id) :
def updateProprietaire(client_id, animal_id, new_client_id='client', new_animal_id='animal') :
sql = "UPDATE Proprietaires SET client={}, animal={} WHERE client={} AND animal={}".format(new_client_id, new_animal_id, client_id, animal_id)
if Execute(sql):
print("Proprietaire updated successfully")
......@@ -228,8 +233,12 @@ def updateProprietaire(client_id, animal_id, new_client_id, new_animal_id) :
print("An error occurs, please try again...")
return False
def updateAutorise(medicament, espece, new_medicament, new_espece):
sql = "UPDATE Autorise SET medicament='{}', espece='{}' WHERE medicament='{}' AND espece='{}'".format(new_medicament, new_espece, medicament, espece)
def updateAutorise(medicament, espece, new_medicament='medicament', new_espece='espece'):
if new_medicament != 'medicament':
new_medicament = "'"+new_medicament+"'"
if new_espece != 'espece':
new_espece = "'"+new_espece+"'"
sql = "UPDATE Autorise SET medicament={}, espece={} WHERE medicament='{}' AND espece='{}'".format(new_medicament, new_espece, medicament, espece)
if Execute(sql):
print("Autorisation updated successfully")
return True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment