private boolean mtdProductTable() { try { if (mtdTitleTable()) { List<Product> listProduct = pDAO.listProduct(); for (Product p : listProduct) { for (Category c : myCategory) { if (p.getId_category().equals(c.getId_category())) { if (p.getActivo() == 1) { mensaje = "SI"; } else { mensaje = "NO"; } modelo.addRow( new Object[] { p.getId_product(), p.getProduct() + " " + p.getDescripcion(), p.getCantidad(), p.getP_compra(), p.getP_venta(), c.getCategory(), mensaje }); } } } // getNegocio(); this.jlblRegistros.setText( "Hay " + listProduct.size() + " Articulos registrados en la Base de Datos"); } return true; } catch (Exception ex) { valForm.msjErr("Error: " + ex.getMessage()); return false; } }
private void getByModifiedProduct() { try { if (this.jtblProduct.getSelectedRowCount() != 0) { Product rc = recoveryProduct(); valForm.editableTextFields(jpnAddProduct, true); this.jtxtId_Product.setEnabled(false); this.jtxtId_Product.setText("" + rc.getId_product()); this.jtxtProduct.setText("" + rc.getProduct()); this.jtxtDescripcion.setText("" + rc.getDescripcion()); this.jtxtPrecioCompra.setText("" + rc.getP_compra()); this.jtxtPrecioVenta.setText("" + rc.getP_venta()); this.jtxtCantidad.setText("" + rc.getCantidad()); if (null != myCategory) { for (Category c : myCategory) { if (c.getId_category().equals(rc.getId_category())) { jcmbCategoria.setSelectedItem(c.getCategory()); } } } /* * Validamos si el Articulo esta activo */ if (rc.getActivo() == 1) { this.jchkActivo.setSelected(true); } else { this.jchkActivo.setSelected(false); } /* * Cambia el estatus del boton Guardar a Actualizar */ this.jbtnOperacion.setText("Actualizar"); jbtnOperacion.setIcon(new ImageIcon(pathImage + "update.gif")); // Seleccionamos la PestaƱa 1 para modificar el Articulo seleccionado frmProduct.jtbpProduct.setSelectedIndex(0); jtbpProduct.setEnabledAt(1, false); } else { valForm.msjWarn("No se ha seleccionado ningun Articulo..."); } } catch (Exception ex) { System.out.println("getByModifiedProduct. Error: " + ex.getMessage()); } }