Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
ProyectoFinal-Bootcamp
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jose Baez
ProyectoFinal-Bootcamp
Commits
a11b3b7a
Commit
a11b3b7a
authored
May 12, 2022
by
Yovan Martinez
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Terminado validacion para evitar ingreso de mismo correo en el mismo bootcamp
parent
27b3f24e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
17 deletions
+21
-17
src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java
+21
-17
No files found.
src/main/java/com/roshka/proyectofinal/Postulante/SaveServlet.java
View file @
a11b3b7a
...
@@ -23,24 +23,25 @@ public class SaveServlet extends HttpServlet {
...
@@ -23,24 +23,25 @@ public class SaveServlet extends HttpServlet {
response
.
setContentType
(
"text/html"
);
response
.
setContentType
(
"text/html"
);
PrintWriter
out
=
response
.
getWriter
();
PrintWriter
out
=
response
.
getWriter
();
boolean
correoRepetido
=
false
;
boolean
rechazarDatos
=
false
;
int
bootcampActual
=
3
;
try
{
try
{
Connection
con
=
DataBase
.
getConnection
();
Connection
con
=
DataBase
.
getConnection
();
//
//
Statement
stmt
=
con
.
createStatement
();
Statement
stmt
=
con
.
createStatement
();
ResultSet
rs
=
stmt
.
executeQuery
(
"SELECT correo
FROM postulante;"
);
ResultSet
rs
=
stmt
.
executeQuery
(
"SELECT correo
,bootcamp_id FROM postulante WHERE postulante.bootcamp_id ="
+
bootcampActual
);
//
//
String
nombre
=
request
.
getParameter
(
"nombre"
);
String
nombre
=
request
.
getParameter
(
"nombre"
);
String
apellido
=
request
.
getParameter
(
"apellido"
);
String
apellido
=
request
.
getParameter
(
"apellido"
);
int
cedula
=
Integer
.
parseInt
(
request
.
getParameter
(
"cedula"
));
int
cedula
=
Integer
.
parseInt
(
request
.
getParameter
(
"cedula"
));
String
correo
=
request
.
getParameter
(
"correo"
);
String
correo
=
request
.
getParameter
(
"correo"
);
//BUCLE PARA VERIFICAR EL CORREO EN EL BOOTCAMP ACTUAL
while
(
rs
.
next
()){
while
(
rs
.
next
()){
String
correoBase
=
rs
.
getString
(
"correo"
);
String
correoBase
=
rs
.
getString
(
"correo"
);
if
(
correo
.
equals
(
correo
)){
int
bootcampIdBase
=
rs
.
getInt
(
"bootcamp_id"
);
correoRepetido
=
true
;
if
(
correo
.
equals
(
correoBase
)
&&
(
bootcampIdBase
==
bootcampActual
)){
rechazarDatos
=
true
;
}
}
}
}
String
telefono
=
request
.
getParameter
(
"telefono"
);
String
telefono
=
request
.
getParameter
(
"telefono"
);
...
@@ -61,10 +62,10 @@ public class SaveServlet extends HttpServlet {
...
@@ -61,10 +62,10 @@ public class SaveServlet extends HttpServlet {
if
(
request
.
getParameter
(
"universidad"
)
!=
null
){
if
(
request
.
getParameter
(
"universidad"
)
!=
null
){
universidad
=
true
;
universidad
=
true
;
}
}
Bootcamp
bootcamp
=
new
Bootcamp
();
if
(!
correoRepetido
){
Postulante
postulante
=
new
Postulante
();
Bootcamp
bootcamp
=
new
Bootcamp
();
//SI LOS DATOS SON CORRECTOS NO SE RECHAZAN ENTONCES CARGA A LA BASE
Postulante
postulante
=
new
Postulante
();
if
(!
rechazarDatos
){
postulante
.
setNombre
(
nombre
);
postulante
.
setNombre
(
nombre
);
postulante
.
setApellido
(
apellido
);
postulante
.
setApellido
(
apellido
);
postulante
.
setNro_cedula
(
cedula
);
postulante
.
setNro_cedula
(
cedula
);
...
@@ -74,21 +75,24 @@ public class SaveServlet extends HttpServlet {
...
@@ -74,21 +75,24 @@ public class SaveServlet extends HttpServlet {
postulante
.
setExpLaboral
(
experienciaLaboral
);
postulante
.
setExpLaboral
(
experienciaLaboral
);
postulante
.
setEstudioUniversitario
(
universidad
);
postulante
.
setEstudioUniversitario
(
universidad
);
postulante
.
setNotebook
(
notebook
);
postulante
.
setNotebook
(
notebook
);
postulante
.
setBootcampId
(
1
);
postulante
.
setBootcampId
(
bootcampActual
);
postulante
.
setAceptado
(
false
);
postulante
.
setAceptado
(
false
);
}
int
status
=
PostulanteDao
.
save
(
postulante
);
int
status
=
PostulanteDao
.
save
(
postulante
);
if
(
status
>
0
){
if
(
status
>
0
){
out
.
print
(
"<p>Record saved successfully!</p>"
);
out
.
print
(
"<p>Record saved successfully!</p>"
);
request
.
getRequestDispatcher
(
"index.html"
).
include
(
request
,
response
);
request
.
getRequestDispatcher
(
"index.html"
).
include
(
request
,
response
);
}
else
{
}
else
{
out
.
println
(
"Sorry! unable to save record"
);
if
(
rechazarDatos
){
out
.
println
(
"El correo ingresado ya esta registrado para el bootcamp actual"
);
}
else
{
out
.
println
(
"Sorry! unable to save record"
);
}
}
}
}
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();}
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
out
.
close
();
out
.
close
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment