$
This commit is contained in:
parent
8c76e54ea9
commit
d9b9b5e0fe
BIN
FI_PRJ.jar
BIN
FI_PRJ.jar
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -7,6 +7,8 @@ package Test;
|
||||
* 28/09/2022 at 20:35
|
||||
* */
|
||||
|
||||
import API.*;
|
||||
import MNP.*;
|
||||
import java.sql.*;
|
||||
import java.sql.Connection;
|
||||
import java.util.ArrayList;
|
||||
@ -14,8 +16,6 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
import org.mariadb.jdbc.*;
|
||||
|
||||
import javax.crypto.spec.PSource;
|
||||
|
||||
/**
|
||||
* <p>Methodes pour les interaction avec une base de donnees</p>
|
||||
*
|
||||
@ -145,6 +145,81 @@ public class BDatabase {
|
||||
return this.db_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recuperer la liste des etudiants (FIProjet Contexte)
|
||||
*
|
||||
* @return La liste des etudiants
|
||||
* */
|
||||
public ArrayList<Etudiant> getEtuList() {
|
||||
ArrayList<Etudiant> listEtu = new ArrayList<>();
|
||||
ArrayList<String> studPrenom = this.fetchAll("SELECT prenom FROM fi_eleves");
|
||||
ArrayList<String> studNom = this.fetchAll("SELECT nom FROM fi_eleves");
|
||||
ArrayList<String> studGroupe = this.fetchAll("SELECT groupe FROM fi_eleves");
|
||||
|
||||
for(int i = 0; i <= studPrenom.size()-1; i++) {
|
||||
if(studPrenom.get(i) != null && studNom.get(i) != null && studGroupe.get(i) != null) {
|
||||
try {
|
||||
listEtu.add(
|
||||
new EtudiantNP(
|
||||
studNom.get(i),
|
||||
studPrenom.get(i),
|
||||
Integer.parseInt(studGroupe.get(i), 10)
|
||||
)
|
||||
);
|
||||
} catch(NumberFormatException ignore) {
|
||||
listEtu.add(
|
||||
new EtudiantNP(
|
||||
studNom.get(i),
|
||||
studPrenom.get(i),
|
||||
-1
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
System.out.println("[!] Erreur lors du chargement de la liste des etudiants.");
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[+] Liste des etudiants chargee.");
|
||||
|
||||
return listEtu;
|
||||
}
|
||||
|
||||
/**
|
||||
* Recuperer la liste des groupes (FIProjet contexte)
|
||||
*
|
||||
* @return La liste des groupes
|
||||
* */
|
||||
public ArrayList<Groupe> getGroupeList() {
|
||||
ArrayList<Groupe> listGroupe = new ArrayList<>();
|
||||
ArrayList<String> groupeId = this.fetchAll("SELECT id FROM fi_groupe");
|
||||
ArrayList<String> groupeNom = this.fetchAll("SELECT nom FROM fi_groupe");
|
||||
ArrayList<String> groupeMin = this.fetchAll("SELECT min FROM fi_groupe");
|
||||
ArrayList<String> groupeMax = this.fetchAll("SELECT max FROM fi_groupe");
|
||||
|
||||
for(int i = 0; i <= groupeNom.size()-1; i++) {
|
||||
if(groupeId.get(i) != null && groupeNom.get(i) != null && groupeMin.get(i) != null && groupeMax.get(i) != null) {
|
||||
listGroupe.add(
|
||||
new GroupeNP(
|
||||
Integer.parseInt(groupeId.get(i), 10),
|
||||
groupeNom.get(i),
|
||||
Integer.parseInt(groupeMin.get(i), 10),
|
||||
Integer.parseInt(groupeMax.get(i), 10)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
System.out.println("[!] Erreur lors du chargement de la liste des groupes.");
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[+] Liste des groupes chargees.");
|
||||
|
||||
return listGroupe;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Recuperer l'hote courant.
|
||||
*
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,7 +1,6 @@
|
||||
package Test;
|
||||
|
||||
import API.*;
|
||||
import MNP.*;
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class TestTexteMNP {
|
||||
@ -9,73 +8,11 @@ public class TestTexteMNP {
|
||||
/**
|
||||
* Objet de la base de donnee contenant des methodes utile a notre developpement
|
||||
* */
|
||||
BDatabase bd = new BDatabase();
|
||||
|
||||
/**
|
||||
* Chargement des eleves
|
||||
* */
|
||||
ArrayList<Etudiant> listEtu = new ArrayList<>();
|
||||
ArrayList<String> studPrenom = bd.fetchAll("SELECT prenom FROM fi_eleves");
|
||||
ArrayList<String> studNom = bd.fetchAll("SELECT nom FROM fi_eleves");
|
||||
ArrayList<String> studGroupe = bd.fetchAll("SELECT groupe FROM fi_eleves");
|
||||
|
||||
for(int i = 0; i <= studPrenom.size()-1; i++) {
|
||||
if(studPrenom.get(i) != null && studNom.get(i) != null && studGroupe.get(i) != null) {
|
||||
try {
|
||||
listEtu.add(
|
||||
new EtudiantNP(
|
||||
studNom.get(i),
|
||||
studPrenom.get(i),
|
||||
Integer.parseInt(studGroupe.get(i), 10)
|
||||
)
|
||||
);
|
||||
} catch(NumberFormatException ignore) {
|
||||
listEtu.add(
|
||||
new EtudiantNP(
|
||||
studNom.get(i),
|
||||
studPrenom.get(i),
|
||||
-1
|
||||
)
|
||||
);
|
||||
}
|
||||
} else {
|
||||
System.out.println("[!] Erreur lors du chargement de la liste des etudiants.");
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[+] Liste des etudiants chargees.");
|
||||
|
||||
/**
|
||||
* Chargement des groupes
|
||||
* */
|
||||
ArrayList<Groupe> listGroupe = new ArrayList<>();
|
||||
ArrayList<String> groupeId = bd.fetchAll("SELECT id FROM fi_groupe");
|
||||
ArrayList<String> groupeNom = bd.fetchAll("SELECT nom FROM fi_groupe");
|
||||
ArrayList<String> groupeMin = bd.fetchAll("SELECT min FROM fi_groupe");
|
||||
ArrayList<String> groupeMax = bd.fetchAll("SELECT max FROM fi_groupe");
|
||||
|
||||
for(int i = 0; i <= groupeNom.size()-1; i++) {
|
||||
if(groupeId.get(i) != null && groupeNom.get(i) != null && groupeMin.get(i) != null && groupeMax.get(i) != null) {
|
||||
listGroupe.add(
|
||||
new GroupeNP(
|
||||
Integer.parseInt(groupeId.get(i), 10),
|
||||
groupeNom.get(i),
|
||||
Integer.parseInt(groupeMin.get(i), 10),
|
||||
Integer.parseInt(groupeMax.get(i), 10)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
System.out.println("[!] Erreur lors du chargement de la liste des groupes.");
|
||||
System.exit(-1);
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println("[+] Liste des groupes chargees.");
|
||||
BDatabase db = new BDatabase();
|
||||
|
||||
/**
|
||||
* Demarrage de l'appli
|
||||
* */
|
||||
Controller listener = new Controller(listEtu, listGroupe);
|
||||
Controller listener = new Controller(db);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user