Package br.com.sistelecom.entity

Examples of br.com.sistelecom.entity.Produto


    try{
      ps = conn.prepareStatement("select * from produto");
      rs = ps.executeQuery();
      List<Produto> list = new ArrayList<Produto>();
      while(rs.next()) {
        list.add(new Produto(rs.getInt(1), rs.getString(2), rs.getString(3), rs.getFloat(4), rs.getDate(5)));
      }
      return list;
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here


      rs = ps.executeQuery();
      if (!rs.next()) {
        throw new Exception("Não foi encontrado o produto com esse id: " + id);
      }

      Produto produto = new Produto();
      produto.setIdProduto(id);
      produto.setNomeProduto(rs.getString(2));
      produto.setTipo(rs.getString(3));
      produto.setValorReceita(rs.getFloat(4));
      produto.setCriacao(rs.getDate(5));

      return produto;
    } catch (Exception e) {
      e.printStackTrace();
    }
View Full Code Here

 
  public void carregarRegistro(ActionEvent evento) {
    final String id = ((HtmlActionParameter)((HtmlAjaxCommandButton)evento.getSource()).getChildren().get(0)).getValue().toString();
    int idProduto = Integer.parseInt(id);

    final Produto produto = this.getDao().obterPorId(idProduto);

    this.getProduto().setIdProduto(produto.getIdProduto());
    this.getProduto().setNomeProduto(produto.getNomeProduto());
    this.getProduto().setTipo(produto.getTipo());
    this.getProduto().setValorReceita(produto.getValorReceita());
    this.getProduto().setCriacao(produto.getCriacao());
  }
View Full Code Here

 
  public void excluirRegistro(ActionEvent evento) {
    final String id = ((HtmlActionParameter)((HtmlAjaxCommandButton)evento.getSource()).getChildren().get(0)).getValue().toString();
    int idProduto = Integer.parseInt(id);
   
    final Produto produto = this.getDao().obterPorId(idProduto);
   
    try {
      if(produto != null){
        this.getDao().excluir(produto);
        this.listarTodos();
View Full Code Here

    }
    return true;
  }
 
  public void limpar() {
    this.produto = new Produto();
  }
View Full Code Here

  /**
   * @return the produto
   */
  public Produto getProduto() {
    if (this.produto == null) {
      this.produto = new Produto();
    }
    return produto;
  }
View Full Code Here

TOP

Related Classes of br.com.sistelecom.entity.Produto

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.