Exemplo n.º 1
0
 public static Produit findProdiutWithName(String name) {
   for (Produit prd : ProduitList) {
     if (prd.getNomProduit() == name) {
       return prd;
     }
   }
   return null;
 }
Exemplo n.º 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;
 }
Exemplo n.º 3
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();
   }
 }