// metodos de mudanca public String insert() { try { Facade.getInstace().insertClient(this.client); FacesMessage msg = new FacesMessage("Departamento Salvo com sucesso!"); FacesContext.getCurrentInstance().addMessage(null, msg); seeAll(); if (client.getId() != 0) { return view(); } else { this.client = new Client(); } } catch (ClientAlreadyExistsException e) { e.printStackTrace(); FacesMessage msg = new FacesMessage(e.getMessage()); FacesContext.getCurrentInstance().addMessage(null, msg); } catch (Exception e) { e.printStackTrace(); FacesMessage msg = new FacesMessage(e.getMessage()); FacesContext.getCurrentInstance().addMessage(null, msg); } return "client"; }
public List<Client> getListClient() { if (searchField != null && !searchField.isEmpty()) { this.listClient = Facade.getInstace().findBySimilarNameClient(searchField); } if (this.listClient.isEmpty()) { seeAll(); } return listClient; }
public String findBySimilarName() { this.listClient = Facade.getInstace().findBySimilarNameClient(searchField); return "/organization/client/view_client.xhtml"; }
// metodos de busca public void seeAll() { this.listClient = Facade.getInstace().seeAllClient(); }
public void remove(Client client) { Facade.getInstace().removeClient(client); seeAll(); }