From ebe6f29978d3634336b9bc042d9a17a79df844ad Mon Sep 17 00:00:00 2001 From: "ilona.cardot" Date: Thu, 12 Sep 2024 10:28:32 +0200 Subject: [PATCH] =?UTF-8?q?modification=20de=20la=20m=C3=A9thode=20ajouter?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/métiers/Commande.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/src/métiers/Commande.java b/src/métiers/Commande.java index ba443f8..1bfeb60 100644 --- a/src/métiers/Commande.java +++ b/src/métiers/Commande.java @@ -36,7 +36,14 @@ private final HashMap lesLignes = new HashMap<>(); * @return true si l'ajout est bon */ public boolean ajouter(Instrument unInstrument, int qte){ - boolean ajoutOK = lesLignes.put(unInstrument,qte); + boolean ajoutOK; + int qteDisponible = unInstrument.getQteStock(); + if (qteDisponible lesLignes = new HashMap<>(); * @return true si la suppression est effectuée */ public boolean supprimer(Instrument unInstrument){ - boolean suppOK = lesLignes.remove(unInstrument); - return suppOK; + //lesLignes.remove(unInstrument); + } ///////////////////////////////////////////////////////////////////////////////// @@ -63,6 +70,11 @@ private final HashMap lesLignes = new HashMap<>(); return dateCom; } + public HashMap getLesLignes() { + return lesLignes; + } + + public void setNoCom(int noCom) { this.noCom = noCom; }