Пример #1
0
 public static int findCategorierID(String name) {
   for (Categorier cat : CategorierList) {
     if (cat.getNomCategorier() == name) {
       return cat.getIdcat();
     }
   }
   return 0;
 }
Пример #2
0
 // *************************************************************************
 public String findUniterNameCat(int id) {
   for (Categorier cat : CategorierList) {
     if (cat.getIdcat() == id) {
       return findUniterName(cat.getIduniter());
     }
   }
   return null;
 }
Пример #3
0
 public String findCategorierName(int id) {
   for (Categorier cat : CategorierList) {
     if (cat.getIdcat() == id) {
       return cat.getNomCategorier();
     }
   }
   return null;
 }
Пример #4
0
  public void categorier() {
    String sql = "SELECT * FROM categorier";
    try (Statement stmt = conn.createStatement();
        ResultSet rs = stmt.executeQuery(sql); ) {
      // System.out.println("uniter Table:");
      while (rs.next()) {
        Categorier categorier = new Categorier();
        categorier.setIdcat(rs.getInt("idcat"));
        categorier.setNomCategorier(rs.getString("nomcat"));
        categorier.setIduniter(rs.getInt("iduniter"));

        CategorierList.add(categorier);
      }
    } catch (SQLException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }