// Permet de pour selectionner les objets dans les setlectitemmenu ou listbox
  public List<SelectItem> getSelectClient() throws ServiceException {

    List<Client> allClient = clientService.findAll();
    selectClient.clear();
    for (Client client : allClient) {

      selectClient.add(
          new SelectItem(client.getId(), client.getNom() + " - " + client.getPrenom()));
    }

    return selectClient;
  }
  public String modifyClient() throws Exception {
    // Permet de récupérer l'id du client a modifier
    client = clients.getRowData();
    clientService.findById(client.getId());

    return "client";
  }
Example #3
0
 @Override
 public Client findOneClient(Client client) throws DAOException {
   try {
     return entityManager.find(Client.class, client.getId());
   } catch (PersistenceException e) {
     throw new DAOException("error findOneClient client", e);
   }
 }
  public String deleteClient() throws Exception {
    // On recupère l'id de l'utisateur que l'on a selectionner dans le tableau il faut utiliser
    // ListDataModel
    client = clients.getRowData();

    clientService.removeById(client.getId());
    // On met un return pour ne pas avoir d'erreur dans la page xhtml car action attent un
    // string pas un void
    // On return la methode et plus la table pour primefaces
    return initListClient();
  }