^^
This commit is contained in:
parent
adf92a2a86
commit
457134fe41
@ -1,2 +1 @@
|
||||
class client:
|
||||
pass
|
9
src/m/connectionBDD.py
Normal file
9
src/m/connectionBDD.py
Normal file
@ -0,0 +1,9 @@
|
||||
import sqlite3
|
||||
class connectionBDD:
|
||||
def __init__(self):
|
||||
self.chemin = "/Users/nadiel/SQLite/BDDrojetPython.sq3"
|
||||
self.conn =sqlite3.connect(self.chemin)
|
||||
self.cur =self.conn.cursor()
|
||||
def seDeconnecter(self):
|
||||
self.cur.close()
|
||||
self.conn.close()
|
5
src/m/maintenance.py
Normal file
5
src/m/maintenance.py
Normal file
@ -0,0 +1,5 @@
|
||||
from service import Service
|
||||
from voiture import Voiture
|
||||
class Maintenance(Service):
|
||||
def effectuerMaintenance(self, voiture):
|
||||
|
34
src/m/service.py
Normal file
34
src/m/service.py
Normal file
@ -0,0 +1,34 @@
|
||||
import time
|
||||
|
||||
import datetime
|
||||
from src.m.connectionBDD import connectionBDD
|
||||
class service:
|
||||
def __init__(self, jourService, moisService, anneeService, jourDemande, moisDemande, anneeDemande, rapport):
|
||||
try:
|
||||
dateService = datetime.date(anneeService, moisService, jourService)
|
||||
self.dateService = dateService
|
||||
except:
|
||||
#Si la date n'est pas un nombre ou bien si ceux ci sont abérrents
|
||||
print ("la date de service n\'est pas correcte")
|
||||
try:
|
||||
dateDemande = datetime.date(anneeDemande, moisDemande, jourDemande)
|
||||
self.dateDemande = dateDemande
|
||||
except:
|
||||
print ("la date de service n\'est pas correcte")
|
||||
self.rapport = rapport
|
||||
def enregistrerService(self):
|
||||
try:
|
||||
connection = connectionBDD()
|
||||
#obtenir id service
|
||||
connection.cur.execute("SELECT count(service.idSercice) FROM service;")
|
||||
indiceidSer= connection.cur.execute("SELECT count(service.idService) FROM service;")
|
||||
idService = int(''.join(map(str,indiceidSer))) +1
|
||||
connection.cur.execute("INSERT INTO service (idService,dateService,dateDemande,rapport,idClient,idVoiturier,idService, idClient, idVoiturier) VALUES (?,?,?,?,?,?,?,?,?);",(idService, self.dateService, self.dateDemande, self.rapport) )
|
||||
except Exception, e:
|
||||
print str(e)
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
|
5
src/m/test/testService.py
Normal file
5
src/m/test/testService.py
Normal file
@ -0,0 +1,5 @@
|
||||
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):
|
||||
|
||||
|
Reference in New Issue
Block a user