/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * JfrmCuentaCorriente.java
 *
 * Created on 08-dic-2009, 18:25:17
 */

package src;

import java.io.IOException;
import javax.swing.JOptionPane;

/**
 *
 * @author Carlos
 */
public class JfrmLoginDirector extends javax.swing.JFrame {
    Sucursal suc;
    Cuentas c=new Cuentas();
    CuentaCorriente cc=new CuentaCorriente();
    String numCuenta;


    /** Creates new form JfrmCuentaCorriente */
    public JfrmLoginDirector(Sucursal auxsuc) {
        suc=auxsuc;
        initComponents();
        jBCrearEmpleado.setEnabled(false);
        jBModificarEmpleado.setEnabled(false);
        jBListadoEmpleados.setEnabled(false);
        setResizable(false); //ASI QUITAMOS QUE SE PUEDA MAXIMIZAR
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jBGeneraCuenta = new javax.swing.JButton();
        jtxtIDE = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        jLabel6 = new javax.swing.JLabel();
        jSeparator2 = new javax.swing.JSeparator();
        jSeparator1 = new javax.swing.JSeparator();
        jBCrearEmpleado = new javax.swing.JButton();
        jBModificarEmpleado = new javax.swing.JButton();
        jtxtContraseña = new javax.swing.JPasswordField();
        jBAyuda = new javax.swing.JButton();
        jBListadoEmpleados = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabel1.setForeground(new java.awt.Color(0, 0, 255));
        jLabel1.setText("IDENTIFICACION");

        jBGeneraCuenta.setText("VALIDAR");
        jBGeneraCuenta.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBGeneraCuentaActionPerformed(evt);
            }
        });

        jtxtIDE.setText("123");
        jtxtIDE.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jtxtIDEActionPerformed(evt);
            }
        });

        jLabel2.setText("IDE Empleado:");

        jLabel3.setText("Contraseña:");

        jLabel6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/src/InterfazMINI.gif"))); // NOI18N

        jBCrearEmpleado.setText("CREAR EMPLEADO");
        jBCrearEmpleado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBCrearEmpleadoActionPerformed(evt);
            }
        });

        jBModificarEmpleado.setText("MODIFICAR EMPLEADO");
        jBModificarEmpleado.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBModificarEmpleadoActionPerformed(evt);
            }
        });

        jtxtContraseña.setText("123");

        jBAyuda.setText("AYUDA");
        jBAyuda.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBAyudaActionPerformed(evt);
            }
        });

        jBListadoEmpleados.setText("LISTADO EMPLEADOS");
        jBListadoEmpleados.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jBListadoEmpleadosActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(81, 81, 81)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(jtxtIDE)
                    .addComponent(jtxtContraseña, javax.swing.GroupLayout.DEFAULT_SIZE, 97, Short.MAX_VALUE))
                .addGap(18, 18, 18)
                .addComponent(jBGeneraCuenta, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(54, 54, 54))
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                                .addComponent(jLabel6)
                                .addGap(79, 79, 79)
                                .addComponent(jLabel1)
                                .addGap(18, 18, 18)
                                .addComponent(jBAyuda, javax.swing.GroupLayout.DEFAULT_SIZE, 99, Short.MAX_VALUE))
                            .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE)
                            .addComponent(jSeparator1, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))
                    .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
                        .addGap(59, 59, 59)
                        .addComponent(jBCrearEmpleado)
                        .addGap(64, 64, 64)
                        .addComponent(jBModificarEmpleado)))
                .addGap(31, 31, 31))
            .addGroup(layout.createSequentialGroup()
                .addGap(151, 151, 151)
                .addComponent(jBListadoEmpleados)
                .addContainerGap(160, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jLabel6)
                    .addGroup(layout.createSequentialGroup()
                        .addGap(22, 22, 22)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                            .addComponent(jLabel1)
                            .addComponent(jBAyuda))))
                .addGap(19, 19, 19)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2)
                    .addComponent(jtxtIDE, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(jtxtContraseña, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBGeneraCuenta))
                .addGap(35, 35, 35)
                .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(36, 36, 36)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jBCrearEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jBModificarEmpleado, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addComponent(jBListadoEmpleados, javax.swing.GroupLayout.PREFERRED_SIZE, 32, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(33, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void jBGeneraCuentaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBGeneraCuentaActionPerformed
        // TODO add your handling code here:        
        boolean log;

        log=suc.ComprobarDirector(jtxtIDE.getText(),jtxtContraseña.getText());        
        if(log==true)
        {
            jBCrearEmpleado.setEnabled(true);
            jBModificarEmpleado.setEnabled(true);
            jBListadoEmpleados.setEnabled(true);
        }
        else{
            JOptionPane.showMessageDialog(this,"Login o Contraseña Incorrecta","Error",JOptionPane.ERROR_MESSAGE);
        }

}//GEN-LAST:event_jBGeneraCuentaActionPerformed

    private void jtxtIDEActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jtxtIDEActionPerformed
        // TODO add your handling code here:
}//GEN-LAST:event_jtxtIDEActionPerformed

    private void jBCrearEmpleadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBCrearEmpleadoActionPerformed
// TODO add your handling code here:
        JfrmCrearEmpleado ce=new JfrmCrearEmpleado(suc);
        ce.setLocationRelativeTo(null);
        ce.setVisible(true);
}//GEN-LAST:event_jBCrearEmpleadoActionPerformed

    private void jBModificarEmpleadoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBModificarEmpleadoActionPerformed
        // TODO add your handling code here:
        JfrmModificarEmpleado me=new JfrmModificarEmpleado(suc);
        me.setLocationRelativeTo(null);
        me.setVisible(true);
}//GEN-LAST:event_jBModificarEmpleadoActionPerformed

    private void jBAyudaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBAyudaActionPerformed
        // TODO add your handling code here:
        try
        {
             Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler "+"Manual_de_Usuario_Director.pdf");
        } catch (IOException e) {
            e.printStackTrace();


    }
}//GEN-LAST:event_jBAyudaActionPerformed

    private void jBListadoEmpleadosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jBListadoEmpleadosActionPerformed
        // TODO add your handling code here:
        jFrmListadoEmpleados me=new jFrmListadoEmpleados(suc);
        me.setLocationRelativeTo(null);
        me.setVisible(true);
}//GEN-LAST:event_jBListadoEmpleadosActionPerformed

    

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jBAyuda;
    private javax.swing.JButton jBCrearEmpleado;
    private javax.swing.JButton jBGeneraCuenta;
    private javax.swing.JButton jBListadoEmpleados;
    private javax.swing.JButton jBModificarEmpleado;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JSeparator jSeparator1;
    private javax.swing.JSeparator jSeparator2;
    private javax.swing.JPasswordField jtxtContraseña;
    private javax.swing.JTextField jtxtIDE;
    // End of variables declaration//GEN-END:variables

}
