예제 #1
0
 private void jbtnBuscaActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jbtnBuscaActionPerformed
   try {
     if (!"".equals(this.jtxtCodigoBusca.getText())) {
       Product rec;
       String id_Product = this.jtxtCodigoBusca.getText();
       rec = pDAO.selectProduct(id_Product);
       if (rec == null) {
         valForm.msjInfo("Al articulo que desea buscar no existe en nuestra Base de Datos");
       } else {
         if (mtdTitleTable()) {
           Category c = categoryLogic.categoryId(rec.getId_category());
           modelo.addRow(
               new Object[] {
                 rec.getId_product(),
                 rec.getProduct() + " " + rec.getDescripcion(),
                 rec.getCantidad(),
                 rec.getP_compra(),
                 rec.getP_venta(),
                 c.getCategory(),
                 rec.getActivo()
               });
         }
       }
       this.jtxtCodigoBusca.setText("");
       this.jtxtCodigoBusca.requestFocus();
     } else {
       if (mtdProductTable()) {}
     }
   } catch (Exception ex) {
     System.out.println("Error Buscar: " + ex.getMessage());
     this.jtxtCodigoBusca.setText("");
     this.jtxtCodigoBusca.requestFocus();
   }
 } // GEN-LAST:event_jbtnBuscaActionPerformed
예제 #2
0
 private Product recoveryProduct() {
   Product recovery;
   String id_Product = (String) jtblProduct.getValueAt(this.jtblProduct.getSelectedRow(), 0);
   recovery = pDAO.selectProduct(id_Product);
   return recovery;
 }