Examples of Mercadoria


Examples of br.com.yaw.sjc.model.Mercadoria

    }
    if (preco < 1) {
      throw new RuntimeException("O valor mínimo do preço deve ser 1!");
    }
   
    return new Mercadoria(null, nome, descricao, quantidade, preco);
  }
View Full Code Here

Examples of br.com.yaw.sjc.model.Mercadoria

      throw new PersistenceException("Informe o id válido para fazer a busca!");
    }
    Connection conn = null;
    PreparedStatement stmt = null;
    ResultSet rs = null;
    Mercadoria m = null;
   
    try {
      conn = ConnectionManager.getConnection();
      stmt = createStatementWithLog(conn, GET_MERCADORIA_BY_ID);
      stmt.setInt(1, id);
      rs = stmt.executeQuery();
     
      if (rs.next()) {
        String nome = rs.getString("nome");
        String descricao = rs.getString("descricao");
        int qtde = rs.getInt("quantidade");
        double preco = rs.getDouble("preco");
       
        m = new Mercadoria(id, nome, descricao, qtde, preco);
      }
      return m;
    } catch (SQLException e) {
      String errorMsg = "Erro ao consultar mercadoria por id!";
      log.error(errorMsg, e);
View Full Code Here

Examples of br.com.yaw.sjc.model.Mercadoria

  }
 
  private class SalvarMercadoriaListener implements ActionListener {
    public void actionPerformed(ActionEvent e) {
      try {
        Mercadoria m = loadMercadoriaFromPanel();
        MercadoriaDAO dao = new MercadoriaDAOJDBC();
        dao.save(m);
       
        setVisible(false);
        resetForm();
View Full Code Here

Examples of br.com.yaw.sjc.model.Mercadoria

      String nome = rs.getString("nome");
      String descricao = rs.getString("descricao");
      int qtde = rs.getInt("quantidade");
      double preco = rs.getDouble("preco");
     
      lista.add(new Mercadoria(id, nome, descricao, qtde, preco));
    }
    return lista;
  }
View Full Code Here

Examples of br.com.yaw.sjc.model.Mercadoria

    public void actionPerformed(ActionEvent e) {
      Integer id = getIdMercadoria();
      if (id != null) {
        try {
          MercadoriaDAO dao = new MercadoriaDAOJDBC();
          Mercadoria m = dao.findById(id);
          if (m != null) {
            dao.remove(m);
          }
         
          setVisible(false);
View Full Code Here

Examples of br.com.yaw.sjc.model.Mercadoria

    return mercadorias.size();
  }

  @Override
  public Object getValueAt(int linha, int coluna) {
    Mercadoria m = mercadorias.get(linha);
    switch (coluna) {
    case 0:
      return m.getNome();
    case 1:
      return m.getDescricao();
    case 2:
      return Mercadoria.convertPrecoToString(m.getPreco());
    case 3:
      return m.getQuantidade();
    default:
      return null;
    }
  }
View Full Code Here

Examples of br.com.yaw.sjc.model.Mercadoria

    setTitle("Editar Mercadoria");
    bExcluir.setVisible(true);
  }
 
  protected Mercadoria loadMercadoriaFromPanel() {
    Mercadoria m = super.loadMercadoriaFromPanel();
    m.setId(getIdMercadoria());
    return m;
  }
View Full Code Here

Examples of br.com.yaw.sjc.model.Mercadoria

  }
 
  private class EditarMercadoriaListener extends MouseAdapter {
    public void mouseClicked(MouseEvent event) {
      if (event.getClickCount() == 2) {
        Mercadoria m = tabela.getMercadoriaSelected();
        if (m != null) {
          editarFrame.setMercadoria(m);
          editarFrame.setVisible(true);
        }
      }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.