コード例 #1
0
  // 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";
  }
コード例 #2
0
 public List<Client> getListClient() {
   if (searchField != null && !searchField.isEmpty()) {
     this.listClient = Facade.getInstace().findBySimilarNameClient(searchField);
   }
   if (this.listClient.isEmpty()) {
     seeAll();
   }
   return listClient;
 }
コード例 #3
0
  public String findBySimilarName() {
    this.listClient = Facade.getInstace().findBySimilarNameClient(searchField);

    return "/organization/client/view_client.xhtml";
  }
コード例 #4
0
 // metodos de busca
 public void seeAll() {
   this.listClient = Facade.getInstace().seeAllClient();
 }
コード例 #5
0
 public void remove(Client client) {
   Facade.getInstace().removeClient(client);
   seeAll();
 }