reformat
This commit is contained in:
parent
d411b7e1d1
commit
640640cab0
@ -1,8 +1,11 @@
|
||||
import sqlite3
|
||||
|
||||
from src.c.Main import Main
|
||||
import sqlite3
|
||||
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class connexionBDD:
|
||||
def __init__(self):
|
||||
try:
|
||||
@ -27,6 +30,7 @@ class connexionBDD :
|
||||
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
|
||||
@ -40,7 +44,6 @@ class Borne:
|
||||
self.showWindow()
|
||||
|
||||
|
||||
|
||||
def nonVoiture(self):
|
||||
"""
|
||||
Met en etat initial de départ sans voiture
|
||||
@ -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)
|
||||
|
@ -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
|
||||
|
@ -1,9 +1,12 @@
|
||||
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))
|
||||
|
@ -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)))
|
||||
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
|
||||
@ -65,7 +65,8 @@ class Client():
|
||||
cur = connection.cursor()
|
||||
# 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))
|
||||
@ -79,7 +80,8 @@ class Client():
|
||||
self.__adresse = adresse
|
||||
|
||||
def __str__(self):
|
||||
return "( " + self.__id +", " + self.__nom+", " + self.__prenom+", " + self.__adresse +", " + str(self.__typeAbonnement) +" )"
|
||||
return "( " + self.__id + ", " + self.__nom + ", " + self.__prenom + ", " + self.__adresse + ", " + str(
|
||||
self.__typeAbonnement) + " )"
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class connexionBDD:
|
||||
def __init__(self):
|
||||
try:
|
||||
|
@ -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.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))
|
||||
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,11 +1,17 @@
|
||||
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()
|
||||
|
@ -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,16 +1,22 @@
|
||||
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) )
|
||||
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()
|
||||
|
@ -1,8 +1,12 @@
|
||||
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)
|
||||
|
@ -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
|
||||
|
@ -1,7 +1,3 @@
|
||||
import datetime
|
||||
import random
|
||||
import string
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
@ -9,6 +5,7 @@ class Place:
|
||||
"""
|
||||
Representation d'une place
|
||||
"""
|
||||
|
||||
def __init__(self, numero, niveau, longueur, hauteur):
|
||||
"""
|
||||
Creer une place.
|
||||
|
@ -4,8 +4,10 @@ import string
|
||||
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
class Placement:
|
||||
placements = []
|
||||
|
||||
def __init__(self, voiture, place):
|
||||
"""
|
||||
Creer un placement
|
||||
@ -14,7 +16,8 @@ class Placement:
|
||||
:return:
|
||||
"""
|
||||
while True:
|
||||
id =''.join(random.choice(string.ascii_uppercase + string.ascii_lowercase + string.digits) for _ in range(random.randint(1,10)))
|
||||
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
|
||||
|
@ -1,5 +1,6 @@
|
||||
__author__ = 'sidya'
|
||||
|
||||
|
||||
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
|
||||
|
@ -1,5 +1,8 @@
|
||||
import time
|
||||
|
||||
from src.m.connexionBDD import connexionBDD
|
||||
|
||||
|
||||
class Voiturier:
|
||||
def __init__(self, id, nom, prenom):
|
||||
self.numero = id
|
||||
@ -11,7 +14,8 @@ class Voiturier:
|
||||
# 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.cur.execute("INSERT INTO voiturier (idVoiturier,nom, prenom, dateEmbauche) VALUES (?,?,?,?);",
|
||||
(self.idVoiturier, nom, prenom, dateEmbauche))
|
||||
connexion.seDeconnecter()
|
||||
|
||||
def livrerVoiture(self):
|
||||
@ -19,5 +23,6 @@ class Voiturier:
|
||||
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) )
|
||||
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()
|
||||
|
||||
def seDeconnecter(self):
|
||||
self.cur.close()
|
||||
self.conn.close()
|
@ -1,6 +1,6 @@
|
||||
__author__ = 'nadiel'
|
||||
|
||||
import nose
|
||||
|
||||
class testClient:
|
||||
# def testsAbonner:
|
||||
|
||||
|
@ -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):
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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))
|
||||
|
@ -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