package Boundary;
import Control.ConsultarEstado;
import Control.Login;
import Entity.Equipomasfull;
import Entity.Usuario;
import java.awt.Color;
public class consultar extends javax.swing.JPanel {
//private Equipomasfull sistema=Login.sistema;
public consultar() {
initComponents();
}
@SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
private void initComponents() {
jLabel1 = new javax.swing.JLabel();
resultado = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
listadocumentos = new javax.swing.JComboBox();
DocumentoTF = new javax.swing.JTextField();
aceptarB = new javax.swing.JButton();
jLabel3 = new javax.swing.JLabel();
nombre = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
apellidos = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
puntos = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
telefonoL = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
correoL = new javax.swing.JLabel();
jLabel8 = new javax.swing.JLabel();
celularL = new javax.swing.JLabel();
jLabel1.setText("Estado Operacion:");
resultado.setForeground(new java.awt.Color(255, 255, 255));
resultado.setText("No se ha hecho ninguna Operación");
jLabel2.setText("Documento");
listadocumentos.setBackground(new java.awt.Color(240, 240, 240));
listadocumentos.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Código", "Cédula" }));
listadocumentos.setBorder(null);
DocumentoTF.setText("0");
DocumentoTF.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEvent evt) {
DocumentoTFMouseClicked(evt);
}
});
DocumentoTF.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
DocumentoTFKeyTyped(evt);
}
});
aceptarB.setText("Aceptar");
aceptarB.setBorder(null);
aceptarB.setBorderPainted(false);
aceptarB.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
aceptarBActionPerformed(evt);
}
});
jLabel3.setText("Nombre:");
jLabel4.setText("Apellidos:");
jLabel6.setText("Puntos:");
jLabel5.setText("Telefono:");
jLabel7.setText("Correo:");
jLabel8.setText("Celular:");
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jLabel2)
.addGap(18, 18, 18)
.addComponent(listadocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(DocumentoTF, javax.swing.GroupLayout.DEFAULT_SIZE, 162, Short.MAX_VALUE)
.addComponent(aceptarB, javax.swing.GroupLayout.PREFERRED_SIZE, 76, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(102, 102, 102))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel7)
.addGap(18, 18, 18)
.addComponent(correoL, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel3)
.addGap(18, 18, 18)
.addComponent(nombre, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
.addComponent(jLabel6)
.addGap(18, 18, 18)
.addComponent(puntos, javax.swing.GroupLayout.DEFAULT_SIZE, 105, Short.MAX_VALUE))
.addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 117, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(resultado, javax.swing.GroupLayout.PREFERRED_SIZE, 234, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jLabel4)
.addComponent(jLabel5)
.addComponent(jLabel8))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(celularL, javax.swing.GroupLayout.PREFERRED_SIZE, 164, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(telefonoL, javax.swing.GroupLayout.PREFERRED_SIZE, 124, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(apellidos, javax.swing.GroupLayout.DEFAULT_SIZE, 182, Short.MAX_VALUE))))
.addContainerGap())))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addGroup(layout.createSequentialGroup()
.addGap(123, 123, 123)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(nombre, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel4)))
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2)
.addComponent(listadocumentos, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(DocumentoTF, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(36, 36, 36)
.addComponent(aceptarB, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(apellidos, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(puntos, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel5)
.addComponent(telefonoL, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel6))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel7)
.addComponent(correoL, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel8)
.addComponent(celularL, javax.swing.GroupLayout.PREFERRED_SIZE, 15, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 53, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel1)
.addComponent(resultado, javax.swing.GroupLayout.PREFERRED_SIZE, 14, javax.swing.GroupLayout.PREFERRED_SIZE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
private void aceptarBActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_aceptarBActionPerformed
long h=0L;
int a = listadocumentos.getSelectedIndex();
long doc=Long.parseLong(DocumentoTF.getText());
ConsultarEstado cestado=new ConsultarEstado();
Usuario user=cestado.Usuarioexiste(doc, a);
float num=cestado.obtenerpuntos(user);
puntos.setText(num+"");
nombre.setText(user.getNombre());
apellidos.setText(user.getApellidos());
correoL.setText(user.getEmail());
telefonoL.setText(user.getTelfijo()+"");
celularL.setText(user.getCelular()+"");
if (!cestado.id(user).equals("El usuario no existe")){
resultado.setForeground(Color.green);
resultado.setText("Registro encontrado.");
}else{
resultado.setForeground(Color.red);
resultado.setText("Registro no encontrado.");}
}//GEN-LAST:event_aceptarBActionPerformed
private void DocumentoTFMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_DocumentoTFMouseClicked
// TODO add your handling code here:
DocumentoTF.setText("");
}//GEN-LAST:event_DocumentoTFMouseClicked
private void DocumentoTFKeyTyped(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_DocumentoTFKeyTyped
// TODO add your handling code here:
char noper=evt.getKeyChar();
if(!Character.isDigit(noper)){
evt.consume();
}
}//GEN-LAST:event_DocumentoTFKeyTyped
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JTextField DocumentoTF;
private javax.swing.JButton aceptarB;
private javax.swing.JLabel apellidos;
private javax.swing.JLabel celularL;
private javax.swing.JLabel correoL;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
private javax.swing.JLabel jLabel4;
private javax.swing.JLabel jLabel5;
private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
private javax.swing.JLabel jLabel8;
private javax.swing.JComboBox listadocumentos;
private javax.swing.JLabel nombre;
private javax.swing.JLabel puntos;
private javax.swing.JLabel resultado;
private javax.swing.JLabel telefonoL;
// End of variables declaration//GEN-END:variables
}