reformat
This commit is contained in:
parent
d411b7e1d1
commit
640640cab0
@ -1,15 +1,18 @@
|
||||
import sqlite3
|
||||
|
||||
from src.c.Main import Main
|
||||
import sqlite3
|
||||
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
class connexionBDD :
|
||||
|
||||
class connexionBDD:
|
||||
def __init__(self):
|
||||
try:
|
||||
self.__conn = sqlite3.connect("BD.sql3")
|
||||
self.__cur = self.__conn.cursor()
|
||||
except Exception as e :
|
||||
pass # later
|
||||
except Exception as e:
|
||||
pass # later
|
||||
|
||||
def seDeconnecter(self):
|
||||
self.__cur.close()
|
||||
@ -19,14 +22,15 @@ class connexionBDD :
|
||||
try:
|
||||
r = self.__cur.execute(req)
|
||||
self.__conn.commit()
|
||||
except Exception as e :
|
||||
pass # later
|
||||
except Exception as e:
|
||||
pass # later
|
||||
return r
|
||||
|
||||
|
||||
def lastId(self):
|
||||
return self.__cur.lastrowid
|
||||
|
||||
|
||||
conn = connexionBDD
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
@ -9,6 +9,7 @@ class Acces:
|
||||
"""
|
||||
Controleur Acces
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
self.__parking = Parking()
|
||||
self.__camera = Camera()
|
||||
|
@ -1,11 +1,14 @@
|
||||
from PyQt4 import QtGui
|
||||
|
||||
from src.c.Teleporteur import Teleporteur
|
||||
from src.m.Placement import Placement
|
||||
from src.m.Client import Client
|
||||
from src.m.TypeAbonnement import TypeAbonnement
|
||||
from src.v.Camera import Camera
|
||||
from PyQt4 import QtGui
|
||||
from src.v.MyQWidget import MyQWidget
|
||||
from src.v.Ui_Borne import Ui_Borne
|
||||
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
@ -13,6 +16,7 @@ class Borne:
|
||||
"""
|
||||
Controleur de la vue de la borne permettant l'accès au parking
|
||||
"""
|
||||
|
||||
def __init__(self, main, parking):
|
||||
self.__parking = parking
|
||||
self.__main = main
|
||||
@ -32,7 +36,7 @@ class Borne:
|
||||
self.__ui.btn_recuperer.clicked.connect(self.recuperer)
|
||||
|
||||
|
||||
#Validator
|
||||
# Validator
|
||||
|
||||
|
||||
self.__ui.nomParking = parking.nom
|
||||
@ -40,7 +44,6 @@ class Borne:
|
||||
self.showWindow()
|
||||
|
||||
|
||||
|
||||
def nonVoiture(self):
|
||||
"""
|
||||
Met en etat initial de départ sans voiture
|
||||
@ -71,11 +74,11 @@ class Borne:
|
||||
:return:
|
||||
"""
|
||||
self.__c = Client.get(self.__ui.lineEdit_id.text())
|
||||
if self.__c != None :
|
||||
self.__ui.label_aff.setText("Bonjour " + str(self.__c.nom)+ " " + str(self.__c.prenom))
|
||||
#self.__ui.labIdClient.setText(str(self.__c))
|
||||
if self.__c != None:
|
||||
self.__ui.label_aff.setText("Bonjour " + str(self.__c.nom) + " " + str(self.__c.prenom))
|
||||
# self.__ui.labIdClient.setText(str(self.__c))
|
||||
self.__ui.box_id.setDisabled(True)
|
||||
else :
|
||||
else:
|
||||
self.__ui.label_aff.setText("Echec identification")
|
||||
self.__ui.labIdClient.setText("Non identifier")
|
||||
|
||||
@ -84,19 +87,19 @@ class Borne:
|
||||
Gestion validation formaulaire d'abonnement
|
||||
:return:
|
||||
"""
|
||||
if self.__c != None :
|
||||
if self.__c != None:
|
||||
self.__c.maj(self.__ui.nomLineEdit,
|
||||
self.__ui.prenomLineEdit,
|
||||
"",
|
||||
TypeAbonnement.SUPER_ABONNE)
|
||||
self.__ui.prenomLineEdit,
|
||||
"",
|
||||
TypeAbonnement.SUPER_ABONNE)
|
||||
self.__ui.label_aff.setText("Mise a jour de votre abonnement effectué")
|
||||
else:
|
||||
if self.__ui.checkBox.isEnabled() :
|
||||
if self.__ui.checkBox.isEnabled():
|
||||
self.__c = Client(self.__ui.nomLineEdit,
|
||||
self.__ui.prenomLineEdit,
|
||||
"",
|
||||
TypeAbonnement.SUPER_ABONNE)
|
||||
else :
|
||||
else:
|
||||
self.__c = Client(self.__ui.nomLineEdit,
|
||||
self.__ui.prenomLineEdit,
|
||||
"",
|
||||
@ -111,11 +114,11 @@ class Borne:
|
||||
:return:
|
||||
"""
|
||||
if self.__c is None:
|
||||
id = Teleporteur.teleporterVoiture(self.v_actuel,self.__parking.recherchePlace(self.v_actuel))
|
||||
id = Teleporteur.teleporterVoiture(self.v_actuel, self.__parking.recherchePlace(self.v_actuel))
|
||||
self.__ui.label_aff.setText("Votre num ticket est : " + id)
|
||||
else:
|
||||
if self.__c.abonnement != TypeAbonnement.SUPER_ABONNE :
|
||||
Teleporteur.teleporterVoiture(self.v_actuel,self.__parking.recherchePlace(self.v_actuel))
|
||||
if self.__c.abonnement != TypeAbonnement.SUPER_ABONNE:
|
||||
Teleporteur.teleporterVoiture(self.v_actuel, self.__parking.recherchePlace(self.v_actuel))
|
||||
else:
|
||||
Teleporteur.teleporterVoirureSuperAbonne(self.v_actuel)
|
||||
|
||||
@ -133,7 +136,6 @@ class Borne:
|
||||
self.__ui.label_aff.setText("Bonne journée")
|
||||
|
||||
|
||||
|
||||
def showWindow(self):
|
||||
"""
|
||||
Gestion affichage de la vue borne
|
||||
|
@ -13,6 +13,7 @@ class CreaParking:
|
||||
"""
|
||||
Controleur de cretion de parking
|
||||
"""
|
||||
|
||||
def __init__(self, main):
|
||||
self._main = main
|
||||
self._main.activity("Debut Creation Parking", self._main.lvl.INFO)
|
||||
@ -27,7 +28,7 @@ class CreaParking:
|
||||
self._ui.btn_valider.clicked.connect(self.valider)
|
||||
self._ui.btn_annuler.clicked.connect(self.annuler)
|
||||
|
||||
#Validator
|
||||
# Validator
|
||||
#self._ui.lineEdit_nbNiv.setValidator(QtGui.QRegExpValidator(QtCore.QRegExp('[0-9]*')))
|
||||
|
||||
self._ui.tableWidget.insertRow(self._ui.tableWidget.rowCount())
|
||||
@ -74,7 +75,7 @@ class CreaParking:
|
||||
Gestion validation de formulaire de creation de parking.
|
||||
:return:
|
||||
"""
|
||||
#try:
|
||||
# try:
|
||||
l = ListeTypePlace()
|
||||
for i in range(0, self._ui.tableWidget.rowCount()):
|
||||
l.add(int(self._ui.tableWidget.item(i, 0).text()), int(self._ui.tableWidget.item(i, 1).text()),
|
||||
|
@ -1,8 +1,8 @@
|
||||
import sys
|
||||
|
||||
from PyQt4 import QtGui
|
||||
from src.c.Borne import Borne
|
||||
|
||||
from src.c.Borne import Borne
|
||||
from src.c.DetailsPlaces import DetailsPlaces
|
||||
from src.c.log.log import Log
|
||||
from src.c.log.log import lvl
|
||||
@ -29,7 +29,7 @@ class Main:
|
||||
self.__ui.setupUi(self.__view)
|
||||
|
||||
|
||||
#connect
|
||||
# connect
|
||||
self.__ui.comboBox.currentIndexChanged['QString'].connect(self.selectParking)
|
||||
self.__ui.btn_creer.clicked.connect(self.creerParking)
|
||||
self.__ui.btn_supprimer.clicked.connect(self.rmParking)
|
||||
|
@ -1,10 +1,13 @@
|
||||
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)))
|
||||
# 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)))
|
||||
|
@ -6,12 +6,12 @@ __author__ = 'sidya'
|
||||
|
||||
|
||||
class Client():
|
||||
|
||||
clients = []
|
||||
|
||||
def __init__(self, nom, prenom, adresse, typeAbonnement):
|
||||
while True :
|
||||
id =''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,10)))
|
||||
while True:
|
||||
id = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in
|
||||
range(random.randint(1, 10)))
|
||||
if Client.get(id) is None:
|
||||
break
|
||||
self.__id = id
|
||||
@ -63,9 +63,10 @@ class Client():
|
||||
@staticmethod
|
||||
def saveAll(connection):
|
||||
cur = connection.cursor()
|
||||
#reset table Client
|
||||
# reset table Client
|
||||
cur.execute("DROP TABLE IF EXISTS Client")
|
||||
cur.execute("""create table Client (num varchar(10) PRIMARY KEY, nom varchar(30), prenom varchar(30), adr varchar(50), abo int(1))""")
|
||||
cur.execute(
|
||||
"""create table Client (num varchar(10) PRIMARY KEY, nom varchar(30), prenom varchar(30), adr varchar(50), abo int(1))""")
|
||||
# insert clients
|
||||
for c in Client.tous:
|
||||
cur.execute("insert into Client values (?, ?, ?, ?, ?)", (c.id, c.nom, c.prenom, c.adr, c.abonnement))
|
||||
@ -78,8 +79,9 @@ class Client():
|
||||
self.__typeAbonnement = typeAbonnement
|
||||
self.__adresse = adresse
|
||||
|
||||
def __str__( self ):
|
||||
return "( " + self.__id +", " + self.__nom+", " + self.__prenom+", " + self.__adresse +", " + str(self.__typeAbonnement) +" )"
|
||||
def __str__(self):
|
||||
return "( " + self.__id + ", " + self.__nom + ", " + self.__prenom + ", " + self.__adresse + ", " + str(
|
||||
self.__typeAbonnement) + " )"
|
||||
|
||||
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
__author__ = 'sidya'
|
||||
|
||||
class connexionBDD :
|
||||
|
||||
class connexionBDD:
|
||||
def __init__(self):
|
||||
try:
|
||||
self.__conn = sqlite3.connect("BD.sql3")
|
||||
self.__cur = self.__conn.cursor()
|
||||
except Exception as e :
|
||||
pass # later
|
||||
except Exception as e:
|
||||
pass # later
|
||||
|
||||
def seDeconnecter(self):
|
||||
self.__cur.close()
|
||||
@ -16,8 +17,8 @@ class connexionBDD :
|
||||
try:
|
||||
r = self.__cur.execute(req)
|
||||
self.__conn.commit()
|
||||
except Exception as e :
|
||||
pass # later
|
||||
except Exception as e:
|
||||
pass # later
|
||||
return r
|
||||
|
||||
|
||||
|
@ -1,15 +1,23 @@
|
||||
from src.m.connexionBDD import connexionBDD
|
||||
|
||||
|
||||
class Contrat:
|
||||
def __init__(self, dateDebut, dateFin):
|
||||
self.dateDebut = dateDebut
|
||||
self.dateFin = dateFin
|
||||
|
||||
def enregistrerContrat(self):
|
||||
connection = connexionBDD()
|
||||
connection.cur.execute("INSERT INTO contrat (idContrat,dateDebut,dateFin, estEncours) VALUES (NULL,?,?,1);",( self.dateDebut, self.dateFin,1) )
|
||||
connection.seDeconnecter()
|
||||
connection = connexionBDD()
|
||||
connection.cur.execute("INSERT INTO contrat (idContrat,dateDebut,dateFin, estEncours) VALUES (NULL,?,?,1);",
|
||||
( self.dateDebut, self.dateFin, 1))
|
||||
connection.seDeconnecter()
|
||||
|
||||
def rompreContrat(self, idCLient):
|
||||
connection = connexionBDD()
|
||||
indContrat =connection.cur.execute("SELECT Contrat.idContrat FROM contrat where idClient =? AND dateDebut = ? AND dateFin=? ;"(idCLient, self.dateDebut, self.dateFin))
|
||||
idContrat= int(''.join(map(str,indContrat)))
|
||||
connection.cur.execute("Update contrat where idContrat=? set estEnCours =0;",( idContrat) )
|
||||
connection.seDeconnecter()
|
||||
connection = connexionBDD()
|
||||
indContrat = connection.cur.execute(
|
||||
"SELECT Contrat.idContrat FROM contrat where idClient =? AND dateDebut = ? AND dateFin=? ;"(idCLient,
|
||||
self.dateDebut,
|
||||
self.dateFin))
|
||||
idContrat = int(''.join(map(str, indContrat)))
|
||||
connection.cur.execute("Update contrat where idContrat=? set estEnCours =0;", ( idContrat))
|
||||
connection.seDeconnecter()
|
||||
|
@ -1,13 +1,19 @@
|
||||
from src.m.Service import Service
|
||||
from src.m.connexionBDD import connexionBDD
|
||||
|
||||
|
||||
class Entretien(Service):
|
||||
def __init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport, categorie, idClient):
|
||||
super(Service, self).__init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport, categorie)
|
||||
def __init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport,
|
||||
categorie, idClient):
|
||||
super(Service, self).__init__(self, jourService, moisService, anneeService, jourDemande, moisDemande,
|
||||
anneeDemande, rapport, categorie)
|
||||
self.categorie = 2
|
||||
self.etat = 0
|
||||
self.idService=self.enregistrerService(self,idClient,self.categorie,self.etat)
|
||||
def effectuerEntretien(self):
|
||||
self.etat = 1
|
||||
connexion = connexionBDD()
|
||||
connexion.cur.execute("UPDATE service SET etat= 1 WHERE idService = ?", (self.idService))
|
||||
connexion.seDeconnecter()
|
||||
self.idService = self.enregistrerService(self, idClient, self.categorie, self.etat)
|
||||
|
||||
|
||||
def effectuerEntretien(self):
|
||||
self.etat = 1
|
||||
connexion = connexionBDD()
|
||||
connexion.cur.execute("UPDATE service SET etat= 1 WHERE idService = ?", (self.idService))
|
||||
connexion.seDeconnecter()
|
@ -2,6 +2,7 @@ from src.m.TypePlace import TypePlace
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class ListeTypePlace:
|
||||
"""
|
||||
Classe qui permet de définir une liste de type de place par niveau pour la création d'un parking
|
||||
|
@ -1,23 +1,29 @@
|
||||
import calendar
|
||||
|
||||
from src.m.Service import Service
|
||||
from src.m.connexionBDD import connexionBDD
|
||||
import calendar
|
||||
|
||||
|
||||
class Livraison(Service):
|
||||
def __init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport, categorie, idClient):
|
||||
super(Service, self).__init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport, categorie)
|
||||
def __init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport,
|
||||
categorie, idClient):
|
||||
super(Service, self).__init__(self, jourService, moisService, anneeService, jourDemande, moisDemande,
|
||||
anneeDemande, rapport, categorie)
|
||||
self.categorie = 3
|
||||
self.etat = 0
|
||||
#3.Obtenir l'idVoiturier: en recherchant celui qui est disponible le jour en question
|
||||
self.idService=self.enregistrerService(self, idClient, self.categorie, self.etat)
|
||||
jour= calendar.weekday(self.dateService._day, self.dateService._month, self.dateService._year)
|
||||
connexion = connexionBDD()
|
||||
indiceVoiturier= connexion.cur.execute("SELECT voiturier.idVoiturier FROM voiturier WHERE voiturier.joursDisponible = ?; ", (jour) )
|
||||
idVoiturier = int(''.join(map(str,indiceVoiturier )))
|
||||
# 3.Obtenir l'idVoiturier: en recherchant celui qui est disponible le jour en question
|
||||
self.idService = self.enregistrerService(self, idClient, self.categorie, self.etat)
|
||||
jour = calendar.weekday(self.dateService._day, self.dateService._month, self.dateService._year)
|
||||
connexion = connexionBDD()
|
||||
indiceVoiturier = connexion.cur.execute(
|
||||
"SELECT voiturier.idVoiturier FROM voiturier WHERE voiturier.joursDisponible = ?; ", (jour))
|
||||
idVoiturier = int(''.join(map(str, indiceVoiturier)))
|
||||
connexion.cur.execute("UPDATE service SET idVoiturier= ? WHERE idService = ?", (idVoiturier, self.idService))
|
||||
connexion.seDeconnecter()
|
||||
|
||||
def effectuerLivraison(self):
|
||||
self.etat = 1
|
||||
connexion = connexionBDD()
|
||||
connexion = connexionBDD()
|
||||
connexion.cur.execute("UPDATE service SET etat= 1 WHERE idService = ?", (self.idService))
|
||||
connexion.seDeconnecter()
|
||||
|
||||
|
@ -1,14 +1,18 @@
|
||||
from src.m.Service import Service
|
||||
from src.m.connexionBDD import connexionBDD
|
||||
|
||||
|
||||
class Maintenance(Service):
|
||||
def __init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport, categorie, idClient):
|
||||
super(Service, self).__init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport, categorie)
|
||||
def __init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport,
|
||||
categorie, idClient):
|
||||
super(Service, self).__init__(self, jourService, moisService, anneeService, jourDemande, moisDemande,
|
||||
anneeDemande, rapport, categorie)
|
||||
self.categorie = 1
|
||||
self.etat = 0
|
||||
self.idService=self.enregistrerService(self, idClient, self.categorie, self.etat)
|
||||
self.idService = self.enregistrerService(self, idClient, self.categorie, self.etat)
|
||||
|
||||
def effectuerMaintenance(self):
|
||||
self.etat = 1
|
||||
connexion = connexionBDD()
|
||||
connexion = connexionBDD()
|
||||
connexion.cur.execute("UPDATE service SET etat= 1 WHERE idService = ?", (self.idService))
|
||||
|
||||
|
@ -1,12 +1,13 @@
|
||||
|
||||
from src.m.Place import Place
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class Parking:
|
||||
"""
|
||||
Definie un parking
|
||||
"""
|
||||
|
||||
def __init__(self, typePlaces, nom):
|
||||
"""
|
||||
Creer objet parking
|
||||
@ -50,7 +51,7 @@ class Parking:
|
||||
"""
|
||||
place = None
|
||||
for p in self.__Places:
|
||||
if p.estLibre and p.dimValide(voiture.getHauteur, voiture.getLongueur) :
|
||||
if p.estLibre and p.dimValide(voiture.getHauteur, voiture.getLongueur):
|
||||
pass
|
||||
place = p
|
||||
break
|
||||
|
@ -1,7 +1,3 @@
|
||||
import datetime
|
||||
import random
|
||||
import string
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
@ -9,7 +5,8 @@ class Place:
|
||||
"""
|
||||
Representation d'une place
|
||||
"""
|
||||
def __init__(self, numero, niveau, longueur,hauteur):
|
||||
|
||||
def __init__(self, numero, niveau, longueur, hauteur):
|
||||
"""
|
||||
Creer une place.
|
||||
Les dimensions doivent etre données en cm (longueur, hauteur)
|
||||
|
@ -4,17 +4,20 @@ import string
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class Placement:
|
||||
placements = []
|
||||
def __init__(self,voiture, place):
|
||||
|
||||
def __init__(self, voiture, place):
|
||||
"""
|
||||
Creer un placement
|
||||
:param voiture: Voiture
|
||||
:param place: Place
|
||||
:return:
|
||||
"""
|
||||
while True :
|
||||
id =''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,10)))
|
||||
while True:
|
||||
id = ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in
|
||||
range(random.randint(1, 10)))
|
||||
if Placement.get(id) is None:
|
||||
break
|
||||
self.__id = id
|
||||
|
@ -24,7 +24,7 @@ class Service:
|
||||
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("SELECT count(service.idSercice) FROM service;")
|
||||
#entrée dans la base de donnée
|
||||
# entrée dans la base de donnée
|
||||
indiceidSer = connection.cur.execute("SELECT count(service.idService) FROM service;")
|
||||
idService = int(''.join(map(str, indiceidSer))) + 1
|
||||
#2. obtenir l'idClient: définir une variable globale lors de l'execution du "jeu"
|
||||
|
@ -1,5 +1,6 @@
|
||||
__author__ = 'sidya'
|
||||
|
||||
class TypeAbonnement :
|
||||
|
||||
class TypeAbonnement:
|
||||
ABONNE = 0
|
||||
SUPER_ABONNE = 1
|
||||
|
@ -1,9 +1,11 @@
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class TypePlace:
|
||||
"""
|
||||
Classe qui permet de définir un type de place
|
||||
"""
|
||||
|
||||
def __init__(self, h, l, nb):
|
||||
self.__hauteur = h
|
||||
self.__longueur = l
|
||||
|
@ -1,5 +1,3 @@
|
||||
|
||||
|
||||
class Voiture():
|
||||
def __init__(self, longueur, hauteur, imma):
|
||||
self._hauteur = hauteur
|
||||
@ -23,6 +21,6 @@ class Voiture():
|
||||
def estDansParking(self):
|
||||
return self._estDansParking == True
|
||||
|
||||
#def addPlacement(self, placement):
|
||||
# def addPlacement(self, placement):
|
||||
|
||||
|
||||
|
@ -1,23 +1,28 @@
|
||||
import time
|
||||
|
||||
from src.m.connexionBDD import connexionBDD
|
||||
|
||||
|
||||
class Voiturier:
|
||||
def __init__(self, id, nom, prenom):
|
||||
self.numero= id
|
||||
self.numero = id
|
||||
self.nom = nom
|
||||
self.prenom = prenom
|
||||
|
||||
def enregistrerVoiturier(self, nom, prenom, dateEmbauche):
|
||||
connexion = connexionBDD()
|
||||
#entrée dans la base de donnée
|
||||
indiceidVoiturier= connexion.cur.execute("SELECT count(voiturier.idVoiturier) FROM voiturier;")+1
|
||||
idVoiturier = int(''.join(map(str,indiceidVoiturier))) +1
|
||||
connexion.cur.execute("INSERT INTO voiturier (idVoiturier,nom, prenom, dateEmbauche) VALUES (?,?,?,?);",(self.idVoiturier,nom, prenom, dateEmbauche) )
|
||||
# entrée dans la base de donnée
|
||||
indiceidVoiturier = connexion.cur.execute("SELECT count(voiturier.idVoiturier) FROM voiturier;") + 1
|
||||
idVoiturier = int(''.join(map(str, indiceidVoiturier))) + 1
|
||||
connexion.cur.execute("INSERT INTO voiturier (idVoiturier,nom, prenom, dateEmbauche) VALUES (?,?,?,?);",
|
||||
(self.idVoiturier, nom, prenom, dateEmbauche))
|
||||
connexion.seDeconnecter()
|
||||
|
||||
def livrerVoiture(self):
|
||||
dateJour = time.strptime()
|
||||
connexion = connexionBDD()
|
||||
indiceLivraison= connexion.cur.execute("SELECT count(voiturier.idVoiturier) FROM voiturier;")
|
||||
idLivraison= int(''.join(map(str,indiceLivraison))) +1
|
||||
connexion.cur.execute("INSERT INTO livraison (idLivraison,dateLivraison, idVoiturier) VALUES (?,?,?,?);",(idLivraison, dateJour, self.idVoiturier) )
|
||||
indiceLivraison = connexion.cur.execute("SELECT count(voiturier.idVoiturier) FROM voiturier;")
|
||||
idLivraison = int(''.join(map(str, indiceLivraison))) + 1
|
||||
connexion.cur.execute("INSERT INTO livraison (idLivraison,dateLivraison, idVoiturier) VALUES (?,?,?,?);",
|
||||
(idLivraison, dateJour, self.idVoiturier))
|
||||
connexion.seDeconnecter()
|
||||
|
@ -1,9 +1,12 @@
|
||||
import sqlite3
|
||||
|
||||
|
||||
class connexionBDD:
|
||||
def __init__(self):
|
||||
self.chemin = "BDDprojetPython.sq3"
|
||||
self.conn =sqlite3.connect(self.chemin)
|
||||
self.cur =self.conn.cursor()
|
||||
self.conn = sqlite3.connect(self.chemin)
|
||||
self.cur = self.conn.cursor()
|
||||
|
||||
def seDeconnecter(self):
|
||||
self.cur.close()
|
||||
self.conn.close()
|
||||
self.cur.close()
|
||||
self.conn.close()
|
@ -1,14 +1,14 @@
|
||||
__author__ = 'nadiel'
|
||||
|
||||
import nose
|
||||
class testClient :
|
||||
#def testsAbonner:
|
||||
|
||||
class testClient:
|
||||
# def testsAbonner:
|
||||
|
||||
def testnouvelleVoiture(self):
|
||||
assert()
|
||||
assert ()
|
||||
#v = Voiture()
|
||||
|
||||
|
||||
#def testTailleMax(self):
|
||||
# c = Camera()
|
||||
# assert (c.capturerHauteur()>1.5)
|
||||
#def testTailleMax(self):
|
||||
# c = Camera()
|
||||
# assert (c.capturerHauteur()>1.5)
|
@ -1,5 +1,7 @@
|
||||
class testService:
|
||||
"""Fonction qui vérifie si la date insérée cest dans un format correcte (année est égale à l'année courante, 01≤jour≤31 et 01≤mois≤12); renvoie une erreur sinon"""
|
||||
def testFormatDate(self, jourInsere, moisInsere, anneeInsere):
|
||||
"""Fonction qui vérifie si la date insérée cest dans un format correcte (année est égale à l'année courante, 01≤jour≤31 et 01≤mois≤12); renvoie une erreur sinon"""
|
||||
|
||||
|
||||
def testFormatDate(self, jourInsere, moisInsere, anneeInsere):
|
||||
|
||||
|
||||
|
@ -1,12 +1,16 @@
|
||||
import random
|
||||
import string
|
||||
|
||||
from src.m.Voiture import Voiture
|
||||
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class Camera:
|
||||
@classmethod
|
||||
def donnerVoiture(self):
|
||||
v = Voiture(random.randint(150,300),random.randint(100,200), ''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,10))))
|
||||
v = Voiture(random.randint(150, 300), random.randint(100, 200), ''.join(
|
||||
random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in
|
||||
range(random.randint(1, 10))))
|
||||
return v
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Form implementation generated from reading ui file 'borne.ui'
|
||||
#
|
||||
# Created: Mon Jan 12 14:40:36 2015
|
||||
# by: PyQt4 UI code generator 4.11.3
|
||||
# by: PyQt4 UI code generator 4.11.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@ -17,12 +17,14 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_Borne(object):
|
||||
def setupUi(self, Borne):
|
||||
Borne.setObjectName(_fromUtf8("Borne"))
|
||||
@ -151,7 +153,8 @@ class Ui_Borne(object):
|
||||
self.box_recup.setTitle(_translate("Borne", "Récuperer", None))
|
||||
self.numeroTicketLabel.setText(_translate("Borne", "Numero Ticket :", None))
|
||||
self.btn_recuperer.setText(_translate("Borne", "Récupérer Véhicule", None))
|
||||
self.label_aff.setText(_translate("Borne", "<html><head/><body><p align=\"center\">TextLabel</p></body></html>", None))
|
||||
self.label_aff.setText(
|
||||
_translate("Borne", "<html><head/><body><p align=\"center\">TextLabel</p></body></html>", None))
|
||||
self.box_garer.setTitle(_translate("Borne", "Se garer", None))
|
||||
self.btn_garer.setText(_translate("Borne", "Garer Véhicule", None))
|
||||
self.btn_annuler.setText(_translate("Borne", "Annuler", None))
|
||||
|
@ -3,7 +3,7 @@
|
||||
# Form implementation generated from reading ui file 'main.ui'
|
||||
#
|
||||
# Created: Mon Jan 12 15:29:56 2015
|
||||
# by: PyQt4 UI code generator 4.11.3
|
||||
# by: PyQt4 UI code generator 4.11.3
|
||||
#
|
||||
# WARNING! All changes made in this file will be lost!
|
||||
|
||||
@ -17,12 +17,14 @@ except AttributeError:
|
||||
|
||||
try:
|
||||
_encoding = QtGui.QApplication.UnicodeUTF8
|
||||
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig, _encoding)
|
||||
except AttributeError:
|
||||
def _translate(context, text, disambig):
|
||||
return QtGui.QApplication.translate(context, text, disambig)
|
||||
|
||||
|
||||
class Ui_MainWindow(object):
|
||||
def setupUi(self, MainWindow):
|
||||
MainWindow.setObjectName(_fromUtf8("MainWindow"))
|
||||
|
Reference in New Issue
Block a user