get membre d'un groupe donné

This commit is contained in:
brinet 2022-12-02 12:27:43 +01:00
parent 305927ef1c
commit 3f25c14e3d
25 changed files with 21 additions and 15 deletions

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.

View File

@ -219,20 +219,6 @@ public class BDatabase {
return listGroupe; return listGroupe;
} }
/**
*
* Recuperer le nombre de membre d'un groupe
*
* @param groupe_id le groupes
* @return le nombre de membre
* */
public int getMemberCount(int groupe_id) {
ArrayList<String> forCount = this.fetchAll(
"SELECT nom FROM fi_eleves WHERE groupe=" + groupe_id);
return forCount.size();
}
/** /**
* Recuperer l'hote courant. * Recuperer l'hote courant.
* *

View File

@ -36,13 +36,32 @@ public class Controller implements ActionListener, ListSelectionListener {
this.db = db; this.db = db;
this.e = this.db.getEtuList(); this.e = this.db.getEtuList();
this.g = this.db.getGroupeList(); this.g = this.db.getGroupeList();
System.out.println(this.getMemberCount(-1) + " ");
this.sv = new StudentView(this.e, this.g, this); this.sv = new StudentView(this.e, this.g, this);
this.pv = new ProfView(this.e, this.g, this); this.pv = new ProfView(this.e, this.g, this);
this.av = new AdminView(this.e, this.g, this); this.av = new AdminView(this.e, this.g, this);
this.parent = new MainMenu(this); this.parent = new MainMenu(this);
} }
/**
*
* Recuperer le nombre de membre d'un groupe
*
* @param groupe_id le groupes
* @return le nombre de membre
* */
public int getMemberCount(int id) {
int j = 0;
for(int i = 0; i <= this.e.size()-1; i++) {
if(this.e.get(i).getGroupe() == id) {
j++;
}
}
return j;
}
/** /**
* Pour creer une JTable * Pour creer une JTable
* @param data Les donnees * @param data Les donnees

View File

@ -10,6 +10,7 @@ public class TestTexteMNP {
* */ * */
BDatabase db = new BDatabase(); BDatabase db = new BDatabase();
/** /**
* Demarrage de l'appli * Demarrage de l'appli
* */ * */