Skip to content

Commit

Permalink
tercer avance
Browse files Browse the repository at this point in the history
  • Loading branch information
FaustoCCR committed Sep 28, 2021
2 parents 7e25084 + cf0f219 commit c823169
Show file tree
Hide file tree
Showing 22 changed files with 2,402 additions and 1,785 deletions.
231 changes: 121 additions & 110 deletions nbproject/project.properties
Original file line number Diff line number Diff line change
@@ -1,110 +1,121 @@
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Nexo_gym.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/Nexo_gym
excludes=
<<<<<<< HEAD
file.reference.jcalendar-1.4.jar=C:\\Users\\Usuario\\Downloads\\jcalendar-1.4.jar
=======
file.reference.jcalendar-1.4.jar=C:\\Users\\Usuario\\Documents\\NetBeansProjects\\ExamenFINAL\\src\\Validaciones\\jcalendar-1.4.jar
>>>>>>> 261438f7329b42aa6fee6032ad9269d693ce60b6
file.reference.jcalendar-1.4.jar-1=C:\\Users\\Usuario\\Downloads\\jcalendar-1.4.jar
file.reference.postgresql-9.4.1209.jar=C:\\Users\\Usuario\\Downloads\\postgresql-9.4.1209.jar
includes=**
jar.compress=false
javac.classpath=\
${file.reference.postgresql-9.4.1209.jar}:\
<<<<<<< HEAD:\
${file.reference.jcalendar-1.4.jar-1}
${file.reference.jcalendar-1.4.jar}
=======
${file.reference.jcalendar-1.4.jar}:\
${libs.absolutelayout.classpath}
>>>>>>> 261438f7329b42aa6fee6032ad9269d693ce60b6
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
# The jlink additional root modules to resolve
jlink.additionalmodules=
# The jlink additional command line parameters
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=Nexo_gym
main.class=controlador.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
annotation.processing.enabled=true
annotation.processing.enabled.in.editor=false
annotation.processing.processor.options=
annotation.processing.processors.list=
annotation.processing.run.all.processors=true
annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
build.classes.dir=${build.dir}/classes
build.classes.excludes=**/*.java,**/*.form
# This directory is removed when the project is cleaned:
build.dir=build
build.generated.dir=${build.dir}/generated
build.generated.sources.dir=${build.dir}/generated-sources
# Only compile against the classpath explicitly listed here:
build.sysclasspath=ignore
build.test.classes.dir=${build.dir}/test/classes
build.test.results.dir=${build.dir}/test/results
# Uncomment to specify the preferred debugger connection transport:
#debug.transport=dt_socket
debug.classpath=\
${run.classpath}
debug.modulepath=\
${run.modulepath}
debug.test.classpath=\
${run.test.classpath}
debug.test.modulepath=\
${run.test.modulepath}
# Files in build.classes.dir which should be excluded from distribution jar
dist.archive.excludes=
# This directory is removed when the project is cleaned:
dist.dir=dist
dist.jar=${dist.dir}/Nexo_gym.jar
dist.javadoc.dir=${dist.dir}/javadoc
dist.jlink.dir=${dist.dir}/jlink
dist.jlink.output=${dist.jlink.dir}/Nexo_gym
excludes=
<<<<<<< HEAD
file.reference.jcalendar-1.4.jar=C:\\Users\\Usuario\\Downloads\\jcalendar-1.4.jar
=======
file.reference.jcalendar-1.4.jar=C:\\Users\\Usuario\\Documents\\NetBeansProjects\\ExamenFINAL\\src\\Validaciones\\jcalendar-1.4.jar
>>>>>>> 261438f7329b42aa6fee6032ad9269d693ce60b6
file.reference.jcalendar-1.4.jar-1=C:\\Users\\Usuario\\Downloads\\jcalendar-1.4.jar
file.reference.jcalendar-1.4.jar-2=C:\\Users\\DELL\\Downloads\\jcalendar-1.4.jar
file.reference.postgresql-42.2.5_26bc31adb6d0bfe2e78687d1ad5afae3.jar=C:\\Users\\Casa\\Downloads\\postgresql-42.2.5_26bc31adb6d0bfe2e78687d1ad5afae3.jar
file.reference.postgresql-42.2.5_26bc31adb6d0bfe2e78687d1ad5afae3.jar-1=C:\\Users\\Usuario\\Documents\\TERCER CICLO\\Programa Visual\\Nueva carpeta\\postgresql-42.2.5_26bc31adb6d0bfe2e78687d1ad5afae3.jar
file.reference.postgresql-9.4.1209.jar=C:\\Users\\Usuario\\Documents\\NetBeansProjects\\ExamenFINAL\\src\\Validaciones\\postgresql-9.4.1209.jar
file.reference.postgresql-9.4.1209.jar-1=C:\\Users\\Usuario\\Downloads\\postgresql-9.4.1209.jar
file.reference.postgresql-9.4.1212.jar=C:\\Users\\DELL\\Downloads\\postgresql-9.4.1212.jar
includes=**
jar.compress=false
javac.classpath=\
<<<<<<< HEAD:\
${file.reference.jcalendar-1.4.jar-1}:\
${file.reference.postgresql-42.2.5_26bc31adb6d0bfe2e78687d1ad5afae3.jar}:\
${file.reference.postgresql-9.4.1209.jar}:\
${file.reference.postgresql-42.2.5_26bc31adb6d0bfe2e78687d1ad5afae3.jar-1}:\
${file.reference.jcalendar-1.4.jar-2}:\
${file.reference.postgresql-9.4.1212.jar}:\
${libs.absolutelayout.classpath}:\
${file.reference.postgresql-9.4.1209.jar-1}
${file.reference.jcalendar-1.4.jar}
=======
${file.reference.jcalendar-1.4.jar}:\
${libs.absolutelayout.classpath}
>>>>>>> 261438f7329b42aa6fee6032ad9269d693ce60b6
# Space-separated list of extra javac options
javac.compilerargs=
javac.deprecation=false
javac.external.vm=true
javac.modulepath=
javac.processormodulepath=
javac.processorpath=\
${javac.classpath}
javac.source=1.8
javac.target=1.8
javac.test.classpath=\
${javac.classpath}:\
${build.classes.dir}
javac.test.modulepath=\
${javac.modulepath}
javac.test.processorpath=\
${javac.test.classpath}
javadoc.additionalparam=
javadoc.author=false
javadoc.encoding=${source.encoding}
javadoc.html5=false
javadoc.noindex=false
javadoc.nonavbar=false
javadoc.notree=false
javadoc.private=false
javadoc.splitindex=true
javadoc.use=true
javadoc.version=false
javadoc.windowtitle=
# The jlink additional root modules to resolve
jlink.additionalmodules=
# The jlink additional command line parameters
jlink.additionalparam=
jlink.launcher=true
jlink.launcher.name=Nexo_gym
main.class=controlador.Main
manifest.file=manifest.mf
meta.inf.dir=${src.dir}/META-INF
mkdist.disabled=false
platform.active=default_platform
run.classpath=\
${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project.
# You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
# To set system properties for unit tests define test-sys-prop.name=value:
run.jvmargs=
run.modulepath=\
${javac.modulepath}
run.test.classpath=\
${javac.test.classpath}:\
${build.test.classes.dir}
run.test.modulepath=\
${javac.test.modulepath}
source.encoding=UTF-8
src.dir=src
test.src.dir=test
127 changes: 127 additions & 0 deletions src/controlador/ControlRegistrar_Empleado.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@

package controlador;

import java.awt.Color;
import java.awt.event.KeyAdapter;
import java.awt.event.KeyEvent;
import java.sql.Date;
import java.time.Instant;
import java.time.ZoneId;
import java.time.ZonedDateTime;
import java.util.List;
import java.util.function.Predicate;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.border.LineBorder;
import modelo.dao.CargoDao;
import modelo.dao.EmpleadoDao;
import modelo.dao.PersonaDao;
import modelo.vo.EmpleadoVo;
import modelo.vo.PersonaVo;
import vista.VistaRegistrar_Empleado;

/**
*
* @author Alex
*/

public class ControlRegistrar_Empleado {
private EmpleadoDao modelo;
private VistaRegistrar_Empleado vista;
private PersonaDao modelo_persona = new PersonaDao();
private CargoDao modelo_cargo = new CargoDao();
public ControlRegistrar_Empleado(EmpleadoDao modelo, VistaRegistrar_Empleado vista) {
this.modelo = modelo;
this.vista = vista;
vista.setVisible(true);
vista.setTitle("Registro de Empleados - Nexo Gym");
vista.setResizable(false);
vista.setLocationRelativeTo(null);
vista.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
//buscarPersona(vista.getTxtCedula().getText());
//verificarCargo();
cargarCargo();

}

public void funcionalidad(){

vista.getBtnRegistrarE().addActionListener(l->crearEmpleado());

}

private boolean verificarPersona(String cedula) {
boolean busqueda;
Predicate<PersonaVo> cedula_p = p -> p.getDni().equals(cedula);
busqueda = modelo_persona.mostrarDatos().stream().anyMatch(cedula_p);
if (busqueda == true) {
System.out.println("Cedula Correcta");
vista.getTxtCedula().setBorder(new LineBorder(Color.decode("#6CC01B"), 2));
modelo_persona.mostrarDatos().stream().filter(cedula_p).forEach((t) -> {
vista.getTxtPersona().setText(t.getNombre() + " " + t.getApellido());

});
} else {
System.out.println("Cedula Incorrecta");
vista.getTxtCedula().setBorder(new LineBorder(Color.decode("#C33529"), 2));
vista.getTxtCedula().setText("");
}
return busqueda;
}


private void cargarCargo() {
modelo_cargo.mostrarDatos().stream().forEach((m) -> {
vista.getCb_cargo().addItem(m.getNombre());
//vista.getCb_cargo().addItem(m.getId_cargo()+"");
});

}

private int VerificarCedula( String cedula){
int id_persona=modelo_persona.mostrarDatos().stream().filter(persona ->persona.getDni().equals(cedula)).findAny().get().getId_persona();
return id_persona;
}

private void crearEmpleado() {

boolean busqueda = verificarPersona(vista.getTxtCedula().getText());
if (busqueda) {

List<EmpleadoVo> lista = modelo.mostrarDatos();

int idpersona=VerificarCedula(vista.getTxtCedula().getText());
int id_cargo=modelo_cargo.mostrarDatos().get(vista.getCb_cargo().getSelectedIndex()).getId_cargo();
Instant instant= vista.getFechaContrato().getDate().toInstant();
ZoneId zid= ZoneId.of("America/Guayaquil");
ZonedDateTime zdt=ZonedDateTime.ofInstant(instant, zid);
Date fecha = Date.valueOf(zdt.toLocalDate());
System.out.println("fecha"+ fecha);
Double sueldo = Double.valueOf(vista.getTxtSueldo().getText());
System.out.println("Sueldo"+ sueldo);



try {
EmpleadoDao emp = new EmpleadoDao();
emp.setId_persona(idpersona);
emp.setId_cargo(id_cargo);
emp.setFecha_contrato(fecha);
emp.setSueldo(sueldo);

if (emp.grabar()) {
System.out.println("graba");
JOptionPane.showMessageDialog(vista, "Empleado creado");
} else {
JOptionPane.showMessageDialog(vista, "error");
}
} catch ( NumberFormatException ex ) {
System.out.println("Datos Vacios "+ ex);

}
}else{
System.out.println("Persona no esta registrada");
}
}

}
Loading

0 comments on commit c823169

Please sign in to comment.