Package modele.course

Examples of modele.course.Trajet


          ResultSet res = null;
          try {
            smt = connection.prepareStatement(GET_ALL_TRAJET);
            res = smt.executeQuery();
            while (res.next()) {
               Trajet trajet = new Trajet(res.getInt(1));
               Tournee tournee = new Tournee(res.getInt(2));
               trajet.setTournee(tournee);

               trajet.setAddresseDepart(res.getString(3));
               trajet.setKilometrageTaximetreDepart(Long.parseLong(res.getString(4)));
               Date hrDepart = new java.sql.Timestamp(res.getTimestamp(5).getTime());
               //Date hrDepart = new Date(res.getDate(5).getTime());
               trajet.setHeureDepart(hrDepart);


               trajet.setAddresseArrivee(res.getString(6));
               trajet.setKilometrageTaximetreArrivee(Long.parseLong(res.getString(7)));
               //Date hrArrivee = new Date(res.getDate(8).getTime());
               Date hrArrivee = new java.sql.Timestamp(res.getTimestamp(8).getTime());
               trajet.setHeureArrivee(hrArrivee);

               trajet.setPrixCourse(new BigDecimal(res.getString(9)));
               trajet.setPrixSupplementaire(new BigDecimal(res.getString(10)));
              
              listeTrajet.add(trajet);
            }
          } finally {
            try {
View Full Code Here


          try {
            smt = connection.prepareStatement(GET_TRAJET_BY_ID);
            smt.setInt(1, id);
            res = smt.executeQuery();
            if (res.next()) {
              result[0] = new Trajet(res.getInt(1));

              Tournee tournee = new Tournee(res.getInt(2));
              result[0].setTournee(tournee);

View Full Code Here

            smt.setTimestamp(2, new java.sql.Timestamp(periode.dateDebut().getTime()));
            smt.setTimestamp(3,new java.sql.Timestamp(periode.dateFin().getTime()));
            res = smt.executeQuery();
            while (res.next()) {
              int id = res.getInt(1);
              Trajet trajet = new Trajet(id);
              trajet.setTournee(tourneeDao.find(res.getInt(2)));
              trajet.setAddresseDepart(res.getString(3));
              trajet.setKilometrageTaximetreDepart(res.getLong(4));
              trajet.setHeureDepart(new java.sql.Timestamp(res.getTimestamp(5).getTime()));
              trajet.setAddresseArrivee(res.getString(6));
              trajet.setKilometrageTaximetreArrivee(res.getLong(7));
              trajet.setHeureArrivee(new java.sql.Timestamp(res.getTimestamp(8).getTime()));
              trajet.setPrixCourse(res.getBigDecimal(9));
              trajet.setPrixSupplementaire(res.getBigDecimal(10));

              trajets.add(trajet);
            }
          } finally {
            try {
View Full Code Here

          try {
            smt = connection.prepareStatement(GET_TRAJETS_BY_TOURNEE);
            smt.setInt(1, tournee.getId());
            res = smt.executeQuery();
            while (res.next()) {
              Trajet trajet = new Trajet(res.getInt(1));
              trajet.setTournee(tournee);

              trajet.setAddresseDepart(res.getString(2));
              trajet.setKilometrageTaximetreDepart(Long.parseLong(res.getString(3)));
              Date hrDepart = new java.sql.Timestamp(res.getTimestamp(4).getTime());
              trajet.setHeureDepart(hrDepart);

              trajet.setAddresseArrivee(res.getString(5));
              trajet.setKilometrageTaximetreArrivee(Long.parseLong(res.getString(6)));
              Date hrArrivee = new java.sql.Timestamp(res.getTimestamp(7).getTime());
              trajet.setHeureArrivee(hrArrivee);

              trajet.setPrixCourse(new BigDecimal(res.getString(8)));
              trajet.setPrixSupplementaire(new BigDecimal(res.getString(9)));

              listeTrajet.add(trajet);

            }
          } finally {
View Full Code Here

    public int getRowCount() {
      return trajet.size();
    }

    public Object getValueAt(int rowIndex, int columnIndex) {
      Trajet trajetAtRow = trajet.get(rowIndex);
      switch (columnIndex) {
      case 0:
        return trajetAtRow.getId();
      case 1:
        return trajetAtRow.getTournee().getId();
      case 2:
        return trajetAtRow.getAddresseDepart();
      case 3:
        return trajetAtRow.getKilometrageTaximetreDebut();
      case 4:
        return  new SimpleDateFormat(MotsCleProjet.TIME_FORMAT).format((trajetAtRow.getHeureDepart()));
      case 5:
        return trajetAtRow.getAddresseArrivee();
      case 6:
        return trajetAtRow.getKilometrageTaximetreFin();
      case 7:
        return  new SimpleDateFormat(MotsCleProjet.TIME_FORMAT).format((trajetAtRow.getHeureArrivee()));
      case 8:
        return trajetAtRow.getPrixCourse();
      case 9:
        return trajetAtRow.getPrixSupplementaire();     
     
      default:
        throw new IllegalStateException("Le nombre de colonne ne peut pas d�passer " + NOMBRE_COLONNE + ". index demand� " + columnIndex);
      }
    }
View Full Code Here

   * construit un trajet
   * � partir de d'une ligne de donn�e
     *
   */
  public Trajet decode(String[] ligne) {
    Trajet trajet = new Trajet();
   
    Tournee tournee = tourneeDao.find(Integer.parseInt(ligne[INDEX_CHAMP_CODE_TOURNEE]));
    trajet.setTournee(tournee);
   
    trajet.setAddresseDepart(ligne[INDEX_CHAMP_ADRESSE_DEPART]);
    trajet.setKilometrageTaximetreDepart(Long.parseLong(ligne[INDEX_CHAMP_KM_TAXISMETRE_DEPART]));
   
    Date dateDebutTrajet = null;
    String format = gui.MotsCleProjet.DATE_TIME_FORMAT;
    try {
      dateDebutTrajet = new SimpleDateFormat(format).parse(ligne[INDEX_CHAMP_DATE_HEURE_DEPART]);
      trajet.setHeureDepart(dateDebutTrajet);
    } catch (ParseException e) {
      TaxiGuiUtil.MessageBox(MainWindow.desktop(), "Le format de date est invalide : attendu " + format, "Erreur");
    }   
   
   
    trajet.setAddresseArrivee(ligne[INDEX_CHAMP_ADRESSE_ARRIVEE]);
    trajet.setKilometrageTaximetreArrivee(Long.parseLong(ligne[INDEX_CHAMP_KM_TAXISMETRE_ARRIVE]));
   
    Date dateFinTrajet = null;
    try {
      dateFinTrajet = new SimpleDateFormat(format).parse(ligne[INDEX_CHAMP_DATE_HEURE_ARRIVEE]);
      trajet.setHeureArrivee(dateFinTrajet)
    } catch (ParseException e) {
      TaxiGuiUtil.MessageBox(MainWindow.desktop(), "Le format de date est invalide : attendu " + format, "Erreur");
    }   
   
   
    trajet.setPrixCourse(new BigDecimal(ligne[INDEX_CHAMP_PRIX_COURSE]));
    trajet.setPrixSupplementaire(new BigDecimal(ligne[INDEX_CHAMP_PRIX_SUPPLEMENT]));
   
   
    return trajet;
  }
View Full Code Here

     
      /**
       *
       */
      public Trajet decode(Map<Integer,String> ligne) {
        Trajet trajet = new Trajet();     
     
      trajet.setAddresseDepart(ligne.get(INDEX_CHAMP_ADRESSE_DEPART));
      trajet.setKilometrageTaximetreDepart(Long.parseLong(ligne.get(INDEX_CHAMP_KM_TAXISMETRE_DEPART)));     
      Date dateDebutTrajet = null;
      try {
        dateDebutTrajet = new SimpleDateFormat(gui.MotsCleProjet.TIME_FORMAT).parse(ligne.get(INDEX_CHAMP_DATE_HEURE_DEPART));
      } catch (ParseException e) {
        e.printStackTrace();
        TaxiGuiUtil.MessageBox(MainWindow.desktop(), "Le format de date d�but trajet est invalide : attendu " + gui.MotsCleProjet.DATE_TIME_FORMAT, "Erreur");
      }
      trajet.setHeureDepart(dateDebutTrajet);

      trajet.setAddresseArrivee(ligne.get(INDEX_CHAMP_ADRESSE_ARRIVEE));
      trajet.setKilometrageTaximetreArrivee(Long.parseLong(ligne.get(INDEX_CHAMP_KM_TAXISMETRE_ARRIVE)));     
      Date dateFinTrajet = null;
      try {
        dateFinTrajet = new SimpleDateFormat(gui.MotsCleProjet.TIME_FORMAT).parse(ligne.get(INDEX_CHAMP_DATE_HEURE_ARRIVEE));
      } catch (ParseException e) {
        e.printStackTrace();
        TaxiGuiUtil.MessageBox(MainWindow.desktop(), "Le format de date fin trajet est invalide : attendu " + gui.MotsCleProjet.DATE_TIME_FORMAT, "Erreur");
      }
      trajet.setHeureArrivee(dateFinTrajet);
      trajet.setPrixCourse(new BigDecimal(ligne.get(INDEX_CHAMP_PRIX_COURSE)));
      trajet.setPrixSupplementaire(new BigDecimal(ligne.get(INDEX_CHAMP_PRIX_SUPPLEMENT)));
         
          return trajet;
      }
View Full Code Here

TOP

Related Classes of modele.course.Trajet

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.