Advertisement
Metziop

asignaciones

May 22nd, 2021
868
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.79 KB | None | 0 0
  1. private void btnAsignarActionPerformed(java.awt.event.ActionEvent evt) {                                          
  2.         try {
  3.             //String user1=loginSesion.user;
  4.             String querry=("INSERT INTO pedidosempleado (estatus, tiempoEstimado, numeroEmpleado, idArreglo, user,comision1, sucursal1) values(?,?,?,?,?,?,?)");
  5.             Connection conn = MySQLConection.getConnection();
  6.             PreparedStatement ps = conn.prepareStatement(querry);
  7.             String estatus="asignado";
  8.             String sucursal1= "Matriz";
  9.             int fila = jtArreglos.getSelectedRow();        
  10.             String tiempoElavoracion = jtArreglos.getValueAt(fila, 2).toString();
  11.             String idArreglo = jtArreglos.getValueAt(fila, 0).toString();
  12.            
  13.             int fila2 = jtEmpleados.getSelectedRow();
  14.             String numEmpleado = jtEmpleados.getValueAt(fila2, 0).toString();
  15.             String user =jtEmpleados.getValueAt(fila2, 2).toString();
  16.            
  17.             ps.setString(1, estatus);
  18.             ps.setString(2, tiempoElavoracion);
  19.             ps.setInt(3, Integer.parseInt(numEmpleado));
  20.             ps.setInt(4, Integer.parseInt(idArreglo));
  21.             ps.setString(5, user);
  22.             ps.setDouble(6, Double.valueOf(txtcomision.getText()));
  23.             ps.setString(7, sucursal1);
  24.             int res= ps.executeUpdate();
  25.             //insertarcomision();
  26.          
  27.             if(res>0){
  28.                 JOptionPane.showMessageDialog(null, "Trabajo asignado correctamente");
  29.             }else{JOptionPane.showMessageDialog(null, "Error al asignar trabajo");}
  30.             conn.close();
  31.            
  32.         } catch (Exception e) {
  33.             JOptionPane.showMessageDialog(null,"error"+e);
  34.         }
  35.        
  36.     }                                          
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement