示例#1
0
 public static void customLoad(ArrayList list, String db, String sqry) throws Exception {
   BigliettoTreno model;
   for (CachedRowSet crs = Query.select(db, sqry); crs.next(); list.add(model)) {
     model = new BigliettoTreno();
     populate(model, crs);
   }
 }
示例#2
0
  public static void load(BigliettoTreno model, String db, String id) throws Exception {
    ArrayList params = new ArrayList();
    params.add(id);

    CachedRowSet crs = Query.select(LOAD_BIGLIETTO_TRENO, params, db);
    if (crs.next()) {
      populate(model, crs);
    }
  }
示例#3
0
  public static boolean delete(String db, BigliettoTreno biglietto) throws Exception {
    boolean ok = false;
    ArrayList params = new ArrayList();

    String cod = biglietto.getCodice();

    if (cod != null && !cod.equals("")) {
      params.add(cod);
      Query.delete(DELETE_BIGLIETTO_TRENO, params, db);
    }
    return ok;
  }
示例#4
0
  public static boolean update(String db, BigliettoTreno biglietto) throws Exception {
    boolean ok = false;
    ArrayList params = new ArrayList();

    params.add(biglietto.getTrasferimento());
    params.add(biglietto.getPasseggero().getCodicePartecipante());
    params.add(biglietto.getClasse().getCodice());
    params.add(biglietto.getTariffa().toDouble());
    params.add(biglietto.getCodice());

    ok = Query.insert(UPDATE_BIGLIETTO_TRENO, params, db);

    return ok;
  }
示例#5
0
  public static void load(ArrayList list, boolean forceReload) throws SQLException, Exception {
    if (list.isEmpty() || forceReload == true) {
      list.clear();
      ArrayList params = new ArrayList();
      String dbName = JndiName.dbTakaloa;
      String sqry = "SELECT * FROM regione ORDER BY reg_nome";

      Regione model;
      for (RowSet rowSet = Query.select(sqry, params, dbName); rowSet.next(); list.add(model)) {
        model = new Regione();
        String id = rowSet.getString(1);
        RegioneDto.load(model, dbName, id);
      }
    }
  }
  public static void load(ArrayList list, boolean forceReload) throws SQLException, Exception {
    if (list.isEmpty() || forceReload == true) {
      list.clear();
      ArrayList params = new ArrayList();
      String sqry = "SELECT * FROM prenotazione_oggetto ORDER BY pog_prenotazione";

      PrenotazioneOggetto model;
      for (RowSet rowSet = Query.select(sqry, params, JndiName.dbTakaloa);
          rowSet.next();
          list.add(model)) {
        model = new PrenotazioneOggetto();
        String id = rowSet.getString(1);
        PrenotazioneOggettoDto.load(model, JndiName.dbTakaloa, id);
      }
    }
  }
示例#7
0
 public static void customLoad(BigliettoTreno model, String db, String sqry) throws Exception {
   CachedRowSet crs = Query.select(db, sqry);
   if (crs.next()) {
     populate(model, crs);
   }
 }