Ejemplo n.º 1
0
  private void TableProductoMouseClicked(
      java.awt.event.MouseEvent evt) { // GEN-FIRST:event_TableProductoMouseClicked
    int filaselected = TableProducto.getSelectedRow();
    String codigo = " ", producto = " ", precio = " ", cantidad = " ";
    try {
      if (filaselected == -1) {
        JOptionPane.showMessageDialog(null, "Debe Seleccionar un producto");
      } else {
        TableProducto.getModel();
        //     codigo = TableProducto.getValueAt(filaselected, 0).toString();
        producto = TableProducto.getValueAt(filaselected, 1).toString();
        precio = TableProducto.getValueAt(filaselected, 2).toString();
        cantidad = TableProducto.getValueAt(filaselected, 3).toString();
        codigo = TableProducto.getValueAt(filaselected, 0).toString();
        NombreP.setText(producto);
        PrecioP.setText(precio);
        CantidadP.setText(cantidad);
        cod.setText(codigo);
      }

    } catch (HeadlessException e) {

    }

    // TODO add your handling code here:
  } // GEN-LAST:event_TableProductoMouseClicked
Ejemplo n.º 2
0
 private void NombrePKeyReleased(
     java.awt.event.KeyEvent evt) { // GEN-FIRST:event_NombrePKeyReleased
   NombreP.setText(NombreP.getText().toUpperCase()); // TODO add your handling code here:
 } // GEN-LAST:event_NombrePKeyReleased
Ejemplo n.º 3
0
 private void btnGuardarActionPerformed(
     java.awt.event.ActionEvent evt) { // GEN-FIRST:event_btnGuardarActionPerformed
   boolean Tipo = false;
   if (Servicio.isSelected() == true) {
     Tipo = true;
   }
   if (("".equals(NombreP.getText()))
       || ("".equals(PrecioP.getText()))
       || ("".equals(CantidadP.getText()))) {
     JOptionPane.showMessageDialog(
         null,
         "No ha ingresado ningun Producto",
         "StudentControl 1.2",
         JOptionPane.INFORMATION_MESSAGE);
   } else {
     if (isNumeric(PrecioP.getText()) == true) {
       if (isNumeric(CantidadP.getText()) == true) {
         if (conex.Bitacora(Usuario, "Nuevo Producto: " + NombreP) == true) {
           try {
             Statement estatuto = conex.getCn().createStatement();
             estatuto.executeUpdate(
                 "INSERT INTO producto"
                     + "(Producto, Precio, Cantidad, Servicio)"
                     + "values('"
                     + NombreP.getText()
                     + "','"
                     + PrecioP.getText()
                     + "','"
                     + CantidadP.getText()
                     + "', "
                     + Tipo
                     + ")");
             JOptionPane.showMessageDialog(
                 null,
                 NombreP.getText() + " Agregado Exitosamente",
                 "StudentControl 1.2",
                 JOptionPane.INFORMATION_MESSAGE);
           } catch (SQLException e) {
             JOptionPane.showMessageDialog(
                 null,
                 "No se Registro el Producto: " + e.getMessage(),
                 "StudentControl 1.2",
                 JOptionPane.INFORMATION_MESSAGE);
           }
           NombreP.setText("");
           PrecioP.setText("");
           CantidadP.setText("");
           producto();
         }
       } else {
         JOptionPane.showMessageDialog(
             null,
             "Debe Ingresar una Cantidad Valida del Producto",
             "StudentControl 1.2",
             JOptionPane.INFORMATION_MESSAGE);
       }
     } else {
       JOptionPane.showMessageDialog(
           null,
           "Debe Ingresar un Valor Valido para el Precio",
           "StudentControl 1.2",
           JOptionPane.INFORMATION_MESSAGE);
     }
   }
   // TODO add your handling code here:
 } // GEN-LAST:event_btnGuardarActionPerformed