Upload files to "src/fr/iutfbleau/papillon/model"
Ajout de la partie qui gere les rappels
This commit is contained in:
@@ -0,0 +1,60 @@
|
|||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class GestionRappel {
|
||||||
|
|
||||||
|
public List<Rappel> lister() throws Exception {
|
||||||
|
return BaseDeDonnees.lister();
|
||||||
|
}
|
||||||
|
|
||||||
|
public int ajouter(Rappel r) throws Exception {
|
||||||
|
return BaseDeDonnees.ajouter(r);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int modifierParId(int id, Rappel r) throws Exception {
|
||||||
|
return BaseDeDonnees.modifier(id, r);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int supprimerParId(int id) throws Exception {
|
||||||
|
return BaseDeDonnees.supprimer(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// === petit main pour test rapide ===
|
||||||
|
public static void main(String[] args) {
|
||||||
|
try {
|
||||||
|
GestionRappel g = new GestionRappel();
|
||||||
|
|
||||||
|
// Ajouter
|
||||||
|
Rappel r = new Rappel("Acheter du café", "avant 17h", "Urgent", 1);
|
||||||
|
int id = g.ajouter(r);
|
||||||
|
System.out.println("Ajouté : " + id);
|
||||||
|
|
||||||
|
// Lister
|
||||||
|
System.out.println("\nListe des rappels :");
|
||||||
|
for (Rappel x : g.lister()) {
|
||||||
|
System.out.println(" - " + x);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Modifier
|
||||||
|
r.setTitre("Acheter du café (bio)");
|
||||||
|
r.setRang(3);
|
||||||
|
|
||||||
|
g.modifierParId(r.getId(), r);
|
||||||
|
System.out.println("\nAprès modification :");
|
||||||
|
|
||||||
|
for (Rappel x : g.lister()) {
|
||||||
|
System.out.println(" - " + x);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Supprimer
|
||||||
|
// g.supprimerParId(r.getId());
|
||||||
|
// System.out.println("\nAprès suppression :");
|
||||||
|
|
||||||
|
// for (Rappel x : g.lister()) {
|
||||||
|
// System.out.println(" - " + x);
|
||||||
|
|
||||||
|
// }
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user