...
This commit is contained in:
parent
e9782dc754
commit
cef87901a4
10
src/m/abonnement.py
Normal file
10
src/m/abonnement.py
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
from src.m.connexionBDD import connexionBDD
|
||||||
|
class Abonnement:
|
||||||
|
def __init__(self, libelle, prix, estPackGar):
|
||||||
|
self.libelle = libelle
|
||||||
|
self.prix = prix
|
||||||
|
self.estPackGar = estPackGar
|
||||||
|
def addContrat(self, contrat):
|
||||||
|
connexion = connexionBDD()
|
||||||
|
# indId= connexion.cur.execute("SELECT abonnement.idAbonnement FROM abonnement WHERE libelle = ? AND prix = ? AND estPackGar=?;"(self.libelle, self.prix, self.estPackGar))
|
||||||
|
# idAbonnement = int(''.join(map(str,indId)))
|
@ -4,20 +4,12 @@ class Contrat:
|
|||||||
self.dateDebut = dateDebut
|
self.dateDebut = dateDebut
|
||||||
self.dateFin = dateFin
|
self.dateFin = dateFin
|
||||||
def enregistrerContrat(self):
|
def enregistrerContrat(self):
|
||||||
|
|
||||||
connection = connexionBDD()
|
connection = connexionBDD()
|
||||||
#1.obtenir id service (fonction max de sqlite ne marche pas bien...elle ne prend en compte que le premier chiffre. Ex: max(56,9)= 9... )
|
connection.cur.execute("INSERT INTO contrat (idContrat,dateDebut,dateFin, estEncours) VALUES (NULL,?,?,1);",( self.dateDebut, self.dateFin,1) )
|
||||||
connection.cur.execute("SELECT count(service.idSercice) FROM service;")
|
|
||||||
#entrée dans la base de donnée
|
|
||||||
#2. obtenir l'idClient: définir une variable globale lors de l'execution du "jeu"
|
|
||||||
#3.Obtenir l'idVoiturier: en recherchant celui qui est disponible le jour en question
|
|
||||||
|
|
||||||
connection.cur.execute("INSERT INTO contrat (idContrat,dateDebut,dateFin, estEncours) VALUES (NULL,?,?,?);",( self.dateDebut, self.dateFin,1) )
|
|
||||||
connection.seDeconnecter()
|
connection.seDeconnecter()
|
||||||
def rompreContrat(self):
|
def rompreContrat(self, idCLient):
|
||||||
|
|
||||||
|
|
||||||
connection = connexionBDD()
|
connection = connexionBDD()
|
||||||
connection.cur.execute("SELECT count(service.idSercice) FROM service;")
|
indContrat =connection.cur.execute("SELECT Contrat.idContrat FROM contrat where idClient =? AND dateDebut = ? AND dateFin=? ;"(idCLient, self.dateDebut, self.dateFin))
|
||||||
connection.cur.execute("INSERT INTO contrat (idContrat,dateDebut,dateFin, estEncours) VALUES (NULL,?,?,?);",( self.dateDebut, self.dateFin,1) )
|
idContrat= int(''.join(map(str,indContrat)))
|
||||||
|
connection.cur.execute("Update contrat where idContrat=? set estEnCours =0;",( idContrat) )
|
||||||
connection.seDeconnecter()
|
connection.seDeconnecter()
|
||||||
|
@ -17,8 +17,29 @@ class Place:
|
|||||||
def longueur(self):
|
def longueur(self):
|
||||||
return self.longueur
|
return self.longueur
|
||||||
@property
|
@property
|
||||||
|
<<<<<<< Updated upstream
|
||||||
|
def nbPlaceTotal(self):
|
||||||
|
i = 0
|
||||||
|
for t in self.l:
|
||||||
|
i += t.nb
|
||||||
|
return i
|
||||||
|
|
||||||
|
@property
|
||||||
|
def liste(self):
|
||||||
|
return self.l
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
class Placement:
|
||||||
|
def __init__(self,debut,fin):
|
||||||
|
self.debut = debut
|
||||||
|
self.fin = fin
|
||||||
|
|
||||||
|
=======
|
||||||
def estLibre(self):
|
def estLibre(self):
|
||||||
return self.estLibre
|
return self.estLibre
|
||||||
|
>>>>>>> Stashed changes
|
||||||
@property
|
@property
|
||||||
def hauteur(self):
|
def hauteur(self):
|
||||||
return self.hauteur
|
return self.hauteur
|
||||||
|
Reference in New Issue
Block a user