diff --git a/metaFinal/build.xml b/metaFinal/build.xml new file mode 100644 index 0000000..7ae740a --- /dev/null +++ b/metaFinal/build.xml @@ -0,0 +1,73 @@ + + + + + + + + + + + Builds, tests, and runs the project metatrip2. + + + diff --git a/metaFinal/build/built-jar.properties b/metaFinal/build/built-jar.properties new file mode 100644 index 0000000..8fe4f64 --- /dev/null +++ b/metaFinal/build/built-jar.properties @@ -0,0 +1,4 @@ +#Fri, 18 Feb 2022 12:23:38 +0100 + + +C\:\\Users\\medal\\OneDrive\\Bureau\\metaFinal= diff --git a/metaFinal/build/classes/Config/Datasource.class b/metaFinal/build/classes/Config/Datasource.class new file mode 100644 index 0000000..71d6693 Binary files /dev/null and b/metaFinal/build/classes/Config/Datasource.class differ diff --git a/metaFinal/build/classes/Config/Metatrip.class b/metaFinal/build/classes/Config/Metatrip.class new file mode 100644 index 0000000..4d719b6 Binary files /dev/null and b/metaFinal/build/classes/Config/Metatrip.class differ diff --git a/metaFinal/build/classes/entities/EtatPayment.class b/metaFinal/build/classes/entities/EtatPayment.class new file mode 100644 index 0000000..c93bd46 Binary files /dev/null and b/metaFinal/build/classes/entities/EtatPayment.class differ diff --git a/metaFinal/build/classes/entities/Voiture.class b/metaFinal/build/classes/entities/Voiture.class new file mode 100644 index 0000000..9288c1c Binary files /dev/null and b/metaFinal/build/classes/entities/Voiture.class differ diff --git a/metaFinal/build/classes/entities/Voyage_virtuel.class b/metaFinal/build/classes/entities/Voyage_virtuel.class new file mode 100644 index 0000000..639eaed Binary files /dev/null and b/metaFinal/build/classes/entities/Voyage_virtuel.class differ diff --git a/metaFinal/build/classes/entities/abonnement.class b/metaFinal/build/classes/entities/abonnement.class new file mode 100644 index 0000000..102729a Binary files /dev/null and b/metaFinal/build/classes/entities/abonnement.class differ diff --git a/metaFinal/build/classes/entities/evenement.class b/metaFinal/build/classes/entities/evenement.class new file mode 100644 index 0000000..8a62022 Binary files /dev/null and b/metaFinal/build/classes/entities/evenement.class differ diff --git a/metaFinal/build/classes/entities/hotel.class b/metaFinal/build/classes/entities/hotel.class new file mode 100644 index 0000000..0e895a6 Binary files /dev/null and b/metaFinal/build/classes/entities/hotel.class differ diff --git a/metaFinal/build/classes/entities/paiement.class b/metaFinal/build/classes/entities/paiement.class new file mode 100644 index 0000000..e1b0d6e Binary files /dev/null and b/metaFinal/build/classes/entities/paiement.class differ diff --git a/metaFinal/build/classes/entities/reservation_event.class b/metaFinal/build/classes/entities/reservation_event.class new file mode 100644 index 0000000..28e0cf8 Binary files /dev/null and b/metaFinal/build/classes/entities/reservation_event.class differ diff --git a/metaFinal/build/classes/entities/reservation_hotel.class b/metaFinal/build/classes/entities/reservation_hotel.class new file mode 100644 index 0000000..d747864 Binary files /dev/null and b/metaFinal/build/classes/entities/reservation_hotel.class differ diff --git a/metaFinal/build/classes/entities/reservation_voiture.class b/metaFinal/build/classes/entities/reservation_voiture.class new file mode 100644 index 0000000..186abdb Binary files /dev/null and b/metaFinal/build/classes/entities/reservation_voiture.class differ diff --git a/metaFinal/build/classes/entities/reservation_voyage.class b/metaFinal/build/classes/entities/reservation_voyage.class new file mode 100644 index 0000000..7eb4eba Binary files /dev/null and b/metaFinal/build/classes/entities/reservation_voyage.class differ diff --git a/metaFinal/build/classes/entities/user.class b/metaFinal/build/classes/entities/user.class new file mode 100644 index 0000000..4b55111 Binary files /dev/null and b/metaFinal/build/classes/entities/user.class differ diff --git a/metaFinal/build/classes/entities/voyage.class b/metaFinal/build/classes/entities/voyage.class new file mode 100644 index 0000000..bfd6e80 Binary files /dev/null and b/metaFinal/build/classes/entities/voyage.class differ diff --git a/metaFinal/build/classes/entities/voyage_organise.class b/metaFinal/build/classes/entities/voyage_organise.class new file mode 100644 index 0000000..ac25ff8 Binary files /dev/null and b/metaFinal/build/classes/entities/voyage_organise.class differ diff --git a/metaFinal/build/classes/services/IService.class b/metaFinal/build/classes/services/IService.class new file mode 100644 index 0000000..0280c2a Binary files /dev/null and b/metaFinal/build/classes/services/IService.class differ diff --git a/metaFinal/build/classes/services/abonnement/Iabonnement.class b/metaFinal/build/classes/services/abonnement/Iabonnement.class new file mode 100644 index 0000000..9b7e2da Binary files /dev/null and b/metaFinal/build/classes/services/abonnement/Iabonnement.class differ diff --git a/metaFinal/build/classes/services/abonnement/abonnement_Service.class b/metaFinal/build/classes/services/abonnement/abonnement_Service.class new file mode 100644 index 0000000..2f91643 Binary files /dev/null and b/metaFinal/build/classes/services/abonnement/abonnement_Service.class differ diff --git a/metaFinal/build/classes/services/evenement/Serviceevenement.class b/metaFinal/build/classes/services/evenement/Serviceevenement.class new file mode 100644 index 0000000..7e339ac Binary files /dev/null and b/metaFinal/build/classes/services/evenement/Serviceevenement.class differ diff --git a/metaFinal/build/classes/services/evenement/Servicereservation_event.class b/metaFinal/build/classes/services/evenement/Servicereservation_event.class new file mode 100644 index 0000000..ee6d563 Binary files /dev/null and b/metaFinal/build/classes/services/evenement/Servicereservation_event.class differ diff --git a/metaFinal/build/classes/services/hotel/HotelCRUD.class b/metaFinal/build/classes/services/hotel/HotelCRUD.class new file mode 100644 index 0000000..9f62a49 Binary files /dev/null and b/metaFinal/build/classes/services/hotel/HotelCRUD.class differ diff --git a/metaFinal/build/classes/services/hotel/Ihotel.class b/metaFinal/build/classes/services/hotel/Ihotel.class new file mode 100644 index 0000000..77819f1 Binary files /dev/null and b/metaFinal/build/classes/services/hotel/Ihotel.class differ diff --git a/metaFinal/build/classes/services/paiement/EtatPayment.class b/metaFinal/build/classes/services/paiement/EtatPayment.class new file mode 100644 index 0000000..c6b5127 Binary files /dev/null and b/metaFinal/build/classes/services/paiement/EtatPayment.class differ diff --git a/metaFinal/build/classes/services/reservation_hotel/IReservation_hotel.class b/metaFinal/build/classes/services/reservation_hotel/IReservation_hotel.class new file mode 100644 index 0000000..2f4c428 Binary files /dev/null and b/metaFinal/build/classes/services/reservation_hotel/IReservation_hotel.class differ diff --git a/metaFinal/build/classes/services/reservation_hotel/Reserrvation_Hotel_Service.class b/metaFinal/build/classes/services/reservation_hotel/Reserrvation_Hotel_Service.class new file mode 100644 index 0000000..e24ce10 Binary files /dev/null and b/metaFinal/build/classes/services/reservation_hotel/Reserrvation_Hotel_Service.class differ diff --git a/metaFinal/build/classes/services/reservation_voiture/IReservation_voiture.class b/metaFinal/build/classes/services/reservation_voiture/IReservation_voiture.class new file mode 100644 index 0000000..deb12a2 Binary files /dev/null and b/metaFinal/build/classes/services/reservation_voiture/IReservation_voiture.class differ diff --git a/metaFinal/build/classes/services/reservation_voiture/Reservation_voiture_Service.class b/metaFinal/build/classes/services/reservation_voiture/Reservation_voiture_Service.class new file mode 100644 index 0000000..fded250 Binary files /dev/null and b/metaFinal/build/classes/services/reservation_voiture/Reservation_voiture_Service.class differ diff --git a/metaFinal/build/classes/services/reservation_voyage/IReservation_Voyage.class b/metaFinal/build/classes/services/reservation_voyage/IReservation_Voyage.class new file mode 100644 index 0000000..0a818dc Binary files /dev/null and b/metaFinal/build/classes/services/reservation_voyage/IReservation_Voyage.class differ diff --git a/metaFinal/build/classes/services/reservation_voyage/Reservation_Voyage_Service.class b/metaFinal/build/classes/services/reservation_voyage/Reservation_Voyage_Service.class new file mode 100644 index 0000000..f5d3d44 Binary files /dev/null and b/metaFinal/build/classes/services/reservation_voyage/Reservation_Voyage_Service.class differ diff --git a/metaFinal/build/classes/services/user/IuserService.class b/metaFinal/build/classes/services/user/IuserService.class new file mode 100644 index 0000000..2783508 Binary files /dev/null and b/metaFinal/build/classes/services/user/IuserService.class differ diff --git a/metaFinal/build/classes/services/user/LoginAndSignupService.class b/metaFinal/build/classes/services/user/LoginAndSignupService.class new file mode 100644 index 0000000..2adb271 Binary files /dev/null and b/metaFinal/build/classes/services/user/LoginAndSignupService.class differ diff --git a/metaFinal/build/classes/services/user/UserService.class b/metaFinal/build/classes/services/user/UserService.class new file mode 100644 index 0000000..3825036 Binary files /dev/null and b/metaFinal/build/classes/services/user/UserService.class differ diff --git a/metaFinal/build/classes/services/voiture/VoitureCRUD.class b/metaFinal/build/classes/services/voiture/VoitureCRUD.class new file mode 100644 index 0000000..4046864 Binary files /dev/null and b/metaFinal/build/classes/services/voiture/VoitureCRUD.class differ diff --git a/metaFinal/build/classes/services/voyage/IVoyage.class b/metaFinal/build/classes/services/voyage/IVoyage.class new file mode 100644 index 0000000..57bc341 Binary files /dev/null and b/metaFinal/build/classes/services/voyage/IVoyage.class differ diff --git a/metaFinal/build/classes/services/voyage/voyageService.class b/metaFinal/build/classes/services/voyage/voyageService.class new file mode 100644 index 0000000..8fc99e2 Binary files /dev/null and b/metaFinal/build/classes/services/voyage/voyageService.class differ diff --git a/metaFinal/build/classes/services/voyage/voyage_organise/IVoyage_ORG_Service.class b/metaFinal/build/classes/services/voyage/voyage_organise/IVoyage_ORG_Service.class new file mode 100644 index 0000000..cbfd46d Binary files /dev/null and b/metaFinal/build/classes/services/voyage/voyage_organise/IVoyage_ORG_Service.class differ diff --git a/metaFinal/build/classes/services/voyage/voyage_organise/VoyageORG_Service.class b/metaFinal/build/classes/services/voyage/voyage_organise/VoyageORG_Service.class new file mode 100644 index 0000000..686ffd7 Binary files /dev/null and b/metaFinal/build/classes/services/voyage/voyage_organise/VoyageORG_Service.class differ diff --git a/metaFinal/build/classes/services/voyage/voyage_virtuel/IVoyage_VRT_Service.class b/metaFinal/build/classes/services/voyage/voyage_virtuel/IVoyage_VRT_Service.class new file mode 100644 index 0000000..49ae2f9 Binary files /dev/null and b/metaFinal/build/classes/services/voyage/voyage_virtuel/IVoyage_VRT_Service.class differ diff --git a/metaFinal/build/classes/services/voyage/voyage_virtuel/VoyageVRT_Service.class b/metaFinal/build/classes/services/voyage/voyage_virtuel/VoyageVRT_Service.class new file mode 100644 index 0000000..81faf35 Binary files /dev/null and b/metaFinal/build/classes/services/voyage/voyage_virtuel/VoyageVRT_Service.class differ diff --git a/metaFinal/manifest.mf b/metaFinal/manifest.mf new file mode 100644 index 0000000..328e8e5 --- /dev/null +++ b/metaFinal/manifest.mf @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +X-COMMENT: Main-Class will be added automatically by build + diff --git a/metaFinal/nbproject/build-impl.xml b/metaFinal/nbproject/build-impl.xml new file mode 100644 index 0000000..3b63fb7 --- /dev/null +++ b/metaFinal/nbproject/build-impl.xml @@ -0,0 +1,1419 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set src.dir + Must set test.src.dir + Must set build.dir + Must set dist.dir + Must set build.classes.dir + Must set dist.javadoc.dir + Must set build.test.classes.dir + Must set build.test.results.dir + Must set build.classes.excludes + Must set dist.jar + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + No tests executed. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must set JVM to use for profiling in profiler.info.jvm + Must set profiler agent JVM arguments in profiler.info.jvmargs.agent + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + To run this application from the command line without Ant, try: + + java -jar "${dist.jar.resolved}" + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + Must select one file in the IDE or set run.class + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set debug.class + + + + + Must select one file in the IDE or set debug.class + + + + + Must set fix.includes + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + Must select one file in the IDE or set profile.class + This target only works when run from inside the NetBeans IDE. + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + This target only works when run from inside the NetBeans IDE. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select one file in the IDE or set run.class + + + + + + Must select some files in the IDE or set test.includes + + + + + Must select one file in the IDE or set run.class + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Must select some files in the IDE or set javac.includes + + + + + + + + + + + + + + + + + + + + Some tests failed; see details above. + + + + + + + + + Must select some files in the IDE or set test.includes + + + + Some tests failed; see details above. + + + + Must select some files in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + Some tests failed; see details above. + + + + + Must select one file in the IDE or set test.class + + + + Must select one file in the IDE or set test.class + Must select some method in the IDE or set test.method + + + + + + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + Must select one file in the IDE or set applet.url + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/metaFinal/nbproject/genfiles.properties b/metaFinal/nbproject/genfiles.properties new file mode 100644 index 0000000..50f2a9e --- /dev/null +++ b/metaFinal/nbproject/genfiles.properties @@ -0,0 +1,8 @@ +build.xml.data.CRC32=10b9b6da +build.xml.script.CRC32=ded639b5 +build.xml.stylesheet.CRC32=8064a381@1.75.2.48 +# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. +# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. +nbproject/build-impl.xml.data.CRC32=10b9b6da +nbproject/build-impl.xml.script.CRC32=20ce334f +nbproject/build-impl.xml.stylesheet.CRC32=05530350@1.79.1.48 diff --git a/metaFinal/nbproject/private/private.properties b/metaFinal/nbproject/private/private.properties new file mode 100644 index 0000000..c7d39b3 --- /dev/null +++ b/metaFinal/nbproject/private/private.properties @@ -0,0 +1 @@ +user.properties.file=C:\\Users\\medal\\AppData\\Roaming\\NetBeans\\8.1\\build.properties diff --git a/metaFinal/nbproject/project.properties b/metaFinal/nbproject/project.properties new file mode 100644 index 0000000..c05826e --- /dev/null +++ b/metaFinal/nbproject/project.properties @@ -0,0 +1,75 @@ +annotation.processing.enabled=true +annotation.processing.enabled.in.editor=false +annotation.processing.processor.options= +annotation.processing.processors.list= +annotation.processing.run.all.processors=true +annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output +build.classes.dir=${build.dir}/classes +build.classes.excludes=**/*.java,**/*.form +# This directory is removed when the project is cleaned: +build.dir=build +build.generated.dir=${build.dir}/generated +build.generated.sources.dir=${build.dir}/generated-sources +# Only compile against the classpath explicitly listed here: +build.sysclasspath=ignore +build.test.classes.dir=${build.dir}/test/classes +build.test.results.dir=${build.dir}/test/results +# Uncomment to specify the preferred debugger connection transport: +#debug.transport=dt_socket +debug.classpath=\ + ${run.classpath} +debug.test.classpath=\ + ${run.test.classpath} +# Files in build.classes.dir which should be excluded from distribution jar +dist.archive.excludes= +# This directory is removed when the project is cleaned: +dist.dir=dist +dist.jar=${dist.dir}/metatrip2.jar +dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** +jar.compress=false +javac.classpath=\ + ${libs.MySQLDriver.classpath} +# Space-separated list of extra javac options +javac.compilerargs= +javac.deprecation=false +javac.external.vm=true +javac.processorpath=\ + ${javac.classpath} +javac.source=1.8 +javac.target=1.8 +javac.test.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +javac.test.processorpath=\ + ${javac.test.classpath} +javadoc.additionalparam= +javadoc.author=false +javadoc.encoding=${source.encoding} +javadoc.noindex=false +javadoc.nonavbar=false +javadoc.notree=false +javadoc.private=false +javadoc.splitindex=true +javadoc.use=true +javadoc.version=false +javadoc.windowtitle= +main.class=Config.Metatrip +manifest.file=manifest.mf +meta.inf.dir=${src.dir}/META-INF +mkdist.disabled=false +platform.active=default_platform +run.classpath=\ + ${javac.classpath}:\ + ${build.classes.dir} +# Space-separated list of JVM arguments used when running the project. +# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value. +# To set system properties for unit tests define test-sys-prop.name=value: +run.jvmargs= +run.test.classpath=\ + ${javac.test.classpath}:\ + ${build.test.classes.dir} +source.encoding=UTF-8 +src.dir=src +test.src.dir=test diff --git a/metaFinal/nbproject/project.xml b/metaFinal/nbproject/project.xml new file mode 100644 index 0000000..c665fe8 --- /dev/null +++ b/metaFinal/nbproject/project.xml @@ -0,0 +1,15 @@ + + + org.netbeans.modules.java.j2seproject + + + metatrip2 + + + + + + + + + diff --git a/metaFinal/src/Config/Datasource.java b/metaFinal/src/Config/Datasource.java new file mode 100644 index 0000000..4ad9fd3 --- /dev/null +++ b/metaFinal/src/Config/Datasource.java @@ -0,0 +1,47 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ +package Config; +import java.sql.*; +import java.util.logging.Level; +import java.util.logging.Logger; +/** + * + * @author remo + */ +public class Datasource { + + private static String url = "jdbc:mysql://localhost:3306/metatrip"; + private static String user = "root"; + private static String pwd = ""; + + private Connection cnx; + private static Datasource instance; + + private Datasource() { + try { + cnx = DriverManager.getConnection(url, user, pwd); + System.out.println("database connected"); + } catch (SQLException ex) { + System.err.println(ex.getMessage()); + } + } + + public Connection getCnx() { + return cnx; + } + + + public static Datasource getInstance() { + if(instance == null){ + instance = new Datasource(); + } + return instance; + } + + + + + +} diff --git a/metaFinal/src/Config/Metatrip.java b/metaFinal/src/Config/Metatrip.java new file mode 100644 index 0000000..4476bb3 --- /dev/null +++ b/metaFinal/src/Config/Metatrip.java @@ -0,0 +1,240 @@ + +package Config; + +import entities.Voiture; +import entities.Voyage_virtuel; +import entities.abonnement; +import entities.evenement; +import entities.hotel; +import entities.reservation_event; +import entities.reservation_hotel; +import entities.reservation_voiture; +import entities.user; +import entities.voyage; +import entities.voyage_organise; +import java.security.MessageDigest; +import java.security.NoSuchAlgorithmException; +import java.sql.Date; +import services.abonnement.abonnement_Service; +import services.evenement.Serviceevenement; +import services.evenement.Servicereservation_event; +import services.hotel.HotelCRUD; +import services.reservation_hotel.Reserrvation_Hotel_Service; +import services.reservation_voiture.Reservation_voiture_Service; +import services.reservation_voyage.Reservation_Voyage_Service; +import services.user.LoginAndSignupService; +import services.user.UserService; +import services.voiture.VoitureCRUD; +import services.voyage.voyageService; +import services.voyage.voyage_organise.VoyageORG_Service; +import services.voyage.voyage_virtuel.VoyageVRT_Service; + +/** + * + * @author FLAM + */ + +/** + * + * @author FLAM + */ +public class Metatrip { + + /** + * @param args the command line arguments + */ + public static void main(String[] args) throws Exception { + // TODO code application logic here + Datasource data = Datasource.getInstance(); + Datasource data2 = Datasource.getInstance(); + System.out.println(data.hashCode() + "-" + data2.hashCode()); + + UserService us = new UserService(); + Reservation_Voyage_Service rvs= new Reservation_Voyage_Service(); + + voyageService vs= new voyageService(); + + VoyageORG_Service vos = new VoyageORG_Service(); + abonnement_Service a = new abonnement_Service(); + VoyageVRT_Service vov = new VoyageVRT_Service(); + LoginAndSignupService loginSignup = new LoginAndSignupService(); + + HotelCRUD hc=new HotelCRUD(); + String xx="2010-09-11"; + String xx2="2011-10-01"; + Date date=Date.valueOf(xx); + Date date2=Date.valueOf(xx2); + + Date datedebut = Date.valueOf(xx); + Date datefinal = Date.valueOf(xx2 );//converting string into sql date + voyage v2024 = new voyage(2024, "Madrid", "c://madrid.png"); + + abonnement abon1 = new abonnement(2, "ss", 90, datedebut, datefinal, "Etat", 1); + abonnement abon2 = new abonnement("ss", 90, datedebut, datefinal, "Etat", 1); + + // a.ajouter(abon1); + Voyage_virtuel vov2 = new Voyage_virtuel("Videsso", "Image", abon1, v2024); + //vov.afficher(); + //vov.ajouter(vov2); + // vov.modifier(3,vov2); + // vov.supprimer(3); + + user u1 = new user(9999, 5866, "dafdouf", "zakzouk", 5895, "zak@live.fr", "0000", "image",date2); + // us.ajouter(u1); + //us.supprimer(810); + user u3 = new user(5866, "ges", "nay", 5895, "zak@live.fr", "0000", "image",date2); + user u4 = new user(58656, "khaldi", "imen", 5895, "zak@live.fr", "0000", "image",date2); + + voyage v = new voyage(501,"tounis", "c://berlin.png"); + voyage chrf = new voyage(967,"istanbul", "c://antalya.png"); + voyage v1 = new voyage( 55555,"espagne", "c://espagne.png"); + // vs.ajout(v1); + //vs.ajout(v1); + // System.out.println(vs.afficher()); + // System.out.println( v1.getPays()); + // System.out.println(v.getIdv()); + + //voyage_organise vo2=new voyage_organise(5,50.6f,"Lufthansa",15,5,"torkiya","c://assets"); + /* voyage_organise vo3 = new voyage_organise(170.6f, "nex", 3, v); + voyage_organise vo4 = new voyage_organise(10.6f, "flam", 3, v);*/ + voyage_organise vom = new voyage_organise(990.6f, "sounay", 3); + + + + String str="2020-09-01"; + String str2="2050-09-01"; + Date date1=Date.valueOf(str); + Date date9=Date.valueOf(str2);//converting string into sql date System.out.println(date); + user u2 = new user(99925, "ssss", "cxx", 2568435, "fares@live.fr", doHashing("12345678"), "image",date9); + LoginAndSignupService LASS =new LoginAndSignupService(); + //LASS.Signup(u2); + System.out.println(LASS.login("nex@live.fr", "aaaa")); + // us.ajouter(u1); + // reservation_voyage rv=new reservation_voyage(); + // rv.setIdrv(999); + + /* rv.setDate_depart(date); + rv.setDate_arrivee(date2); + rv.setEtat("Paye"); + + rv.setRef_paiement(1); + rv.setUser(u2); + rv.setVoyage(chrf); */ + + //rvs.ajouter(rv); + //rvs.modifier(10, rv); + //rvs.supprimer(6); + // System.out.println(rvs.afficher()); + + + //System.out.println(vo3.getVoyage()); + // vos.ajouter(vo3); + // vos.ajouter(vo4); + //vos.modifier(79, vom); + + //vs.modifier(97,chrf); + //vs.supprimer(360); + + //System.out.println(vos.afficher()); + // System.out.println(vo3.toString()); + + //us.modifier(1,u3); + // System.out.print(p.getId()); + //us.supprimer(4); + //ps.modifier(p); + + // System.out.print("ss"+us.afficher()); + //System.out.print(loginSignup.login("'zak@live.fr'", "0000")); + Voiture v99 =new Voiture(95,"220TU120",12,"image","Mercedes"); + VoitureCRUD VC=new VoitureCRUD(); + //VC.ajouterVoiture(v99); + Voiture v98 =new Voiture(3,"220TU120",12,"image","bmw"); + //VC.modifierVoiture(v98); + reservation_voiture rhv=new reservation_voiture(); + Reservation_voiture_Service rvs55= new Reservation_voiture_Service(); + /* rhv.setChauffeur("mohamed salah"); + rhv.setPrix_rent((float) 5.5); + rhv.setTrajet("jerba"); + rhv.setUser(u2); + rhv.setVoiture(v99);*/ + + user u8 = new user(811,199525, "ssss", "cxx", 2568435, "nex@live.fr", doHashing("12345678"), "image",date2); + // us.ajouter(u8); + Voiture v78 =new Voiture(2001,"220TU120",12,"image","bmw"); + // VC.ajouterVoiture(v78); + + reservation_voiture rhv1=new reservation_voiture(5.5f,"cccc","jandouba",u8,v78); + + + + //rvs55.ajouter(rhv1); + // rvs55.modifier(2,rhv1); + //rvs55.supprimer(2); + // rvs55.afficher().toString(); + + + + hotel h=new hotel("4 seasons",4,"gammarth"); + hotel h2=new hotel(12,"gulden tulip",4,"gammarth"); + // hc.ajouterHotel(h2); + // hc.modifierHotel(h2); + // hc.supprimerHotel(h2); + Reserrvation_Hotel_Service rhs=new Reserrvation_Hotel_Service (); + + reservation_hotel rh =new reservation_hotel("single",2,1,2.2f,u8,h2,date1,date9); + // rhs.ajouter(rh); + // rhs.modifier(2, rh); + // rhs.supprimer(2); + + + + + Serviceevenement se = new Serviceevenement() ; + evenement e = new evenement(2, "hhhuhonl", "c", "7 rue 2938", date1, 12.0f) ; + evenement e1 = new evenement(4, "aaaaaaa", "c", "7 rue 2938", date1, 120.0f) ; + //se.ajouter(e1); + //se.modifier(e); + // se.supprimer(1); + // System.out.println(se.afficher()); + user ux = new user(817,195, "nex", "nex", 256845, "nex@live.fr", "aaaa", "image",date); + //us.ajouter(ux); + Servicereservation_event resE=new Servicereservation_event(); + reservation_event resev=new reservation_event(22,82,e,ux); + //resE.ajout(resev); + // resE.modifier(22,resev); + //resE.supprimer(22); + + //System.out.println(resE.afficher()); + + + + + + } + + + public static String doHashing(String password) { + try { + MessageDigest messageDigest = MessageDigest.getInstance("MD5"); + + messageDigest.update(password.getBytes()); + + byte[] resultByteArray = messageDigest.digest(); + + StringBuilder sb = new StringBuilder(); + + for (byte b : resultByteArray) { + sb.append(String.format("%02x", b)); + } + + return sb.toString(); + + } catch (NoSuchAlgorithmException e) { + e.printStackTrace(); + } + + return ""; + } + +} + diff --git a/metaFinal/src/entities/EtatPayment.java b/metaFinal/src/entities/EtatPayment.java new file mode 100644 index 0000000..a5b8af6 --- /dev/null +++ b/metaFinal/src/entities/EtatPayment.java @@ -0,0 +1,18 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package entities; + +/** + * + * @author FLAM + */ +public enum EtatPayment { + NonPaye, + Paye, + EnCours, + Annule, + +} diff --git a/metaFinal/src/entities/Voiture.java b/metaFinal/src/entities/Voiture.java new file mode 100644 index 0000000..3e36555 --- /dev/null +++ b/metaFinal/src/entities/Voiture.java @@ -0,0 +1,95 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package entities; + +/** + * + * @author Nayrouz + * + + */ +public class Voiture { + private int Idvoit ; + private String Matricule ; + private int Puissance_fiscalle ; + private String Image_v; + private String Modele ; + + + public Voiture (){ + } + + public Voiture(int Idvoit) { + this.Idvoit = Idvoit; + } + + public Voiture(String Matricule, int Puissance_fiscalle, String Image_v, String Modele) { + this.Matricule = Matricule; + this.Puissance_fiscalle = Puissance_fiscalle; + this.Image_v = Image_v; + this.Modele = Modele; + } + + + + public Voiture(int Idvoit, String Matricule, int Puissance_fiscalle, String Image_v, String Modele) { + this.Idvoit = Idvoit; + this.Matricule = Matricule; + this.Puissance_fiscalle = Puissance_fiscalle; + this.Image_v = Image_v; + this.Modele = Modele; + } + + public int getIdvoit() { + return Idvoit; + } + + public String getMatricule() { + return Matricule; + } + + public int getPuissance_fiscalle() { + return Puissance_fiscalle; + } + + public String getImage_v() { + return Image_v; + } + + + + public String getModele() { + return Modele; + } + + public void setIdvoit(int Idvoit) { + this.Idvoit = Idvoit; + } + + public void setMatricule(String Matricule) { + this.Matricule = Matricule; + } + + public void setPuissance_fiscalle(int Puissance_fiscalle) { + this.Puissance_fiscalle = Puissance_fiscalle; + } + + public void setImage_v(String Image_v) { + this.Image_v = Image_v; + } + + public void setModele(String Modele) { + this.Modele = Modele; + } + + @Override + public String toString() { + return "Voiture{" + "Idvoit=" + Idvoit + ", Matricule=" + Matricule + ", Puissance_fiscalle=" + Puissance_fiscalle + ", Image_v=" + Image_v + ", Modele=" + Modele + '}'; + } + + +} + diff --git a/metaFinal/src/entities/Voyage_virtuel.java b/metaFinal/src/entities/Voyage_virtuel.java new file mode 100644 index 0000000..2d96d25 --- /dev/null +++ b/metaFinal/src/entities/Voyage_virtuel.java @@ -0,0 +1,123 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package entities; + +/** + * + * @author User + */ +public class Voyage_virtuel extends voyage { + + private int Idvv; + private String Video; + private String Image_v; + private abonnement abonnement; + + private voyage voyage; + + public Voyage_virtuel(int Idvv, String Video, String Image_v, voyage voyage, String pays, String Image_pays) { + super(pays, Image_pays); + this.Idvv = Idvv; + this.Video = Video; + this.Image_v = Image_v; + this.voyage = voyage; + } + + public Voyage_virtuel(int Idvv, String Video, String Image_v, voyage voyage, int Idv, String pays, String Image_pays) { + super(Idv, pays, Image_pays); + this.Idvv = Idvv; + this.Video = Video; + this.Image_v = Image_v; + this.voyage = voyage; + } + + public Voyage_virtuel(int Idvv, String Video, String Image_v, voyage voyage) { + this.Idvv = Idvv; + this.Video = Video; + this.Image_v = Image_v; + this.voyage = voyage; + } + + public Voyage_virtuel(int Idvv, String Video, String Image_v, voyage voyage, int Idv) { + super(Idv); + this.Idvv = Idvv; + this.Video = Video; + this.Image_v = Image_v; + this.voyage = voyage; + } + + public Voyage_virtuel() { + this.Idvv=Idvv; + } + + public Voyage_virtuel(int Idvv) { + this.Idvv = Idvv; + } + + public Voyage_virtuel(String Video, String Image_v, voyage voyage) { + this.Video = Video; + this.Image_v = Image_v; + this.voyage = voyage; + } + + public int getIdvv() { + return Idvv; + } + + public void setIdvv(int Idvv) { + this.Idvv = Idvv; + } + + public String getVideo() { + return Video; + } + + public void setVideo(String Video) { + this.Video = Video; + } + + public String getImage_v() { + return Image_v; + } + + public void setImage_v(String Image_v) { + this.Image_v = Image_v; + } + + public voyage getVoyage() { + return voyage; + } + + public void setVoyage(voyage voyage) { + this.voyage = voyage; + } + + public Voyage_virtuel(String Video, String Image_v, abonnement abonnement, voyage voyage) { + this.Video = Video; + this.Image_v = Image_v; + this.abonnement = abonnement; + this.voyage = voyage; + } + + public abonnement getAbonnement() { + return abonnement; + } + + public void setAbonnement(abonnement abonnement) { + this.abonnement = abonnement; + } + + public Voyage_virtuel(int Idvv, String Video, String Image_v, abonnement abonnement, voyage voyage) { + this.Idvv = Idvv; + this.Video = Video; + this.Image_v = Image_v; + this.abonnement = abonnement; + this.voyage = voyage; + } + + + +} diff --git a/metaFinal/src/entities/abonnement.java b/metaFinal/src/entities/abonnement.java new file mode 100644 index 0000000..f16a4b2 --- /dev/null +++ b/metaFinal/src/entities/abonnement.java @@ -0,0 +1,112 @@ +package entities; + +import java.sql.Date; + +/** + * + * @author ASUS I7 + */ +public class abonnement { + + private int Ida; + private String Type; + private int Prix_a; + private Date Date_achat; + private Date Date_expiration; + private String Etat; + private int Ref_paiment; + + public abonnement() { + } + + public abonnement(String Type, int Prix_a, Date Date_achat, Date Date_expiration, String Etat, int Ref_paiment) { + this.Type = Type; + this.Prix_a = Prix_a; + this.Date_achat = Date_achat; + this.Date_expiration = Date_expiration; + this.Etat = Etat; + this.Ref_paiment = Ref_paiment; + } + + public abonnement(int Ida, String Type, int Prix_a, Date Date_achat, Date Date_expiration, String Etat, int Ref_paiment) { + this.Ida = Ida; + this.Type = Type; + this.Prix_a = Prix_a; + this.Date_achat = Date_achat; + this.Date_expiration = Date_expiration; + this.Etat = Etat; + this.Ref_paiment = Ref_paiment; + + +} + + public int getIda() { + return Ida; + } + + public void setIda(int Ida) { + this.Ida = Ida; + } + + public String getType() { + return Type; + } + + public void setType(String Type) { + this.Type = Type; + } + + public int getPrix_a() { + return Prix_a; + } + + public void setPrix_a(int Prix_a) { + this.Prix_a = Prix_a; + } + + public Date getDate_achat() { + return Date_achat; + } + + public void setDate_achat(Date Date_achat) { + this.Date_achat = Date_achat; + } + + public Date getDate_expiration() { + return Date_expiration; + } + + public void setDate_expiration(Date Date_expiration) { + this.Date_expiration = Date_expiration; + } + + public String getEtat() { + return Etat; + } + + public void setEtat(String Etat) { + this.Etat = Etat; + } + + public int getRef_paiment() { + return Ref_paiment; + } + + public void setRef_paiment(int Ref_paiment) { + this.Ref_paiment = Ref_paiment; + } + + + + + + + + + + + + + + +} diff --git a/metaFinal/src/entities/evenement.java b/metaFinal/src/entities/evenement.java new file mode 100644 index 0000000..02443e4 --- /dev/null +++ b/metaFinal/src/entities/evenement.java @@ -0,0 +1,105 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package entities; + +import java.sql.Date; + + + +/** + * + * @author Z4RGA + */ +public class evenement { + + private int Ide; + private String Type_event ; + private String Chanteur ; + private String Adresse; + private Date Date_event ; + private float prix_e ; + + public evenement() { + } + + public evenement(int Ide) { + this.Ide = Ide; + } + + public evenement(int Ide, String Type_event, String Chanteur, String Adresse, Date Date_event, float prix_e) { + this.Ide = Ide; + this.Type_event = Type_event; + this.Chanteur = Chanteur; + this.Adresse = Adresse; + this.Date_event = Date_event; + this.prix_e = prix_e; + } + + + + public evenement(String Type_event, String Chanteur, String Adresse, Date Date_event, float prix_e) { + this.Type_event = Type_event; + this.Chanteur = Chanteur; + this.Adresse = Adresse; + this.Date_event = Date_event; + this.prix_e = prix_e; + } + + public int getIde() { + return Ide; + } + + public String getType_event() { + return Type_event; + } + + public String getChanteur() { + return Chanteur; + } + + public String getAdresse() { + return Adresse; + } + + public Date getDate_event() { + return Date_event; + } + + public float getPrix_e() { + return prix_e; + } + + public void setIde(int Ide) { + this.Ide = Ide; + } + + public void setType_event(String Type_event) { + this.Type_event = Type_event; + } + + public void setChanteur(String Chanteur) { + this.Chanteur = Chanteur; + } + + public void setAdresse(String Adresse) { + this.Adresse = Adresse; + } + + public void setDate_event(Date Date_event) { + this.Date_event = Date_event; + } + + public void setPrix_e(float prix_e) { + this.prix_e = prix_e; + } + + @Override + public String toString() { + return "evenement{" + "Ide=" + Ide + ", Type_event=" + Type_event + ", Chanteur=" + Chanteur + ", Adresse=" + Adresse + ", Date_event=" + Date_event + ", prix_e=" + prix_e + '}'; + } + + +} diff --git a/metaFinal/src/entities/hotel.java b/metaFinal/src/entities/hotel.java new file mode 100644 index 0000000..7430354 --- /dev/null +++ b/metaFinal/src/entities/hotel.java @@ -0,0 +1,71 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package entities; + +/** + * + * @author medal + */ +public class hotel { + private int idh; + private String Nom_hotel; + private int Nb_etoiles; + private String Adresse ; + + public hotel() { + } + + public hotel(String Nom_hotel, int Nb_etoiles, String Adresse) { + this.Nom_hotel = Nom_hotel; + this.Nb_etoiles = Nb_etoiles; + this.Adresse = Adresse; + } + + public hotel(int idh, String Nom_hotel, int Nb_etoiles, String Adresse) { + this.idh = idh; + this.Nom_hotel = Nom_hotel; + this.Nb_etoiles = Nb_etoiles; + this.Adresse=Adresse; + } + + public hotel(int idh) { + this.idh = idh; + } + + public int getIdh() { + return idh; + } + + public String getNom_hotel() { + return Nom_hotel; + } + + public int getNb_etoiles() { + return Nb_etoiles; + } + + public String getAdresse() { + return Adresse; + } + + public void setIdh(int idh) { + this.idh = idh; + } + + public void setNom_hotel(String Nom_hotel) { + this.Nom_hotel = Nom_hotel; + } + + public void setNb_etoiles(int Nb_etoiles) { + this.Nb_etoiles = Nb_etoiles; + } + + public void setAdresse(String Adresse) { + this.Adresse = Adresse; + } + + +} diff --git a/metaFinal/src/entities/paiement.java b/metaFinal/src/entities/paiement.java new file mode 100644 index 0000000..b02ab0b --- /dev/null +++ b/metaFinal/src/entities/paiement.java @@ -0,0 +1,44 @@ + +package entities; + +import java.util.Date; + +/** + * + * @author FLAM + */ +public class paiement { + private int Ref_paiement; + private Date Date_paiement; + + public paiement(int Ref_paiement, Date Date_paiement) { + this.Ref_paiement = Ref_paiement; + this.Date_paiement = Date_paiement; + } + + public paiement() { + } + + public int getRef_paiement() { + return Ref_paiement; + } + + public Date getDate_paiement() { + return Date_paiement; + } + + public void setRef_paiement(int Ref_paiement) { + this.Ref_paiement = Ref_paiement; + } + + public void setDate_paiement(Date Date_paiement) { + this.Date_paiement = Date_paiement; + } + + @Override + public String toString() { + return "paiement{" + "Ref_paiement=" + Ref_paiement + ", Date_paiement=" + Date_paiement + '}'; + } + + +} diff --git a/metaFinal/src/entities/reservation_event.java b/metaFinal/src/entities/reservation_event.java new file mode 100644 index 0000000..0ac0ce0 --- /dev/null +++ b/metaFinal/src/entities/reservation_event.java @@ -0,0 +1,129 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package entities; + +import entities.user; + +/** + * + * @author Z4RGA + */ +public class reservation_event{ + + private int Idrev ; + private int Nb_pers; + + + private evenement evenement ; + private user user ; + private int Ide; + private int Idu; + + public reservation_event() { + } + + public reservation_event(int Nb_pers, evenement event, user user) { + this.Nb_pers = Nb_pers; + this.evenement = event; + this.user = user; + } + + public reservation_event(int Idrev, int Nb_pers, int Ide, int Idu, evenement evenement, user user) { + this.Idrev = Idrev; + this.Nb_pers = Nb_pers; + this.Ide = Ide; + this.Idu = Idu; + this.evenement = evenement; + this.user = user; + + } + + + public reservation_event(int Idrev, int Nb_pers, evenement event, user user) { + this.Idrev = Idrev; + this.Nb_pers = Nb_pers; + this.evenement = event; + this.user = user; + } + + public reservation_event(int Idrev, int Nb_pers, int Ide, int Idu) { + this.Idrev = Idrev; + this.Nb_pers = Nb_pers; + this.Ide = Ide; + this.Idu = Idu; + } + + public int getIde() { + return Ide; + } + + public void setIde(int Ide) { + this.Ide = Ide; + } + + public int getIdu() { + return Idu; + } + + public void setIdu(int Idu) { + this.Idu = Idu; + } + + + + + public reservation_event(int Nb_pers) { + this.Nb_pers = Nb_pers; + } + + + public evenement getEvenement() { + return evenement; + } + + public user getUser() { + return user; + } + + + + + public int getIdrev() { + return Idrev; + } + + public int getNb_pers() { + return Nb_pers; + } + + public void setIdrev(int Idrev) { + this.Idrev = Idrev; + } + + public void setNb_pers(int Nb_pers) { + this.Nb_pers = Nb_pers; + } + + public void setEvenement(evenement evenement) { + this.evenement = evenement; + } + + public void setUser(user user) { + this.user = user; + } + + + + + @Override + public String toString() { + return "reservation_event{" + "Idrev=" + Idrev + ", Nb_pers=" + Nb_pers + '}'; + } + + + + +} diff --git a/metaFinal/src/entities/reservation_hotel.java b/metaFinal/src/entities/reservation_hotel.java new file mode 100644 index 0000000..0f925c2 --- /dev/null +++ b/metaFinal/src/entities/reservation_hotel.java @@ -0,0 +1,201 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package entities; + +import entities.user; +import java.sql.Date; + + +/** + * + * @author medal + */ +public class reservation_hotel { + private int Idrh; + private String Type_room; + private int Nb_nuitees ; + private int Nb_personnes ; + private float Prix ; + + + private user user; + private hotel hotel; + private int Idu; + private int Idh; + private Date Date_depart; + private Date Date_arrivee; + + public reservation_hotel(int Idrh, String Type_room, int Nb_nuitees, int Nb_personnes, float Prix, user user, hotel hotel) { + this.Idrh = Idrh; + this.Type_room = Type_room; + this.Nb_nuitees = Nb_nuitees; + this.Nb_personnes = Nb_personnes; + this.Prix = Prix; + this.user = user; + this.hotel = hotel; + } + + public reservation_hotel() { + } + + public reservation_hotel(int Idrh, String Type_room, int Nb_nuitees, int Nb_personnes, float Prix, user user, hotel hotel, int Idu, int Idh, Date Date_depart, Date Date_arrivee) { + this.Idrh = Idrh; + this.Type_room = Type_room; + this.Nb_nuitees = Nb_nuitees; + this.Nb_personnes = Nb_personnes; + this.Prix = Prix; + this.user = user; + this.hotel = hotel; + this.Idu = Idu; + this.Idh = Idh; + this.Date_depart = Date_depart; + this.Date_arrivee = Date_arrivee; + } + + public reservation_hotel(String Type_room, int Nb_nuitees, int Nb_personnes, float Prix, int Idu, int Idh, Date Date_depart, Date Date_arrivee) { + this.Type_room = Type_room; + this.Nb_nuitees = Nb_nuitees; + this.Nb_personnes = Nb_personnes; + this.Prix = Prix; + this.Idu = Idu; + this.Idh = Idh; + this.Date_depart = Date_depart; + this.Date_arrivee = Date_arrivee; + } + + public reservation_hotel(String Type_room, int Nb_nuitees, int Nb_personnes, float Prix, user user, hotel hotel, Date Date_depart, Date Date_arrivee) { + this.Type_room = Type_room; + this.Nb_nuitees = Nb_nuitees; + this.Nb_personnes = Nb_personnes; + this.Prix = Prix; + this.user = user; + this.hotel = hotel; + this.Date_depart = Date_depart; + this.Date_arrivee = Date_arrivee; + } + + public int getIdu() { + return Idu; + } + + public void setIdu(int Idu) { + this.Idu = Idu; + } + + public int getIdh() { + return Idh; + } + + public void setIdh(int Idh) { + this.Idh = Idh; + } + + public Date getDate_depart() { + return Date_depart; + } + + public void setDate_depart(Date Date_depart) { + this.Date_depart = Date_depart; + } + + public Date getDate_arrivee() { + return Date_arrivee; + } + + public void setDate_arrivee(Date Date_arrivee) { + this.Date_arrivee = Date_arrivee; + } + + + + public reservation_hotel(String Type_room, int Nb_nuitees, int Nb_personnes, float Prix, user user, hotel hotel) { + this.Type_room = Type_room; + this.Nb_nuitees = Nb_nuitees; + this.Nb_personnes = Nb_personnes; + this.Prix = Prix; + this.user = user; + this.hotel = hotel; + } + + + + public reservation_hotel(String Type_room, int Nb_nuitees, int Nb_personnes, float Prix, hotel hotel, user user) { + this.Type_room = Type_room; + this.Nb_nuitees = Nb_nuitees; + this.Nb_personnes = Nb_personnes; + this.Prix = Prix; + this.user = user; + this.hotel = hotel; + } + + @Override + public String toString() { + return "reservation_hotel{" + "Idrh=" + Idrh + ", Type_room=" + Type_room + ", Nb_nuitees=" + Nb_nuitees + ", Nb_personnes=" + Nb_personnes + ", Prix=" + Prix + ", IDuser=" + user.getIdu() + ", IDhotel=" + hotel.getIdh() + '}'; + } + + public void setIdrh(int Idrh) { + this.Idrh = Idrh; + } + + public void setType_room(String Type_room) { + this.Type_room = Type_room; + } + + public void setNb_nuitees(int Nb_nuitees) { + this.Nb_nuitees = Nb_nuitees; + } + + public void setNb_personnes(int Nb_personnes) { + this.Nb_personnes = Nb_personnes; + } + + public void setPrix(float Prix) { + this.Prix = Prix; + } + + public void setUser(user user) { + this.user = user; + } + + public void setHotel(hotel hotel) { + this.hotel = hotel; + } + + public int getIdrh() { + return Idrh; + } + + public String getType_room() { + return Type_room; + } + + public int getNb_nuitees() { + return Nb_nuitees; + } + + public int getNb_personnes() { + return Nb_personnes; + } + + public float getPrix() { + return Prix; + } + + public user getUser() { + return user; + } + + public hotel getHotel() { + return hotel; + } + + + + + + + +} diff --git a/metaFinal/src/entities/reservation_voiture.java b/metaFinal/src/entities/reservation_voiture.java new file mode 100644 index 0000000..997146a --- /dev/null +++ b/metaFinal/src/entities/reservation_voiture.java @@ -0,0 +1,125 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package entities; + +import entities.Voiture; +import entities.user; +import java.util.Date; + +/** + * + * @author medal + */ +public class reservation_voiture { +private int Idrvoit; + private float prix_rent; + private String Chauffeur; + private String Trajet; + private int Idu; + private int Idvoit; +private user user; +private Voiture Voiture; + + public reservation_voiture() { + } + + public reservation_voiture(int Idrvoit, float prix_rent, String Chauffeur, String Trajet, user user, Voiture Voiture) { + this.Idrvoit = Idrvoit; + this.prix_rent = prix_rent; + this.Chauffeur = Chauffeur; + this.Trajet = Trajet; + this.user = user; + this.Voiture = Voiture; + } + + public reservation_voiture(float prix_rent, String Chauffeur, String Trajet, int Idu, int Idvoit) { + this.prix_rent = prix_rent; + this.Chauffeur = Chauffeur; + this.Trajet = Trajet; + this.Idu = Idu; + this.Idvoit = Idvoit; + } + + + + public reservation_voiture(float prix_rent, String Chauffeur, String Trajet, user user, Voiture Voiture) { + this.prix_rent = prix_rent; + this.Chauffeur = Chauffeur; + this.Trajet = Trajet; + this.user = user; + this.Voiture = Voiture; + } + + public reservation_voiture(int Idrvoit, float prix_rent, String Chauffeur, String Trajet, int Idu, int Idvoit) { + this.Idrvoit = Idrvoit; + this.prix_rent = prix_rent; + this.Chauffeur = Chauffeur; + this.Trajet = Trajet; + this.Idu = Idu; + this.Idvoit = Idvoit; + } + + + public int getIdrvoit() { + return Idrvoit; + } + + public float getPrix_rent() { + return prix_rent; + } + + public String getChauffeur() { + return Chauffeur; + } + + public String getTrajet() { + return Trajet; + } + + public user getUser() { + return user; + } + + public Voiture getVoiture() { + return Voiture; + } + + public void setIdrvoit(int Idrvoit) { + this.Idrvoit = Idrvoit; + } + + public void setPrix_rent(float prix_rent) { + this.prix_rent = prix_rent; + } + + public void setChauffeur(String Chauffeur) { + this.Chauffeur = Chauffeur; + } + + public void setTrajet(String Trajet) { + this.Trajet = Trajet; + } + + public void setUser(user user) { + this.user = user; + } + + public void setVoiture(Voiture Voiture) { + this.Voiture = Voiture; + } + + public void setIdvoit(int i) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + @Override + public String toString() { + return "reservation_voiture{" + "Idrvoit=" + Idrvoit + ", prix_rent=" + prix_rent + ", Chauffeur=" + Chauffeur + ", Trajet=" + Trajet + ", user=" + user + ", Voiture=" + Voiture + '}'; + } + + + +} diff --git a/metaFinal/src/entities/reservation_voyage.java b/metaFinal/src/entities/reservation_voyage.java new file mode 100644 index 0000000..5c8ce7c --- /dev/null +++ b/metaFinal/src/entities/reservation_voyage.java @@ -0,0 +1,168 @@ + +package entities; + +import java.sql.Date; + +/** + * + * @author FLAM + */ +public class reservation_voyage { + private int Idrv; + private Date Date_depart; + private Date Date_arrivee; + private String etat; + private int Idu; + private int Idv; + private int Ref_paiement; + private user user; + private paiement paiement; + private voyage voyage; + + public reservation_voyage(int Idrv, Date Date_depart, Date Date_arrivee, String etat, int Idu, int Idv, int Ref_paiement) { + this.Idrv = Idrv; + this.Date_depart = Date_depart; + this.Date_arrivee = Date_arrivee; + this.etat = etat; + this.Idu = Idu; + this.Idv = Idv; + this.Ref_paiement = Ref_paiement; + } + + + + + + public reservation_voyage( Date Date_depart, Date Date_arrivee, String etat,user u,voyage voyage) { + + this.Date_depart = Date_depart; + this.Date_arrivee = Date_arrivee; + this.etat = etat; + this.user=u; + this.voyage=voyage; + } + + public reservation_voyage(int Idrv, Date Date_depart, Date Date_arrivee, String etat, user user, voyage voyage) { + this.Idrv = Idrv; + this.Date_depart = Date_depart; + this.Date_arrivee = Date_arrivee; + this.etat = etat; + this.user = user; + this.voyage = voyage; + } + + + + public reservation_voyage( int idr,Date Date_depart, Date Date_arrivee,user u,voyage voyage) { + this.Idrv=idr; + this.Date_depart = Date_depart; + this.Date_arrivee = Date_arrivee; + this.etat = "NonPaye"; + this.user=u; + this.voyage=voyage; + } + + public reservation_voyage(int Idrv, Date Date_depart, Date Date_arrivee, int Ref_paiement, user user, voyage voyage) { + this.Idrv = Idrv; + this.Date_depart = Date_depart; + this.Date_arrivee = Date_arrivee; + this.Ref_paiement = Ref_paiement; + this.user = user; + this.voyage = voyage; + } + + + + public reservation_voyage() { + this.etat="NonPaye"; } + + public int getIdrv() { + return Idrv; + } + + public Date getDate_depart() { + return Date_depart; + } + + public Date getDate_arrivee() { + return Date_arrivee; + } + + public String getEtat() { + return etat; + } + + public int getIdu() { + return Idu; + } + + public int getIdv() { + return Idv; + } + + public int getRef_paiement() { + return Ref_paiement; + } + + public user getUser() { + return user; + } + + public paiement getPaiement() { + return paiement; + } + + public voyage getVoyage() { + return voyage; + } + + public void setIdrv(int Idrv) { + this.Idrv = Idrv; + } + + public void setDate_depart(Date Date_depart) { + this.Date_depart = Date_depart; + } + + public void setDate_arrivee(Date Date_arrivee) { + this.Date_arrivee = Date_arrivee; + } + + public void setEtat(String etat) { + this.etat = etat; + } + + public void setIdu(int Idu) { + this.Idu = Idu; + } + + public void setIdv(int Idv) { + this.Idv = Idv; + } + + public void setRef_paiement(int Ref_paiement) { + this.Ref_paiement = Ref_paiement; + } + + public void setUser(user user) { + this.user = user; + } + + public void setPaiement(paiement paiement) { + this.paiement = paiement; + } + + public void setVoyage(voyage voyage) { + this.voyage = voyage; + } + + @Override + public String toString() { + return "reservation_voyage{" + "Idrv=" + Idrv + ", Date_depart=" + Date_depart + ", Date_arrivee=" + Date_arrivee + ", etat=" + etat + ", Idu=" + Idu + ", Idv=" + Idv + ", Ref_paiement=" + Ref_paiement + ", user=" + user + ", paiement=" + paiement + ", voyage=" + voyage + '}'; + } + + + + + +} diff --git a/metaFinal/src/entities/user.java b/metaFinal/src/entities/user.java new file mode 100644 index 0000000..8dfff45 --- /dev/null +++ b/metaFinal/src/entities/user.java @@ -0,0 +1,153 @@ +package entities; + +import java.sql.Date; + +/** + * + * @author FLAM + */ +public class user { + private int Idu; + private double Cin; + private String Nom; + private String Prenom; + private int Role; + + private double Tel; + private String Email; + private String Password; + private String Image; + private Date dateNaissance; + + + public user(int Idu, double Cin, String Nom, String Prenom, double Tel, String Email, String Password, String Image, Date dateNaissance) { + this.Idu = Idu; + this.Cin = Cin; + this.Nom = Nom; + this.Prenom = Prenom; + this.Tel = Tel; + this.Email = Email; + this.Password = Password; + this.Image = Image; + this.dateNaissance = dateNaissance; + } + + public user(int Idu) { + this.Idu = Idu; + } + + + public user(double Cin, + String Nom, + String Prenom, + double Tel, + String Email, + String Password, + String Image, + Date dateNaissance) { + this.Cin = Cin; + this.Nom = Nom; + this.Prenom = Prenom; + this.Tel = Tel; + this.Email = Email; + this.Password = Password; + this.Image = Image; + this.dateNaissance=dateNaissance; + } + + public user() { + + } + + public int getRole() { + return Role; + } + + public void setRole(int Role) { + this.Role = Role; + } + + public Date getDateNaissance() { + return dateNaissance; + } + + public void setDateNaissance(Date dateNaissance) { + this.dateNaissance = dateNaissance; + } + + + + public void setIdu(int Idu) { + this.Idu = Idu; + } + + public void setCin(double Cin) { + this.Cin = Cin; + } + + public void setNom(String Nom) { + this.Nom = Nom; + } + + public void setPrenom(String Prenom) { + this.Prenom = Prenom; + } + + public void setTel(double Tel) { + this.Tel = Tel; + } + + public void setEmail(String Email) { + this.Email = Email; + } + + public void setPassword(String Password) { + this.Password = Password; + } + + public void setImage(String Image) { + this.Image = Image; + } + + public int getIdu() { + return Idu; + } + + public double getCin() { + return Cin; + } + + public String getNom() { + return Nom; + } + + public String getPrenom() { + return Prenom; + } + + public double getTel() { + return Tel; + } + + public String getEmail() { + return Email; + } + + public String getPassword() { + return Password; + } + + + public String getImage() { + return Image; + } + + @Override + public String toString() { + return "user{" + "Idu=" + Idu + ", Cin=" + Cin + ", Nom=" + Nom + ", Prenom=" + Prenom + ", Tel=" + Tel + ", Email=" + Email + ", Password=" + Password + ", Image=" + Image + ", dateNaissance=" + dateNaissance + '}'; + } + + + + +} diff --git a/metaFinal/src/entities/voyage.java b/metaFinal/src/entities/voyage.java new file mode 100644 index 0000000..0c3dc9a --- /dev/null +++ b/metaFinal/src/entities/voyage.java @@ -0,0 +1,69 @@ + +package entities; + +/** + * + * @author FLAM + */ +public class voyage { + + private int Idv; + private String pays; + private String Image_pays; + + public voyage(String pays, String Image_pays) { + this.pays = pays; + this.Image_pays = Image_pays; + } + + public voyage(int Idv,String pays, String Image_pays) { + this.Idv = Idv; + this.pays = pays; + this.Image_pays = Image_pays; + } + + + public voyage(){} + + public voyage(int Idv) { + this.Idv = Idv; + } + + + public int getIdv() { + return Idv; + } + + public String getPays() { + return pays; + } + + public String getImage_pays() { + return Image_pays; + } + + public void setIdv(int Idv) { + this.Idv = Idv; + } + + public void setPays(String pays) { + this.pays = pays; + } + + public void setImage_pays(String Image_pays) { + this.Image_pays = Image_pays; + } + + @Override + public String toString() { + return "voyage{" + "Idv=" + Idv + ", pays=" + pays + ", Image_pays=" + Image_pays + '}'; + } + + + + + + + + } + diff --git a/metaFinal/src/entities/voyage_organise.java b/metaFinal/src/entities/voyage_organise.java new file mode 100644 index 0000000..fcac072 --- /dev/null +++ b/metaFinal/src/entities/voyage_organise.java @@ -0,0 +1,128 @@ + +package entities; + +/** + * + * @author FLAM + */ +public class voyage_organise extends voyage{ + private int Idvo; + private float Prix_billet; + private String Airline; + private int Nb_nuitees; + + private voyage voyage; + + + + public voyage_organise(int Idvo,float pb,String air,int nb,String pays, String Image_pays) { + + this.Idvo=Idvo; + this.Prix_billet=pb; + this.Airline=air; + this.Nb_nuitees=nb; + + + } + + public voyage_organise(float pb,String air,int nb) { + + + this.Prix_billet=pb; + this.Airline=air; + this.Nb_nuitees=nb; + + + } + + + public voyage_organise(float Prix_billet, String Airline, int Nb_nuitees, voyage voyage) { + + this.Prix_billet = Prix_billet; + this.Airline = Airline; + this.Nb_nuitees = Nb_nuitees; + this.voyage = voyage; + } + + + public voyage_organise( int Idvo, float Prix_billet, String Airline, int Nb_nuitees, voyage voyage) { + //super(Idv, pays,Image_pays); + this.Idvo = Idvo; + this.Prix_billet = Prix_billet; + this.Airline = Airline; + this.Nb_nuitees = Nb_nuitees; + this.voyage = voyage; + } + + + + + public String getPays() { + return this.getVoyage().getPays(); + } + + public String getImage_pays() { + return this.getVoyage().getImage_pays(); + } + + + + + + + + + + public voyage_organise() { this.Idvo=Idvo; + } + + public int getIdvo() { + return Idvo; + } + + public float getPrix_billet() { + return Prix_billet; + } + + public String getAirline() { + return Airline; + } + + public voyage getVoyage() { + return voyage; + } + + public void setVoyage(voyage voyage) { + this.voyage = voyage; + } + + public int getNb_nuitees() { + return Nb_nuitees; + } + + public void setIdvo(int Idvo) { + this.Idvo = Idvo; + } + + public void setPrix_billet(float Prix_billet) { + this.Prix_billet = Prix_billet; + } + + public void setAirline(String Airline) { + this.Airline = Airline; + } + + public void setNb_nuitees(int Nb_nuitees) { + this.Nb_nuitees = Nb_nuitees; + } + + @Override + public String toString() { + return "voyage_organise{" + "Idvo=" + Idvo + ", Prix_billet=" + Prix_billet + ", Airline=" + Airline + ", Nb_nuitees=" + Nb_nuitees + ", \nvoyage=" + this.voyage + "\n"+'}'; + } + + + + + +} diff --git a/metaFinal/src/services/IService.java b/metaFinal/src/services/IService.java new file mode 100644 index 0000000..d5909d0 --- /dev/null +++ b/metaFinal/src/services/IService.java @@ -0,0 +1,16 @@ + +package services; + +import java.util.List; + +/** + * + * @author FLAM + */ +public interface IService { + void ajouter(T entity); + void modifier(int id,T entity); + void supprimer(int id); + List afficher(); + +} diff --git a/metaFinal/src/services/abonnement/Iabonnement.java b/metaFinal/src/services/abonnement/Iabonnement.java new file mode 100644 index 0000000..06cc6a5 --- /dev/null +++ b/metaFinal/src/services/abonnement/Iabonnement.java @@ -0,0 +1,25 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.abonnement; + +import entities.abonnement; +import java.sql.SQLException; +import java.util.List; + +/** + * + * @author User + */ +public interface Iabonnement { + + void ajouter(abonnement a) throws SQLException; + + void modifier(int id, abonnement a) throws SQLException; + + void supprimer(int id) throws SQLException; + + List afficher() throws SQLException; +} diff --git a/metaFinal/src/services/abonnement/abonnement_Service.java b/metaFinal/src/services/abonnement/abonnement_Service.java new file mode 100644 index 0000000..e6106ec --- /dev/null +++ b/metaFinal/src/services/abonnement/abonnement_Service.java @@ -0,0 +1,133 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.abonnement; + +import entities.abonnement; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import Config.Datasource; + +/** + * + * @author User + */ +public class abonnement_Service implements Iabonnement{ + private Connection conn; + private Statement ste; + private PreparedStatement pste; + private PreparedStatement pste2; + + public abonnement_Service() { + conn = Datasource.getInstance().getCnx(); + + } + + @Override + public void ajouter(abonnement a) { + String req = "INSERT INTO abonnement (Type,`Prix_a`,`Date_achat`,`Date_expiration`,`Etat`,`Ref_paiement`) VALUE (?,?,?,?,?,?)"; + try { + pste = conn.prepareStatement(req); + pste.setString(1, a.getType()); + pste.setInt(2, a.getPrix_a()); + pste.setDate(3, a.getDate_achat()); + pste.setDate(4, a.getDate_expiration()); + pste.setString(5, a.getEtat()); + pste.setInt(6, a.getRef_paiment()); + pste.executeUpdate(); + System.out.println("Abonnement ajouteé"); + } catch (SQLException ex) { + Logger.getLogger(abonnement_Service.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @Override + public void modifier(int id, abonnement a) { + + String req = "UPDATE abonnement SET " + + "`Type`=?,`Prix_a`=?,`Date_achat`=?,`Date_expiration`=?,`Etat`=?,`Ref_paiement`=? " + + "WHERE Ida = ?" ; + System.out.println(a); + try { + pste2 = conn.prepareStatement(req); + pste2.setString(1, a.getType()); + pste2.setInt(2, a.getPrix_a()); + pste2.setDate(3, a.getDate_achat()); + pste2.setDate(4, a.getDate_expiration()); + pste2.setString(5, a.getEtat()); + pste2.setInt(6, a.getRef_paiment()); + pste2.setInt(7, id); + + pste2.executeUpdate(); + System.out.println("abonnement modifiée"); + + } + catch (SQLException ex){ + Logger.getLogger(abonnement.class.getName()).log(Level.SEVERE, null, ex); + } + + + + } + + @Override + public void supprimer(int id) { + String delete = "DELETE FROM abonnement WHERE Ida = ?"; + try { + pste = conn.prepareStatement(delete); + pste.setInt(1, id); + System.out.println("abonnement supprimé avec succes!"); + + pste.executeUpdate(); + + } catch (SQLException ex) { + + Logger.getLogger(abonnement_Service.class.getName()).log(Level.SEVERE, null, ex); + + } + } + + @Override + public List afficher() { + List abonnements = new ArrayList<>(); + String req = "SELECT * FROM abonnement"; + + try { + + ste = conn.createStatement(); + ResultSet rs = ste.executeQuery(req); + + while (rs.next()) { + abonnement a = new abonnement(); + a.setIda(rs.getInt("Ida")); + a.setType(rs.getString("Type")); + a.setPrix_a(rs.getInt(2)); + a.setDate_achat(rs.getDate(3)); + a.setDate_expiration(rs.getDate(3)); + a.setEtat(rs.getString("Etat")); + a.setRef_paiment(rs.getInt(3)); + + + abonnements.add(a); + + } + + } catch (SQLException ex) { + Logger.getLogger(abonnement_Service.class.getName()).log(Level.SEVERE, null, ex); + } + + return abonnements; + + } + + } + diff --git a/metaFinal/src/services/evenement/Serviceevenement.java b/metaFinal/src/services/evenement/Serviceevenement.java new file mode 100644 index 0000000..6a8167d --- /dev/null +++ b/metaFinal/src/services/evenement/Serviceevenement.java @@ -0,0 +1,112 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.evenement; + +import entities.evenement; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import services.IService; +import Config.Datasource; +import java.sql.Date; +import services.user.UserService; +/** + * + * @author Z4RGA + */ +public class Serviceevenement { + + Connection conn; private PreparedStatement pste; + + public Serviceevenement() { + conn = Datasource.getInstance().getCnx(); + } + + + + + public void ajouter(evenement e) { + try { + String req = "insert into evenement (Type_event,Chanteur,Adresse,Date_event,prix_e) values" + + "('" + e.getType_event() + "' , '" + e.getChanteur() + "' , '" + e.getAdresse() + "' , '" + e.getDate_event() + "' , '" + e.getPrix_e() + "' )" ; + Statement st = conn.createStatement(); + st.executeUpdate(req); + System.out.println("Evenement ajoutée"); + } catch (SQLException ex) { + Logger.getLogger(Serviceevenement.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + + public void modifier(evenement e) { + try { + String req= "UPDATE evenement SET Type_event='" + e.getType_event() + "',Chanteur='" + e.getChanteur()+"', Adresse='" +e.getAdresse()+ "' WHERE Ide="+e.getIde()+";"; + Statement st = conn.createStatement(); + st.executeUpdate(req); + System.out.println("event modif avec succes"); + } catch (SQLException ex) { + Logger.getLogger(Serviceevenement.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + + + public void supprimer(int id ) { + String delete = "DELETE FROM evenement where Ide = ?"; + try { + pste = conn.prepareStatement(delete); + pste.setInt(1,id); + pste.executeUpdate(); + + } catch (SQLException ex) { + + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + + } + + } + + + public List afficher() { + List list = new ArrayList<>(); + try { + String req ="select * from evenement"; + Statement st = conn.createStatement(); + ResultSet rs = st.executeQuery(req); + + while(rs.next()){ + evenement e = new evenement(); + e.setIde(rs.getInt(1)); + e.setType_event(rs.getString("Type_event")); + e.setChanteur(rs.getString("Chanteur")); + e.setAdresse(rs.getString("Adresse")); + e.setDate_event(rs.getDate("Date_event")); + e.setPrix_e(rs.getFloat("Prix_e")); + list.add(e); + } + + } catch (SQLException ex) { + Logger.getLogger(Serviceevenement.class.getName()).log(Level.SEVERE, null, ex); + } + return list; + } + + + + + + + + +} diff --git a/metaFinal/src/services/evenement/Servicereservation_event.java b/metaFinal/src/services/evenement/Servicereservation_event.java new file mode 100644 index 0000000..c655202 --- /dev/null +++ b/metaFinal/src/services/evenement/Servicereservation_event.java @@ -0,0 +1,161 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.evenement; + +import services.evenement.Serviceevenement; +import entities.reservation_event; + +import entities.evenement; +import entities.user; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import services.IService; +import Config.Datasource; +import entities.Voiture; +import entities.reservation_voiture; +import services.user.UserService; +/** + * + * @author Z4RGA + */ +public class Servicereservation_event { + + private PreparedStatement ps,pste2,pste3; + Connection cnx; + + public Servicereservation_event() { + cnx = Datasource.getInstance().getCnx(); + } + + + + + public void ajout(reservation_event re) { + + String req2 = "INSERT INTO `reservation_event` (`Idrev`,`Nb_pers`,`Ide`,`Idu`) VALUES (?,?,?,?)"; + try { + + + + ps = cnx.prepareStatement(req2); + ps.setInt(1,re.getIdrev()); + ps.setInt(2,re.getNb_pers()); + + + ps.setInt(3, re.getEvenement().getIde()); + ps.setInt(4, re.getUser().getIdu()); + System.out.println(re.getUser().getIdu()); + + + ps.executeUpdate(); + + System.out.println("reservation de event crée avec succes"); + + + } catch (SQLException ex) { + Logger.getLogger(Servicereservation_event.class.getName()).log(Level.SEVERE, null, ex); + } + + + } + + + public void modifier(int idr,reservation_event re) { + String req = "UPDATE `reservation_event` SET " + +"`Nb_pers`=?" + + " WHERE Idrev = '" + idr+ "'"; + + try { + ps = cnx.prepareStatement(req); + ps.setInt(1,re.getNb_pers()); + + + + ps.executeUpdate(); + System.out.println("reservation event de id "+ idr+ " Updated sucessfully"); + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + + + } + + + public void supprimer(int Idrev) { + + try { + String req = "delete from reservation_event where Idrev = ?"; + PreparedStatement psr = cnx.prepareStatement(req); + psr.setInt(1, Idrev); + psr.executeUpdate(); + System.out.println("Reservation Event supprimée"); + } catch (SQLException ex) { + Logger.getLogger(Serviceevenement.class.getName()).log(Level.SEVERE, null, ex); + } + } + + + public List afficher() { + + List listr = new ArrayList<>(); + String req = "SELECT * FROM `reservation_event` ;"; + String req1 = "SELECT * FROM `evenement` where `Ide` = ?"; + String req2 = "SELECT * FROM `user` where `Idu` = ?"; + + try { + ps = cnx.prepareStatement(req); + PreparedStatement pste2 = cnx.prepareStatement(req1); + PreparedStatement pste3 = cnx.prepareStatement(req2); + + + ResultSet rs = ps.executeQuery(); + + + while(rs.next()){ + reservation_event u = new reservation_event(); + + u.setIdrev(rs.getInt(1)); + u.setNb_pers(rs.getInt(2)); + + u.setEvenement(new evenement(rs.getInt(3))); + u.setUser(new user(rs.getInt(4))); + + pste2.setInt(1,u.getEvenement().getIde()); //parametre de requete 2 + pste3.setInt(1,u.getUser().getIdu()); + + ResultSet rs2 = pste2.executeQuery(); //affichage des voyage de req 2 + ResultSet rs3 = pste3.executeQuery(); + + + + // u.setEvenement(new evenement(rs2.getInt(1),rs2.getString(2),rs2.getString(3),rs2.getString(4),rs2.getDate(5),rs2.getFloat(6))); + + // u.setUser(new user(rs3.getInt(1),rs3.getDouble(2),rs3.getString(3),rs3.getString(4),rs3.getDouble(5),rs3.getString(6),rs3.getString(7),rs3.getString(8),rs3.getDate(9))); + + + + + //System.out.println(rvo.toString()); + // System.out.println(rvo.getUser().getIdu()); + listr.add(u) ; + + + }} + catch (SQLException ex) { + Logger.getLogger(Serviceevenement.class.getName()).log(Level.SEVERE, null, ex); + } + return listr; + } +} + diff --git a/metaFinal/src/services/hotel/HotelCRUD.java b/metaFinal/src/services/hotel/HotelCRUD.java new file mode 100644 index 0000000..b3cc44e --- /dev/null +++ b/metaFinal/src/services/hotel/HotelCRUD.java @@ -0,0 +1,95 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.hotel; + + +import entities.hotel; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import Config.Datasource; + +/** + * + * @author Nayrouz + */ +public class HotelCRUD { + private Connection conn; + private Statement ste; + private PreparedStatement pste; + + public HotelCRUD() { + conn = Datasource.getInstance().getCnx(); + + } + + public void ajouterHotel(hotel h){ + try { + String requete ="INSERT INTO hotel VALUES(?,?,?,?)"; + pste = conn.prepareStatement(requete); + pste.setInt(1,h.getIdh()); + pste.setString(2,h.getNom_hotel()); + pste.setInt(3,h.getNb_etoiles()); + pste.setString(4,h.getAdresse()); + + pste.executeUpdate(); + System.out.println("Hotel ajoutée avec succès"); + + } catch (SQLException ex) { + System.err.println(ex.getMessage()); + } + } + public List afficherHotels(){ + List myList=new ArrayList(); + try { + + String requete ="SELECT * FROM hotel"; + ste = conn.createStatement(); + ResultSet rs = ste.executeQuery(requete); + + + while (rs.next()){ + hotel h =new hotel(); + h.setIdh(rs.getInt(1)); + h.setNom_hotel(rs.getString(2)); + h.setNb_etoiles(rs.getInt(3)); + h.setAdresse(rs.getString(5)); + myList.add(h); + } + } catch (SQLException ex) { + System.out.println(ex.getMessage()); + } + return myList ; + + } + + public void supprimerHotel(hotel h){ + try { + String req ="DELETE FROM hotel where Idh=" + h.getIdh(); + ste = conn.createStatement(); + ste.executeUpdate(req); + System.out.println("Hotel supprimé"); + } catch (SQLException ex) { + System.out.println(ex.getMessage()); + } + + } + public void modifierHotel(hotel h){ + try { + String req= "UPDATE hotel SET Nom_hotel='" + h.getNom_hotel() + "',Nb_etoiles=" + h.getNb_etoiles()+", Adresse='" + h.getAdresse()+ "' WHERE Idh="+h.getIdh()+";"; + ste = conn.createStatement(); + ste.executeUpdate(req); + System.out.println("Hotel modif avec succes"); + } catch (SQLException ex) { + System.out.println(ex.getMessage()); + } + +} +} diff --git a/metaFinal/src/services/hotel/Ihotel.java b/metaFinal/src/services/hotel/Ihotel.java new file mode 100644 index 0000000..9b71417 --- /dev/null +++ b/metaFinal/src/services/hotel/Ihotel.java @@ -0,0 +1,22 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.hotel; + +import entities.hotel; +import entities.user; +import entities.voyage; +import java.sql.SQLException; +import java.util.List; +import static javafx.scene.input.KeyCode.T; +import services.IService; + +/** + * + * @author medal + */ +public interface Ihotel extends IService{ + +} diff --git a/metaFinal/src/services/paiement/EtatPayment.java b/metaFinal/src/services/paiement/EtatPayment.java new file mode 100644 index 0000000..37b635f --- /dev/null +++ b/metaFinal/src/services/paiement/EtatPayment.java @@ -0,0 +1,18 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.paiement; + +/** + * + * @author FLAM + */ +public enum EtatPayment { + NonPaye, + Paye, + EnCours, + Annule, + +} diff --git a/metaFinal/src/services/reservation_hotel/IReservation_hotel.java b/metaFinal/src/services/reservation_hotel/IReservation_hotel.java new file mode 100644 index 0000000..3b9e018 --- /dev/null +++ b/metaFinal/src/services/reservation_hotel/IReservation_hotel.java @@ -0,0 +1,20 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.reservation_hotel; + +import entities.reservation_hotel; +import java.util.List; +import services.IService; + +/** + * + * @author medal + */ +public interface IReservation_hotel extends IService { + + + +} diff --git a/metaFinal/src/services/reservation_hotel/Reserrvation_Hotel_Service.java b/metaFinal/src/services/reservation_hotel/Reserrvation_Hotel_Service.java new file mode 100644 index 0000000..b8267d9 --- /dev/null +++ b/metaFinal/src/services/reservation_hotel/Reserrvation_Hotel_Service.java @@ -0,0 +1,176 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.reservation_hotel; + +import Config.Datasource; +import entities.hotel; +import services.reservation_hotel.IReservation_hotel; + +import entities.reservation_hotel; +import entities.user; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import services.user.UserService; + + + +/** + * + * @author medal + */ +public class Reserrvation_Hotel_Service implements IReservation_hotel{ + + private final Connection conn; + private Statement ste; + private PreparedStatement pste; + + public Reserrvation_Hotel_Service() { + conn = Datasource.getInstance().getCnx(); + } + + @Override + public void ajouter(reservation_hotel rh) { + + + String req2 = "INSERT INTO `reservation_hotel` (`Idrh`,`Type_room`,`Nb_nuitees`,`Nb_personnes`,`Prix`,`Idh`,`Idu`,`Date_depart`,`Date_arrivee`) VALUES (?,?,?,?,?,?,?,?,?)"; + + try { + + + pste = conn.prepareStatement(req2); + pste.setInt(1,rh.getIdrh()); + pste.setString(2,rh.getType_room()); + pste.setInt(3, rh.getNb_nuitees()); + pste.setInt(4, rh.getNb_personnes()); + pste.setFloat(5, rh.getPrix()); + + pste.setInt(6, rh.getHotel().getIdh()); + pste.setInt(7, rh.getUser().getIdu()); + pste.setDate(8, rh.getDate_depart()); + pste.setDate(9, rh.getDate_arrivee()); + + + + pste.executeUpdate(); + System.out.println("reservation de hotel crée avec succes"); + + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + + } + + + + + @Override + public void modifier(int id, reservation_hotel entity) { + String req = "UPDATE `reservation_hotel` SET " + +"`Type_room`=?,`Nb_nuitees`=?,`Nb_personnes`=?,`Prix`=?,`Date_depart`=?,`Date_arrivee`=? WHERE `Idrh` = '"+id+ "'"; + + + + try { + pste = conn.prepareStatement(req); + pste.setString(1,entity.getType_room()); + pste.setInt(2, entity.getNb_nuitees()); + pste.setInt(3, entity.getNb_personnes()); + pste.setFloat(4, entity.getPrix()); + + pste.setDate(5, entity.getDate_depart()); + pste.setDate(6, entity.getDate_arrivee()); + pste.executeUpdate(); + System.out.println("reservationHotel modifier"); + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @Override + public void supprimer(int id) { + String delete = "DELETE FROM reservation_hotel where Idrh = ?"; + try { + pste = conn.prepareStatement(delete); + pste.setInt(1,id); + pste.executeUpdate(); + + } catch (SQLException ex) { + + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + + } + } + + @Override + public List afficher() { + List hotels = new ArrayList<>(); + String req = "SELECT * FROM `reservation_hotel`"; + String req1 = "SELECT * FROM `hotel` where `Idh` = ?"; + String req2 = "SELECT * FROM `user` where `Idu` = ?"; + + try { + pste = conn.prepareStatement(req); + PreparedStatement pste2 = conn.prepareStatement(req1); + PreparedStatement pste3 = conn.prepareStatement(req2); + + + ResultSet rs = pste.executeQuery(); + + + while(rs.next()){ + reservation_hotel u = new reservation_hotel(); + + u.setIdrh(rs.getInt(1)); + u.setType_room( rs.getString(2)); + u.setNb_nuitees(rs.getInt(3)); + u.setNb_personnes(rs.getInt(4)); + u.setPrix(rs.getFloat(5)); + + + u.setHotel(new hotel(rs.getInt(6))); + u.setUser(new user(rs.getInt(7))); + + pste2.setInt(1,u.getHotel().getIdh()); //parametre de requete 2 + pste3.setInt(1,u.getUser().getIdu()); + + ResultSet rs2 = pste2.executeQuery(); //affichage des voyage de req 2 + ResultSet rs3 = pste3.executeQuery(); + + rs2.next(); + rs3.next(); + + u.setHotel(new hotel(rs2.getInt(1),rs2.getString(2),rs2.getInt(3),rs2.getString(4))); + + u.setUser(new user(rs3.getInt(1),rs3.getDouble(2),rs3.getString(3),rs3.getString(4),rs3.getDouble(5),rs3.getString(6),rs3.getString(7),rs3.getString(8),rs3.getDate(9))); + + + + // System.out.println(u.toString()); + + hotels.add(u) ; + + + + + } + + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + return hotels; + } +} diff --git a/metaFinal/src/services/reservation_voiture/IReservation_voiture.java b/metaFinal/src/services/reservation_voiture/IReservation_voiture.java new file mode 100644 index 0000000..a0deb5d --- /dev/null +++ b/metaFinal/src/services/reservation_voiture/IReservation_voiture.java @@ -0,0 +1,21 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.reservation_voiture; + +import entities.reservation_voiture; +import entities.reservation_voiture; +import java.util.List; +import services.IService; + +/** + * + * @author medal + */ +public interface IReservation_voiture extends IService{ + + + +} diff --git a/metaFinal/src/services/reservation_voiture/Reservation_voiture_Service.java b/metaFinal/src/services/reservation_voiture/Reservation_voiture_Service.java new file mode 100644 index 0000000..caf1ba4 --- /dev/null +++ b/metaFinal/src/services/reservation_voiture/Reservation_voiture_Service.java @@ -0,0 +1,163 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.reservation_voiture; + +import entities.Voiture; +import entities.hotel; + +import entities.reservation_voiture; + +import entities.user; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import services.user.UserService; +import Config.Datasource; + +/** + * + * @author medal + */ +public class Reservation_voiture_Service implements IReservation_voiture{ + private Connection conn; + private Statement ste; + private PreparedStatement pste; + + public Reservation_voiture_Service() { + conn = Datasource.getInstance().getCnx(); + } + + @Override + public void ajouter(reservation_voiture rv) { + + String req2 = "INSERT INTO `reservation_voiture` (`prix_rent`,`Chauffeur`,`Trajet`,`Idu`,`Idvoit`) VALUES (?,?,?,?,?) ;"; + + try { + + System.out.println(rv.getVoiture().getIdvoit()+" " +rv.getUser().getIdu()); + pste = conn.prepareStatement(req2); + pste.setFloat(1,rv.getPrix_rent()); + pste.setString(2, rv.getChauffeur()); + pste.setString(3, rv.getTrajet()); + pste.setInt(4, rv.getUser().getIdu()); + pste.setInt(5, rv.getVoiture().getIdvoit()); + + pste.executeUpdate(); + System.out.println("reservation de voiture crée avec succes"); + + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + @Override + public void modifier(int id, reservation_voiture entity) { + String req = "UPDATE `reservation_voiture` SET " + +"`prix_rent`=?,`Chauffeur`=?,`Trajet`=?,`Idu`=?,`Idvoit`=? WHERE `Idrvoit` = "+id; + + + + try { + pste = conn.prepareStatement(req); + pste.setFloat(1,entity.getPrix_rent()); + pste.setString(2, entity.getChauffeur()); + pste.setString(3, entity.getTrajet()); + pste.setInt(4, entity.getUser().getIdu()); + + pste.setInt(5, entity.getVoiture().getIdvoit()); + + pste.executeUpdate(); + System.out.println("reservation voiture modifier"); + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @Override + public void supprimer(int id) { + String delete = "DELETE FROM reservation_voiture where Idrvoit = ?"; + try { + pste = conn.prepareStatement(delete); + pste.setInt(1,id); + pste.executeUpdate(); + + } catch (SQLException ex) { + + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + + } + } + + @Override + public List afficher() { + List hotels = new ArrayList<>(); + String req = "SELECT * FROM `reservation_voiture` ;"; + String req1 = "SELECT * FROM `voiture` where `Idvoit` = ?"; + String req2 = "SELECT * FROM `user` where `Idu` = ?"; + + try { + pste = conn.prepareStatement(req); + PreparedStatement pste2 = conn.prepareStatement(req1); + PreparedStatement pste3 = conn.prepareStatement(req2); + + + ResultSet rs = pste.executeQuery(); + + + while(rs.next()){ + reservation_voiture u = new reservation_voiture(); + + u.setIdrvoit(rs.getInt(1)); + u.setPrix_rent(rs.getFloat(2)); + u.setChauffeur(rs.getString(3)); + u.setTrajet(rs.getString(4)); + + + + u.setUser(new user(rs.getInt(5))); + u.setVoiture(new Voiture(rs.getInt(6))); + + pste2.setInt(1,u.getVoiture().getIdvoit()); //parametre de requete 2 + pste3.setInt(1,u.getUser().getIdu()); + + ResultSet rs2 = pste2.executeQuery(); //affichage des voyage de req 2 + ResultSet rs3 = pste3.executeQuery(); + + rs2.next(); + rs3.next(); + + u.setVoiture(new Voiture(rs2.getInt(1),rs2.getString(2),rs2.getInt(3),rs2.getString(4),rs2.getString(5))); + + u.setUser(new user(rs3.getInt(1),rs3.getDouble(2),rs3.getString(3),rs3.getString(4),rs3.getDouble(5),rs3.getString(6),rs3.getString(7),rs3.getString(8),rs3.getDate(9))); + + + + + + hotels.add(u) ; + + + + + } + + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + System.out.println(hotels.toString()); + return hotels; + } + +} diff --git a/metaFinal/src/services/reservation_voyage/IReservation_Voyage.java b/metaFinal/src/services/reservation_voyage/IReservation_Voyage.java new file mode 100644 index 0000000..7f89a14 --- /dev/null +++ b/metaFinal/src/services/reservation_voyage/IReservation_Voyage.java @@ -0,0 +1,18 @@ + +package services.reservation_voyage; + + +import entities.reservation_voyage; +import entities.reservation_voyage; +import java.sql.SQLException; +import java.util.List; +import services.IService; + +/** + * + * @author FLAM + */ +public interface IReservation_Voyage extends IService{ + + +} diff --git a/metaFinal/src/services/reservation_voyage/Reservation_Voyage_Service.java b/metaFinal/src/services/reservation_voyage/Reservation_Voyage_Service.java new file mode 100644 index 0000000..4edd338 --- /dev/null +++ b/metaFinal/src/services/reservation_voyage/Reservation_Voyage_Service.java @@ -0,0 +1,168 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.reservation_voyage; +import java.sql.Date; +import entities.reservation_voyage; +import entities.user; +import entities.voyage; +import entities.voyage_organise; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import Config.Datasource; +import services.user.UserService; + +/** + * + * @author FLAM + */ +public class Reservation_Voyage_Service implements IReservation_Voyage{ + + private Connection conn; + private Statement ste; + private PreparedStatement pste,pste2,pste3; + + public Reservation_Voyage_Service() { + conn = Datasource.getInstance().getCnx(); + + } + + + + @Override + public void ajouter(reservation_voyage rv) { + + String req2 = "INSERT INTO `reservation_voyage` (`Date_depart`,`Date_arrivee`,`etat`,`Idu`,`Idv`) VALUES (?,?,?,?,?)"; + + try { + + + pste = conn.prepareStatement(req2); + pste.setDate(1,rv.getDate_arrivee()); + pste.setDate(2, rv.getDate_arrivee()); + pste.setString(3, rv.getEtat()); + pste.setInt(4, rv.getUser().getIdu()); + pste.setInt(5, rv.getVoyage().getIdv()); + + pste.executeUpdate(); + System.out.println("reservation de voyage crée avec succes"); + + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + + } + + @Override + public void modifier(int id, reservation_voyage rv) { + String req = "UPDATE `reservation_voyage` SET " + +"`Date_depart`=?,`Date_arrivee`=?,`etat`=?" + + " WHERE Idrv = '" + id+ "'"; + + try { + pste = conn.prepareStatement(req); + pste.setDate(1,rv.getDate_depart()); + pste.setDate(2, rv.getDate_arrivee()); + pste.setString(3, rv.getEtat()); + + pste.executeUpdate(); + System.out.println("Reservation de Voyage de id "+ id+ " Updated sucessfully"); + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @Override + public void supprimer(int idrv) { + String supp = "DELETE FROM reservation_voyage where Idrv = ?"; + try { + pste = conn.prepareStatement(supp); + pste.setInt(1,idrv); + pste.executeUpdate(); + System.out.println("reservation_voyage Deleted sucessfully"); + + } catch (SQLException ex) { + + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + + } + } + +@Override + public List afficher() { + List listRV = new ArrayList<>(); + + String req = "SELECT * FROM `reservation_voyage` ;"; + String req2 = "SELECT * FROM `voyage` where `Idv` = ?"; + String req3 = "SELECT * FROM `user` where `Idu` = ?"; + + try { + + pste = conn.prepareStatement(req); + pste2 = conn.prepareStatement(req2); + pste3 = conn.prepareStatement(req3); + + ResultSet rs = pste.executeQuery(); + + while(rs.next()){ + reservation_voyage rvo = new reservation_voyage(); + + rvo.setIdrv(rs.getInt(1)); + rvo.setDate_depart(rs.getDate(2)); + rvo.setDate_arrivee(rs.getDate(3)); + rvo.setEtat(rs.getString(4)); + rvo.setIdu(rs.getInt(5)); + rvo.setIdv(rs.getInt(6)); + + + rvo.setUser(new user(rs.getInt(5))); + rvo.setVoyage(new voyage(rs.getInt(6))); + + pste2.setInt(1,rvo.getVoyage().getIdv()); //parametre de requete 2 + pste3.setInt(1,rvo.getUser().getIdu()); + + ResultSet rs2 = pste2.executeQuery(); //affichage des voyage de req 2 + ResultSet rs3 = pste3.executeQuery(); + + rs2.next(); + + rs3.next(); + + rvo.setVoyage(new voyage(rs2.getInt(1),rs2.getString(2),rs2.getString(3))); + rvo.setUser( + new user(rs3.getInt(1),rs3.getDouble(2),rs3.getString(3),rs3.getString(4),rs3.getDouble(5), rs3.getString(6),rs3.getString(7),rs3.getString(8),rs3.getDate(9))); + + + + + + //System.out.println(vo.toString()); + + listRV.add(rvo) ; + + + + } + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + // System.out.println(listVORG.toString()); + return listRV; } + + +} + + + diff --git a/metaFinal/src/services/user/IuserService.java b/metaFinal/src/services/user/IuserService.java new file mode 100644 index 0000000..c7fabf5 --- /dev/null +++ b/metaFinal/src/services/user/IuserService.java @@ -0,0 +1,22 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.user; + + +import java.sql.SQLException; +import entities.user; +import entities.user; +import java.util.List; +/** + * + * @author remo + */ +public interface IuserService { + void ajouter(user user) throws SQLException;; + void modifier(int id,user user) throws SQLException;; + void supprimer(int id) throws SQLException;; + List afficher() throws SQLException; +} diff --git a/metaFinal/src/services/user/LoginAndSignupService.java b/metaFinal/src/services/user/LoginAndSignupService.java new file mode 100644 index 0000000..9f9c838 --- /dev/null +++ b/metaFinal/src/services/user/LoginAndSignupService.java @@ -0,0 +1,148 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.user; + +import entities.user; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import Config.Datasource; + +/** + * + * @author dali + */ +public class LoginAndSignupService { + + private Connection conn; + private Statement ste; + private PreparedStatement pste; + + public LoginAndSignupService() { + conn = Datasource.getInstance().getCnx(); + } + + private String Email; + private String Password; +public String login (String email,String password) throws Exception { + String test = null; + List users = new ArrayList<>(); + String req = "SELECT * FROM `user` where Email='"+email+"' and Password ='"+password+"'"; + System.out.println(email); + System.out.println(password); + try { + + ste = conn.createStatement(); + ResultSet rs = ste.executeQuery(req); + + while(rs.next()){ + user u = new user(); + u.setIdu(rs.getInt(1)); + u.setCin( rs.getDouble(2)); + u.setNom(rs.getString(3)); + u.setPrenom(rs.getString(4)); + u.setTel(rs.getDouble(5)); + + u.setEmail( rs.getString(6)); + u.setPassword(rs.getString(7)); + u.setImage(rs.getString(8)); + u.setRole(rs.getInt(9)); + u.setDateNaissance(rs.getDate(10)); + users.add(u) ; + + } + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + try{ + + if(users.size()==0){ + test="login failed"; + + } + else{ + test="login successful"; + + } + }catch(IndexOutOfBoundsException e){ + + } + return test; + } + public void Signup(user u) { + List users = new ArrayList<>(); + String Email1=u.getEmail(); + String pass1=u.getPassword(); + // System.out.println(Email1); + // System.out.println(pass1); + String password=u.getPassword(); + String req = "SELECT * FROM `user` where Email='"+Email1+"'"; + + try { + + ste = conn.createStatement(); + ResultSet rs = ste.executeQuery(req); + + while(rs.next()){ + user u1 = new user(); + u1.setIdu(rs.getInt(1)); + u1.setCin( rs.getDouble(2)); + u1.setNom(rs.getString(3)); + u1.setPrenom(rs.getString(4)); + u1.setTel(rs.getDouble(5)); + + u1.setEmail( rs.getString(6)); + u1.setPassword(rs.getString(7)); + u1.setImage(rs.getString(8)); + u1.setRole(rs.getInt(9)); + u1.setDateNaissance(rs.getDate(10)); + users.add(u) ; + + } + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + System.out.println("+++++++size++++++++"+users.size()); + if(users.size()==0){ + + + + String req10 = "INSERT INTO `user` (`Cin`,`Nom`,`Prenom`,`Tel`,`Email`,`Password`,`Image`,`dateNaissance`) VALUES (?,?,?,?,?,?,?,?) ;"; + try { + pste = conn.prepareStatement(req10); + + + pste.setDouble(1,u.getCin()); + pste.setString(2, u.getNom()); + pste.setString(3, u.getPrenom()); + pste.setDouble(4,u.getTel()); + pste.setString(5, u.getEmail()); + pste.setString(6, u.getPassword()); + pste.setString(7, u.getImage()); + pste.setDate(8, u.getDateNaissance()); + pste.executeUpdate(); + System.out.println("user créée"); + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + } + else{ + System.out.print("signup failed "); + + } +} + +} \ No newline at end of file diff --git a/metaFinal/src/services/user/UserService.java b/metaFinal/src/services/user/UserService.java new file mode 100644 index 0000000..5ff7fc5 --- /dev/null +++ b/metaFinal/src/services/user/UserService.java @@ -0,0 +1,155 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.user; + +import entities.user; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.sql.Date; + +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import java.sql.SQLException; +import Config.Datasource; +import services.IService; +import services.IService; + +/** + * + * @author FLAM + */ +public class UserService implements IService { + + + + + private Connection conn; + private Statement ste; + private PreparedStatement pste; + + public UserService() { + conn = Datasource.getInstance().getCnx(); + } + + + + @Override + public void ajouter(user u) { + String req = "INSERT INTO `user` (`Cin`,`Nom`,`Prenom`,`Tel`,`Email`,`Password`,`Image`,`dateNaissance`) VALUES (?,?,?,?,?,?,?,?) ;"; + try { + pste = conn.prepareStatement(req); + + + pste.setDouble(1,u.getCin()); + pste.setString(2, u.getNom()); + pste.setString(3, u.getPrenom()); + pste.setDouble(4,u.getTel()); + pste.setString(5, u.getEmail()); + pste.setString(6, u.getPassword()); + pste.setString(7, u.getImage()); + pste.setDate(8, u.getDateNaissance()); + pste.executeUpdate(); + System.out.println("user créée"); + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + } + + + @Override + public void modifier( int id ,user u) { + + + String req = "UPDATE `user` SET " + +"`Cin`=?,`Nom`=?,`Prenom`=?,`Tel`=?,`Email`=?,`Password`=?,`Image`=?,`dateNaissance`=?" + + "WHERE idu = '" + id+ "'"; + + try { + pste = conn.prepareStatement(req); + pste.setDouble(1,u.getCin()); + pste.setString(2, u.getNom()); + pste.setString(3, u.getPrenom()); + pste.setDouble(4,u.getTel()); + pste.setString(5, u.getEmail()); + pste.setString(6, u.getPassword()); + pste.setString(7, u.getImage()); + pste.setDate(8, u.getDateNaissance()); + pste.executeUpdate(); + System.out.println("user modifie"); + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + } + @Override + public void supprimer(int id ) { + String delete = "DELETE FROM user where idu = ?"; + try { + pste = conn.prepareStatement(delete); + pste.setInt(1,id); + pste.executeUpdate(); + System.out.println("user supprimé"); + } catch (SQLException ex) { + + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + + } + + } + + @Override + public List afficher() { + List users = new ArrayList<>(); + String req = "SELECT * FROM `user`"; + + try { + + ste = conn.createStatement(); + ResultSet rs = ste.executeQuery(req); + + while(rs.next()){ + user u = new user(); + u.setIdu(rs.getInt(1)); + u.setCin( rs.getDouble(2)); + u.setNom(rs.getString(3)); + u.setPrenom(rs.getString(4)); + u.setTel(rs.getDouble(5)); + + u.setEmail( rs.getString(6)); + u.setPassword(rs.getString(7)); + u.setImage(rs.getString(8)); + u.setDateNaissance(rs.getDate(9)); + users.add(u) ; + + } + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + return users; + } + + + + + + + + + + + + + + + + +} diff --git a/metaFinal/src/services/voiture/VoitureCRUD.java b/metaFinal/src/services/voiture/VoitureCRUD.java new file mode 100644 index 0000000..6c6f940 --- /dev/null +++ b/metaFinal/src/services/voiture/VoitureCRUD.java @@ -0,0 +1,102 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.voiture; + + +import entities.Voiture; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import Config.Datasource; + +/** + * + * @author Nayrouz + */ +public class VoitureCRUD { + private final Connection conn; + private Statement ste; + private PreparedStatement pste; + + public VoitureCRUD() { + conn = Datasource.getInstance().getCnx(); + + } + + public void ajouterVoiture(Voiture v){ + try { + String requete ="INSERT INTO voiture VALUES(?,?,?,?,?)"; + pste = conn.prepareStatement(requete); + pste.setInt(1,v.getIdvoit()); + pste.setString(2,v.getMatricule()); + pste.setInt(3,v.getPuissance_fiscalle()); + pste.setString(4,v.getImage_v()); + pste.setString(5,v.getModele()); + + pste.executeUpdate(); + System.out.println("Ajouter ajoutée aves=c succès"); + + } catch (SQLException ex) { + System.err.println(ex.getMessage()); + } + } + + public List afficherVoitures(){ + List myList=new ArrayList(); + try { + + String requete ="SELECT * FROM voiture"; + ste = conn.createStatement(); + ResultSet res =ste.executeQuery(requete); + + while (res.next()){ + Voiture v =new Voiture(); + v.setIdvoit(res.getInt(1)); + v.setMatricule(res.getString(2)); + v.setPuissance_fiscalle(res.getInt(3)); + v.setImage_v(res.getString(4)); + v.setModele(res.getString(5)); + + + myList.add(v); + } + } catch (SQLException ex) { + System.out.println(ex.getMessage()); + } + return myList ; + + } + + public void supprimerVoiture(Voiture v){ + try { + String req ="DELETE FROM voiture where id_cmd=" + v.getIdvoit(); + + ste = conn.createStatement(); + ste.executeUpdate(req); + System.out.println("Voiture supprime"); + } catch (SQLException ex) { + System.out.println(ex.getMessage()); + } + } + + public void modifierVoiture(Voiture v){ + try { + String req= "UPDATE voiture SET `Matricule`='" + v.getMatricule() + "',`Puissance_fiscalle`='" + v.getPuissance_fiscalle()+"',`Image_v`='" + v.getImage_v()+"',`Modele`='" + v.getModele() + "'" + + "WHERE `Idvoit`="+v.getIdvoit(); + ste = conn.createStatement(); + ste.executeUpdate(req); + System.out.println(v); + } catch (SQLException ex) { + System.out.println(ex.getMessage()); + } + }} + + + diff --git a/metaFinal/src/services/voyage/IVoyage.java b/metaFinal/src/services/voyage/IVoyage.java new file mode 100644 index 0000000..dbfb7fe --- /dev/null +++ b/metaFinal/src/services/voyage/IVoyage.java @@ -0,0 +1,15 @@ + +package services.voyage; + + +import entities.voyage; +import services.IService; + +/** + * + * @author FLAM + */ +public interface IVoyage extends IService{ + voyage ajout (voyage v); + +} diff --git a/metaFinal/src/services/voyage/voyageService.java b/metaFinal/src/services/voyage/voyageService.java new file mode 100644 index 0000000..74afa0f --- /dev/null +++ b/metaFinal/src/services/voyage/voyageService.java @@ -0,0 +1,146 @@ + +package services.voyage; + +import services.voyage.IVoyage; +import entities.voyage; +import entities.voyage_organise; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import Config.Datasource; +import entities.user; +import java.sql.ResultSet; +import java.util.ArrayList; +import services.user.UserService; + +/** + * + * @author FLAM + */ +public class voyageService implements IVoyage{ + + private Connection conn; + private Statement ste; + private PreparedStatement pste; + + public voyageService() { + conn = Datasource.getInstance().getCnx(); + + } + + + + @Override + public voyage ajout(voyage v) { + + String req = "INSERT INTO `voyage` (`Idv`,`Pays`,`Image_pays`) VALUE (?,?,?)"; + + try { + pste = conn.prepareStatement(req); + pste.setInt(1,v.getIdv()); + pste.setString(2,v.getPays()); + pste.setString(3, v.getImage_pays()); + pste.executeUpdate(); + System.out.println("voyage créée"); + + System.out.println(v.toString()); + return v; + + + } catch (SQLException ex) + { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + return null; + + } + + } + + + @Override + public void modifier(int idv, voyage v) { + String req = "UPDATE `voyage` SET " + +"`Pays`=?,`Image_Pays`=?" + + " WHERE Idv = '" + idv+ "'"; + + try { + pste = conn.prepareStatement(req); + pste.setString(1,v.getPays()); + pste.setString(2, v.getImage_pays()); + + + pste.executeUpdate(); + System.out.println("Voyage de id "+ idv+ " Updated sucessfully"); + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + + @Override + public void supprimer(int idv) { + String delete = "DELETE FROM voyage WHERE Idv = ? "; + /* IL FAUT UTILISER ON DELETE CASCADE POUR SUPPRIMER LES VOYAGES ET LES VOYAGES ORGANISES DE LA DESTINATION + EXEMPLE : SI ON A 100 VOYAGES VERS LA FRANCE + ET ON ANNULE/ SUPPRIME LE VOYAGE DE LA FRANCE + TOUS LES VOYAGES ORGANISES VERS LA FRANCE DOIVENT ETRE SUPPRIMES */ + try { + pste = conn.prepareStatement(delete); + pste.setInt(1,idv); + pste.executeUpdate(); + System.out.println("voyage de id "+idv+ " est supprime"); + + } catch (SQLException ex) { + + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + + } + } + + @Override + public List afficher() { + + List listRV = new ArrayList<>(); + + String req = "SELECT * FROM `voyage` ;"; + + + try { + + ste = conn.createStatement(); + ResultSet rs = ste.executeQuery(req); + + while(rs.next()){ + voyage v= new voyage(); + v.setIdv(rs.getInt(1)); + v.setPays( rs.getString(2)); + + v.setImage_pays(rs.getString(3)); + + listRV.add(v) ; + + + + + } + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + // System.out.println(listVORG.toString()); + return listRV; + } + + @Override + public void ajouter(voyage entity) { + throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates. + } + + + +} diff --git a/metaFinal/src/services/voyage/voyage_organise/IVoyage_ORG_Service.java b/metaFinal/src/services/voyage/voyage_organise/IVoyage_ORG_Service.java new file mode 100644 index 0000000..3623f5f --- /dev/null +++ b/metaFinal/src/services/voyage/voyage_organise/IVoyage_ORG_Service.java @@ -0,0 +1,24 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.voyage.voyage_organise; + + +import entities.voyage; +import entities.voyage_organise; +import java.sql.SQLException; +import java.util.List; + +/** + * + * @author FLAM + */ +public interface IVoyage_ORG_Service { + + void ajouter(voyage_organise vo) throws SQLException; + void modifier(int id,voyage_organise vo) throws SQLException; + void supprimer(int id) throws SQLException; + List afficher() throws SQLException; +} diff --git a/metaFinal/src/services/voyage/voyage_organise/VoyageORG_Service.java b/metaFinal/src/services/voyage/voyage_organise/VoyageORG_Service.java new file mode 100644 index 0000000..94bacaa --- /dev/null +++ b/metaFinal/src/services/voyage/voyage_organise/VoyageORG_Service.java @@ -0,0 +1,149 @@ + +package services.voyage.voyage_organise; + +import services.voyage.voyage_organise.IVoyage_ORG_Service; +import entities.user; +import entities.voyage; +import entities.voyage_organise; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import Config.Datasource; +import services.user.UserService; + +/** + * + * @author FLAM + */ +public class VoyageORG_Service implements IVoyage_ORG_Service{ + + + private Connection conn; + private Statement ste; + private PreparedStatement pste; + private PreparedStatement pste2; + + public VoyageORG_Service() { + conn = Datasource.getInstance().getCnx(); + + } + + + + @Override + public void ajouter(voyage_organise vo) { + + + String req2 = "INSERT INTO `voyage_organise` (`Prix_billet`,`Airline`,`Nb_nuitees`,`Idv`) VALUE (?,?,?,?)"; + + try { + pste = conn.prepareStatement(req2); + pste.setFloat(1,vo.getPrix_billet()); + pste.setString(2, vo.getAirline()); + pste.setInt(3, vo.getNb_nuitees()); + pste.setInt(4, vo.getVoyage().getIdv()); + System.out.println(vo.getVoyage().getIdv()); + pste.executeUpdate(); + System.out.println("voyage organise créée"); + + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + + @Override + public void modifier(int idvo, voyage_organise vo) { + String req = "UPDATE `voyage_organise` SET " + +"`Prix_billet`=?,`Airline`=?,`Nb_nuitees`=?" + + " WHERE Idvo = '" + idvo+ "'"; + + try { + pste = conn.prepareStatement(req); + pste.setFloat(1,vo.getPrix_billet()); + pste.setString(2, vo.getAirline()); + pste.setInt(3, vo.getNb_nuitees()); + + pste.executeUpdate(); + System.out.println("Voyage organisé de id "+ idvo+ " Updated sucessfully"); + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + @Override + public void supprimer(int idvo) { + String supp = "DELETE FROM voyage_organise where Idvo = ?"; + try { + pste = conn.prepareStatement(supp); + pste.setInt(1,idvo); + pste.executeUpdate(); + System.out.println("Voyage organisé Deleted sucessfully"); + + } catch (SQLException ex) { + + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + + } + } + + @Override + public List afficher() { + List listVORG = new ArrayList<>(); + + String req = "SELECT * FROM `voyage_organise` ;"; + String req2 = "SELECT * FROM `voyage` where `Idv` = ?"; + + try { + + pste = conn.prepareStatement(req); + pste2 = conn.prepareStatement(req2); + + ResultSet rs = pste.executeQuery(); + + while(rs.next()){ + voyage_organise vo = new voyage_organise(); + + vo.setIdvo(rs.getInt(1)); + vo.setPrix_billet(rs.getFloat(2)); + vo.setAirline(rs.getString(3)); + vo.setNb_nuitees(rs.getInt(4)); + + vo.setVoyage(new voyage(rs.getInt(5))); + + pste2.setInt(1,vo.getVoyage().getIdv()); //parametre de requete 2 + + ResultSet rs2 = pste2.executeQuery(); //affichage des voyage de req 2 + + rs2.next(); + + vo.setVoyage(new voyage(rs2.getInt(1),rs2.getString(2),rs2.getString(3))); + + + + + //System.out.println(vo.toString()); + + listVORG.add(vo) ; + + + + } + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + // System.out.println(listVORG.toString()); + return listVORG; } + + +} diff --git a/metaFinal/src/services/voyage/voyage_virtuel/IVoyage_VRT_Service.java b/metaFinal/src/services/voyage/voyage_virtuel/IVoyage_VRT_Service.java new file mode 100644 index 0000000..696da64 --- /dev/null +++ b/metaFinal/src/services/voyage/voyage_virtuel/IVoyage_VRT_Service.java @@ -0,0 +1,25 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.voyage.voyage_virtuel; + +import entities.Voyage_virtuel; +import java.sql.SQLException; +import java.util.List; + +/** + * + * @author User + */ +public interface IVoyage_VRT_Service { + void ajouter(Voyage_virtuel vv) throws SQLException; + + void modifier(int id, Voyage_virtuel vv ) throws SQLException; + + void supprimer(int id) throws SQLException; + + List afficher() throws SQLException; + +} diff --git a/metaFinal/src/services/voyage/voyage_virtuel/VoyageVRT_Service.java b/metaFinal/src/services/voyage/voyage_virtuel/VoyageVRT_Service.java new file mode 100644 index 0000000..250dd6f --- /dev/null +++ b/metaFinal/src/services/voyage/voyage_virtuel/VoyageVRT_Service.java @@ -0,0 +1,151 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package services.voyage.voyage_virtuel; + +/** + * + * @author Zak + */ +import entities.user; +import entities.Voyage_virtuel; +import entities.voyage; +import entities.voyage_organise; +import java.sql.Connection; +import java.sql.PreparedStatement; +import java.sql.ResultSet; +import java.sql.SQLException; +import java.sql.Statement; +import java.util.ArrayList; +import java.util.List; +import java.util.logging.Level; +import java.util.logging.Logger; +import Config.Datasource; +import services.user.UserService; + +public class VoyageVRT_Service implements IVoyage_VRT_Service { + + private Connection conn; + private Statement ste; + private PreparedStatement pste; + private PreparedStatement pste2; + + public VoyageVRT_Service() { + conn = Datasource.getInstance().getCnx(); + + } + + @Override + public void ajouter(Voyage_virtuel vv) throws SQLException { + String req2 = "INSERT INTO `voyage_virtuel` (`Video`,`Image_v`,`Idv`,`Ida`) VALUE (?,?,?,?)"; + + try { + pste = conn.prepareStatement(req2); + pste.setString(1, vv.getVideo()); + pste.setString(2, vv.getImage_v()); + pste.setInt(3, vv.getVoyage().getIdv()); + pste.setInt(4, vv.getAbonnement().getIda()); + + System.out.println(vv.getVoyage().getIdv()); + pste.executeUpdate(); + System.out.println("voyage virtuel créée"); + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + + } + + @Override + public void modifier(int id, Voyage_virtuel vv) { + String req = "UPDATE `voyage_virtuel` SET " + +"`Video`=?,`Image_v`=?,`Idv`=?,`Ida`=?" + + " WHERE Idvv = " + id; + try { + pste = conn.prepareStatement(req); + pste.setString(1, vv.getVideo()); + pste.setString(2, vv.getImage_v()); + pste.setInt(3, vv.getVoyage().getIdv()); + pste.setInt(4, vv.getAbonnement().getIda()); + + pste.executeUpdate(); + System.out.println("voyage virtuel Modifier"); + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @Override + public void supprimer(int id) throws SQLException { + String req = "DELETE FROM `voyage_virtuel` where Idvv=?; "; + try { + pste = conn.prepareStatement(req); + pste.setInt(1, id); + + + pste.executeUpdate(); + System.out.println("voyage virtuel Supprimer"); + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + } + + @Override + public List afficher() throws SQLException { + List listVOV = new ArrayList<>(); + + String req = "SELECT * FROM `voyage_virtuel` ;"; + String req2 = "SELECT * FROM `voyage` where `Idv` = ?"; + String req3 = "SELECT * FROM `abonnement` where `Ida` = ?"; + + + try { + + pste = conn.prepareStatement(req); + pste2 = conn.prepareStatement(req2); + + ResultSet rs = pste.executeQuery(); + + while(rs.next()){ + Voyage_virtuel vo = new Voyage_virtuel(); + + vo.setIdv(rs.getInt(1)); + vo.setVideo(rs.getString(2)); + vo.setImage_v(rs.getString(3)); + vo.setIdv(rs.getInt(4)); + + vo.setVoyage(new voyage(rs.getInt(5))); + + pste2.setInt(1,vo.getVoyage().getIdv()); //parametre de requete 2 + + ResultSet rs2 = pste2.executeQuery(); //affichage des voyage de req 2 + + if (rs2.next()){ + + vo.setVoyage(new voyage(rs2.getInt(1),rs2.getString(2),rs2.getString(3))); + } + + + + + //System.out.println(vo.toString()); + + listVOV.add(vo) ; + + + + } + + } catch (SQLException ex) { + Logger.getLogger(UserService.class.getName()).log(Level.SEVERE, null, ex); + } + System.out.println(listVOV.toString()); + return listVOV; + } + } + + diff --git a/test.txt b/test.txt index fd31dbf..47c2c6c 100644 --- a/test.txt +++ b/test.txt @@ -1 +1,2 @@ -testtt \ No newline at end of file +testtt +tt \ No newline at end of file