Example #1
0
 public static Produit findProdiutWithName(String name) {
   for (Produit prd : ProduitList) {
     if (prd.getNomProduit() == name) {
       return prd;
     }
   }
   return null;
 }
Example #2
0
 // *************************************************************************
 // public Vector getCategorierVector
 // *************************************************************************
 public static List<Produit> ListOfProduitWithCat(int id) {
   List<Produit> lprd = new ArrayList<Produit>();
   for (Produit prd : ProduitList) {
     if (prd.getIdcat() == id) {
       lprd.add(prd);
     }
   }
   return lprd;
 }
Example #3
0
 public void addArticle(Produit p, int quantite) {
   if (items.get(p.getIdProduit()) == null) {
     LigneCommande lc = new LigneCommande();
     lc.setProduit(p);
     lc.setQuantite(quantite);
     lc.setPrix(p.getPrix());
   } else {
     LigneCommande lc = items.get(p.getIdProduit());
     lc.setQuantite(lc.getQuantite() + quantite);
   }
 }
 void delete() {
   if (commande != null) {
     Commande commande = this.commande;
     this.commande = null;
     commande.remove(this.getProduit());
   }
   if (produit != null) {
     Produit produit = this.produit;
     this.produit = null;
     produit.remove(this);
   }
   Passerelle.delete(this);
 }
Example #5
0
 public void produit() {
   String sql = "SELECT * FROM produit";
   try (Statement stmt = conn.createStatement();
       ResultSet rs = stmt.executeQuery(sql); ) {
     // System.out.println("uniter Table:");
     while (rs.next()) {
       Produit produit = new Produit();
       produit.setIdcat(rs.getInt("cat"));
       produit.setIdproduit(rs.getInt("idproduit"));
       produit.setNomProduit(rs.getString("ref"));
       produit.setQnt(rs.getInt("qnt_unt"));
       ProduitList.add(produit);
     }
   } catch (SQLException e) {
     // TODO Auto-generated catch block
     e.printStackTrace();
   }
 }
 @Override
 public String toString() {
   return "" + quantite + " * " + produit.getNom();
 }
 DetailCommande(Commande commande, Produit produit, int quantite) {
   this.commande = commande;
   this.produit = produit;
   produit.add(this);
   this.quantite = quantite;
 }