private void jButton3ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton3ActionPerformed boolean Tipo = false; if (Servicio.isSelected() == true) { Tipo = true; } try { Statement estatuto = conex.getCn().createStatement(); estatuto.executeUpdate( "UPDATE producto set Producto = '" + NombreP.getText() + "'," + "Precio = '" + PrecioP.getText() + "',Cantidad = '" + CantidadP.getText() + "',Servicio = " + Tipo + "" + " where idProducto = " + cod.getText() + ""); JOptionPane.showMessageDialog( null, NombreP.getText() + " Actualizado 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); } producto(); // TODO add your handling code here: } // GEN-LAST:event_jButton3ActionPerformed
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
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