├── .idea ├── .name ├── .gitignore ├── vcs.xml ├── libraries │ ├── c3p0_0_9_5_4.xml │ └── jcalendar_1_4.xml ├── misc.xml ├── modules.xml └── uiDesigner.xml ├── .settings ├── org.eclipse.core.resources.prefs ├── org.eclipse.ltk.core.refactoring.prefs └── org.eclipse.jdt.core.prefs ├── bin ├── imagenes │ ├── hotel.png │ ├── login.png │ ├── lupa2.png │ ├── Ha-100px.png │ ├── aH-150px.png │ ├── aH-40px.png │ ├── busqueda.png │ ├── cancelar.png │ ├── deletar.png │ ├── disquete.png │ ├── login2.png │ ├── lupa-1.png │ ├── menu-img.png │ ├── persona.png │ ├── pessoas.png │ ├── registro.png │ ├── reservas.png │ ├── calendario.png │ ├── lOGO-50PX.png │ ├── reservado.png │ ├── cerrar-24px.png │ ├── editar-texto.png │ ├── icon-buscar.png │ ├── icon-reservas.png │ ├── reservas-img-3.png │ ├── img-hotel-login-.png │ ├── perfil-del-usuario.png │ ├── cerrar-sesion 32-px.png │ └── papelera-de-reciclaje.png ├── views │ ├── Busca.class │ ├── Exito.class │ ├── Login.class │ ├── Busca$1.class │ ├── Busca$2.class │ ├── Busca$3.class │ ├── Busca$4.class │ ├── Busca$5.class │ ├── Busca$6.class │ ├── Busca$7.class │ ├── Busca$8.class │ ├── Busqueda.class │ ├── Exito$1.class │ ├── Login$1.class │ ├── Login$2.class │ ├── Login$3.class │ ├── Login$4.class │ ├── Login$5.class │ ├── Login$6.class │ ├── Login$7.class │ ├── Sucesso$1.class │ ├── Sucesso.class │ ├── Busqueda$1.class │ ├── Busqueda$2.class │ ├── Busqueda$3.class │ ├── Busqueda$4.class │ ├── Busqueda$5.class │ ├── Busqueda$6.class │ ├── Busqueda$7.class │ ├── Busqueda$8.class │ ├── MenuUsuario.class │ ├── MenuPrincipal.class │ ├── MenuUsuario$1.class │ ├── MenuUsuario$2.class │ ├── MenuUsuario$3.class │ ├── MenuUsuario$4.class │ ├── MenuUsuario$5.class │ ├── MenuUsuario$6.class │ ├── ReservasView$1.class │ ├── ReservasView$2.class │ ├── ReservasView$3.class │ ├── ReservasView$4.class │ ├── ReservasView$5.class │ ├── ReservasView$6.class │ ├── ReservasView$7.class │ ├── ReservasView.class │ ├── MenuPrincipal$1.class │ ├── MenuPrincipal$2.class │ ├── MenuPrincipal$3.class │ ├── MenuPrincipal$4.class │ ├── MenuPrincipal$5.class │ ├── RegistroHospede.class │ ├── RegistroHuesped.class │ ├── RegistroHospede$1.class │ ├── RegistroHospede$2.class │ ├── RegistroHospede$3.class │ ├── RegistroHospede$4.class │ ├── RegistroHuesped$1.class │ ├── RegistroHuesped$2.class │ ├── RegistroHuesped$3.class │ └── RegistroHuesped$4.class ├── jdbc │ ├── dao │ │ ├── HospedesDAO.class │ │ ├── ReservaDAO.class │ │ └── HuespedesDAO.class │ ├── modelo │ │ ├── Hospedes.class │ │ ├── Reserva.class │ │ └── Huespedes.class │ └── controller │ │ ├── HospedesController.class │ │ ├── HuespedesController.class │ │ └── ReservasController.class └── jdb │ └── factory │ ├── TestaConexao.class │ └── ConnectionFactory.class ├── src ├── imagenes │ ├── hotel.png │ ├── login.png │ ├── lupa2.png │ ├── Ha-100px.png │ ├── aH-150px.png │ ├── aH-40px.png │ ├── busqueda.png │ ├── cancelar.png │ ├── deletar.png │ ├── disquete.png │ ├── login2.png │ ├── lupa-1.png │ ├── menu-img.png │ ├── persona.png │ ├── pessoas.png │ ├── registro.png │ ├── reservas.png │ ├── calendario.png │ ├── lOGO-50PX.png │ ├── reservado.png │ ├── cerrar-24px.png │ ├── editar-texto.png │ ├── icon-buscar.png │ ├── icon-reservas.png │ ├── reservas-img-3.png │ ├── img-hotel-login-.png │ ├── perfil-del-usuario.png │ ├── cerrar-sesion 32-px.png │ └── papelera-de-reciclaje.png ├── jdb │ └── factory │ │ ├── TestaConexao.java │ │ └── ConnectionFactory.java ├── jdbc │ ├── controller │ │ ├── ReservasController.java │ │ └── HospedesController.java │ ├── modelo │ │ ├── Reserva.java │ │ └── Hospedes.java │ └── dao │ │ ├── ReservaDAO.java │ │ └── HospedesDAO.java └── views │ ├── Sucesso.java │ ├── MenuPrincipal.java │ ├── Login.java │ ├── MenuUsuario.java │ ├── ReservasView.java │ ├── RegistroHospede.java │ └── Busca.java ├── .project ├── .classpath ├── AluraHotel-Esp.iml └── README.md /.idea/.name: -------------------------------------------------------------------------------- 1 | AluraHotel-Esp -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.settings/org.eclipse.core.resources.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | encoding/=UTF-8 3 | -------------------------------------------------------------------------------- /bin/imagenes/hotel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/hotel.png -------------------------------------------------------------------------------- /bin/imagenes/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/login.png -------------------------------------------------------------------------------- /bin/imagenes/lupa2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/lupa2.png -------------------------------------------------------------------------------- /bin/views/Busca.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busca.class -------------------------------------------------------------------------------- /bin/views/Exito.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Exito.class -------------------------------------------------------------------------------- /bin/views/Login.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Login.class -------------------------------------------------------------------------------- /src/imagenes/hotel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/hotel.png -------------------------------------------------------------------------------- /src/imagenes/login.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/login.png -------------------------------------------------------------------------------- /src/imagenes/lupa2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/lupa2.png -------------------------------------------------------------------------------- /bin/imagenes/Ha-100px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/Ha-100px.png -------------------------------------------------------------------------------- /bin/imagenes/aH-150px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/aH-150px.png -------------------------------------------------------------------------------- /bin/imagenes/aH-40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/aH-40px.png -------------------------------------------------------------------------------- /bin/imagenes/busqueda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/busqueda.png -------------------------------------------------------------------------------- /bin/imagenes/cancelar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/cancelar.png -------------------------------------------------------------------------------- /bin/imagenes/deletar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/deletar.png -------------------------------------------------------------------------------- /bin/imagenes/disquete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/disquete.png -------------------------------------------------------------------------------- /bin/imagenes/login2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/login2.png -------------------------------------------------------------------------------- /bin/imagenes/lupa-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/lupa-1.png -------------------------------------------------------------------------------- /bin/imagenes/menu-img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/menu-img.png -------------------------------------------------------------------------------- /bin/imagenes/persona.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/persona.png -------------------------------------------------------------------------------- /bin/imagenes/pessoas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/pessoas.png -------------------------------------------------------------------------------- /bin/imagenes/registro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/registro.png -------------------------------------------------------------------------------- /bin/imagenes/reservas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/reservas.png -------------------------------------------------------------------------------- /bin/views/Busca$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busca$1.class -------------------------------------------------------------------------------- /bin/views/Busca$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busca$2.class -------------------------------------------------------------------------------- /bin/views/Busca$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busca$3.class -------------------------------------------------------------------------------- /bin/views/Busca$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busca$4.class -------------------------------------------------------------------------------- /bin/views/Busca$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busca$5.class -------------------------------------------------------------------------------- /bin/views/Busca$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busca$6.class -------------------------------------------------------------------------------- /bin/views/Busca$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busca$7.class -------------------------------------------------------------------------------- /bin/views/Busca$8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busca$8.class -------------------------------------------------------------------------------- /bin/views/Busqueda.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busqueda.class -------------------------------------------------------------------------------- /bin/views/Exito$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Exito$1.class -------------------------------------------------------------------------------- /bin/views/Login$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Login$1.class -------------------------------------------------------------------------------- /bin/views/Login$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Login$2.class -------------------------------------------------------------------------------- /bin/views/Login$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Login$3.class -------------------------------------------------------------------------------- /bin/views/Login$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Login$4.class -------------------------------------------------------------------------------- /bin/views/Login$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Login$5.class -------------------------------------------------------------------------------- /bin/views/Login$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Login$6.class -------------------------------------------------------------------------------- /bin/views/Login$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Login$7.class -------------------------------------------------------------------------------- /bin/views/Sucesso$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Sucesso$1.class -------------------------------------------------------------------------------- /bin/views/Sucesso.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Sucesso.class -------------------------------------------------------------------------------- /src/imagenes/Ha-100px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/Ha-100px.png -------------------------------------------------------------------------------- /src/imagenes/aH-150px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/aH-150px.png -------------------------------------------------------------------------------- /src/imagenes/aH-40px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/aH-40px.png -------------------------------------------------------------------------------- /src/imagenes/busqueda.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/busqueda.png -------------------------------------------------------------------------------- /src/imagenes/cancelar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/cancelar.png -------------------------------------------------------------------------------- /src/imagenes/deletar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/deletar.png -------------------------------------------------------------------------------- /src/imagenes/disquete.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/disquete.png -------------------------------------------------------------------------------- /src/imagenes/login2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/login2.png -------------------------------------------------------------------------------- /src/imagenes/lupa-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/lupa-1.png -------------------------------------------------------------------------------- /src/imagenes/menu-img.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/menu-img.png -------------------------------------------------------------------------------- /src/imagenes/persona.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/persona.png -------------------------------------------------------------------------------- /src/imagenes/pessoas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/pessoas.png -------------------------------------------------------------------------------- /src/imagenes/registro.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/registro.png -------------------------------------------------------------------------------- /src/imagenes/reservas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/reservas.png -------------------------------------------------------------------------------- /bin/imagenes/calendario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/calendario.png -------------------------------------------------------------------------------- /bin/imagenes/lOGO-50PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/lOGO-50PX.png -------------------------------------------------------------------------------- /bin/imagenes/reservado.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/reservado.png -------------------------------------------------------------------------------- /bin/views/Busqueda$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busqueda$1.class -------------------------------------------------------------------------------- /bin/views/Busqueda$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busqueda$2.class -------------------------------------------------------------------------------- /bin/views/Busqueda$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busqueda$3.class -------------------------------------------------------------------------------- /bin/views/Busqueda$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busqueda$4.class -------------------------------------------------------------------------------- /bin/views/Busqueda$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busqueda$5.class -------------------------------------------------------------------------------- /bin/views/Busqueda$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busqueda$6.class -------------------------------------------------------------------------------- /bin/views/Busqueda$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busqueda$7.class -------------------------------------------------------------------------------- /bin/views/Busqueda$8.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/Busqueda$8.class -------------------------------------------------------------------------------- /bin/views/MenuUsuario.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuUsuario.class -------------------------------------------------------------------------------- /src/imagenes/calendario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/calendario.png -------------------------------------------------------------------------------- /src/imagenes/lOGO-50PX.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/lOGO-50PX.png -------------------------------------------------------------------------------- /src/imagenes/reservado.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/reservado.png -------------------------------------------------------------------------------- /bin/imagenes/cerrar-24px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/cerrar-24px.png -------------------------------------------------------------------------------- /bin/imagenes/editar-texto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/editar-texto.png -------------------------------------------------------------------------------- /bin/imagenes/icon-buscar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/icon-buscar.png -------------------------------------------------------------------------------- /bin/imagenes/icon-reservas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/icon-reservas.png -------------------------------------------------------------------------------- /bin/jdbc/dao/HospedesDAO.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdbc/dao/HospedesDAO.class -------------------------------------------------------------------------------- /bin/jdbc/dao/ReservaDAO.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdbc/dao/ReservaDAO.class -------------------------------------------------------------------------------- /bin/jdbc/modelo/Hospedes.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdbc/modelo/Hospedes.class -------------------------------------------------------------------------------- /bin/jdbc/modelo/Reserva.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdbc/modelo/Reserva.class -------------------------------------------------------------------------------- /bin/views/MenuPrincipal.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuPrincipal.class -------------------------------------------------------------------------------- /bin/views/MenuUsuario$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuUsuario$1.class -------------------------------------------------------------------------------- /bin/views/MenuUsuario$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuUsuario$2.class -------------------------------------------------------------------------------- /bin/views/MenuUsuario$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuUsuario$3.class -------------------------------------------------------------------------------- /bin/views/MenuUsuario$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuUsuario$4.class -------------------------------------------------------------------------------- /bin/views/MenuUsuario$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuUsuario$5.class -------------------------------------------------------------------------------- /bin/views/MenuUsuario$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuUsuario$6.class -------------------------------------------------------------------------------- /bin/views/ReservasView$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/ReservasView$1.class -------------------------------------------------------------------------------- /bin/views/ReservasView$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/ReservasView$2.class -------------------------------------------------------------------------------- /bin/views/ReservasView$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/ReservasView$3.class -------------------------------------------------------------------------------- /bin/views/ReservasView$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/ReservasView$4.class -------------------------------------------------------------------------------- /bin/views/ReservasView$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/ReservasView$5.class -------------------------------------------------------------------------------- /bin/views/ReservasView$6.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/ReservasView$6.class -------------------------------------------------------------------------------- /bin/views/ReservasView$7.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/ReservasView$7.class -------------------------------------------------------------------------------- /bin/views/ReservasView.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/ReservasView.class -------------------------------------------------------------------------------- /src/imagenes/cerrar-24px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/cerrar-24px.png -------------------------------------------------------------------------------- /src/imagenes/editar-texto.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/editar-texto.png -------------------------------------------------------------------------------- /src/imagenes/icon-buscar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/icon-buscar.png -------------------------------------------------------------------------------- /src/imagenes/icon-reservas.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/icon-reservas.png -------------------------------------------------------------------------------- /bin/imagenes/reservas-img-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/reservas-img-3.png -------------------------------------------------------------------------------- /bin/jdbc/dao/HuespedesDAO.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdbc/dao/HuespedesDAO.class -------------------------------------------------------------------------------- /bin/jdbc/modelo/Huespedes.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdbc/modelo/Huespedes.class -------------------------------------------------------------------------------- /bin/views/MenuPrincipal$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuPrincipal$1.class -------------------------------------------------------------------------------- /bin/views/MenuPrincipal$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuPrincipal$2.class -------------------------------------------------------------------------------- /bin/views/MenuPrincipal$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuPrincipal$3.class -------------------------------------------------------------------------------- /bin/views/MenuPrincipal$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuPrincipal$4.class -------------------------------------------------------------------------------- /bin/views/MenuPrincipal$5.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/MenuPrincipal$5.class -------------------------------------------------------------------------------- /bin/views/RegistroHospede.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHospede.class -------------------------------------------------------------------------------- /bin/views/RegistroHuesped.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHuesped.class -------------------------------------------------------------------------------- /src/imagenes/reservas-img-3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/reservas-img-3.png -------------------------------------------------------------------------------- /bin/imagenes/img-hotel-login-.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/img-hotel-login-.png -------------------------------------------------------------------------------- /bin/imagenes/perfil-del-usuario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/perfil-del-usuario.png -------------------------------------------------------------------------------- /bin/jdb/factory/TestaConexao.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdb/factory/TestaConexao.class -------------------------------------------------------------------------------- /bin/views/RegistroHospede$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHospede$1.class -------------------------------------------------------------------------------- /bin/views/RegistroHospede$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHospede$2.class -------------------------------------------------------------------------------- /bin/views/RegistroHospede$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHospede$3.class -------------------------------------------------------------------------------- /bin/views/RegistroHospede$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHospede$4.class -------------------------------------------------------------------------------- /bin/views/RegistroHuesped$1.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHuesped$1.class -------------------------------------------------------------------------------- /bin/views/RegistroHuesped$2.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHuesped$2.class -------------------------------------------------------------------------------- /bin/views/RegistroHuesped$3.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHuesped$3.class -------------------------------------------------------------------------------- /bin/views/RegistroHuesped$4.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/views/RegistroHuesped$4.class -------------------------------------------------------------------------------- /src/imagenes/img-hotel-login-.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/img-hotel-login-.png -------------------------------------------------------------------------------- /src/imagenes/perfil-del-usuario.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/perfil-del-usuario.png -------------------------------------------------------------------------------- /bin/imagenes/cerrar-sesion 32-px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/cerrar-sesion 32-px.png -------------------------------------------------------------------------------- /src/imagenes/cerrar-sesion 32-px.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/cerrar-sesion 32-px.png -------------------------------------------------------------------------------- /bin/imagenes/papelera-de-reciclaje.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/imagenes/papelera-de-reciclaje.png -------------------------------------------------------------------------------- /bin/jdb/factory/ConnectionFactory.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdb/factory/ConnectionFactory.class -------------------------------------------------------------------------------- /src/imagenes/papelera-de-reciclaje.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/src/imagenes/papelera-de-reciclaje.png -------------------------------------------------------------------------------- /.settings/org.eclipse.ltk.core.refactoring.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.ltk.core.refactoring.enable.project.refactoring.history=false 3 | -------------------------------------------------------------------------------- /bin/jdbc/controller/HospedesController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdbc/controller/HospedesController.class -------------------------------------------------------------------------------- /bin/jdbc/controller/HuespedesController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdbc/controller/HuespedesController.class -------------------------------------------------------------------------------- /bin/jdbc/controller/ReservasController.class: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Alquimistas-AluraLatam/PT-hotel-alura/HEAD/bin/jdbc/controller/ReservasController.class -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/libraries/c3p0_0_9_5_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/libraries/jcalendar_1_4.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | AluraHotel-Esp 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.jdt.core.javabuilder 10 | 11 | 12 | 13 | 14 | 15 | org.eclipse.jdt.core.javanature 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/jdb/factory/TestaConexao.java: -------------------------------------------------------------------------------- 1 | package jdb.factory; 2 | import java.sql.Connection; 3 | import java.sql.SQLException; 4 | 5 | public class TestaConexao { 6 | 7 | public static void main(String[] args) throws SQLException { 8 | 9 | ConnectionFactory connectionFactory = new ConnectionFactory(); 10 | Connection connection = connectionFactory.recuperarConexao(); 11 | 12 | System.out.println("Fechando conexão!!"); 13 | 14 | connection.close(); 15 | } 16 | 17 | } 18 | -------------------------------------------------------------------------------- /.classpath: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /src/jdb/factory/ConnectionFactory.java: -------------------------------------------------------------------------------- 1 | package jdb.factory; 2 | 3 | import java.sql.Connection; 4 | import java.sql.SQLException; 5 | 6 | import javax.sql.DataSource; 7 | 8 | import com.mchange.v2.c3p0.ComboPooledDataSource; 9 | 10 | public class ConnectionFactory { 11 | 12 | public DataSource dataSource; 13 | 14 | public ConnectionFactory() { 15 | ComboPooledDataSource comboPooledDataSource = new ComboPooledDataSource(); 16 | comboPooledDataSource.setJdbcUrl("jdbc:mysql://localhost/hotelalura?useTimezone=true&serverTimezone=UTC"); 17 | comboPooledDataSource.setUser("root"); 18 | comboPooledDataSource.setPassword("12345"); 19 | 20 | this.dataSource = comboPooledDataSource; 21 | } 22 | 23 | public Connection recuperarConexao() { 24 | try { 25 | return this.dataSource.getConnection(); 26 | } catch (SQLException e) { 27 | throw new RuntimeException(e); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /.settings/org.eclipse.jdt.core.prefs: -------------------------------------------------------------------------------- 1 | eclipse.preferences.version=1 2 | org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled 3 | org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate 4 | org.eclipse.jdt.core.compiler.codegen.targetPlatform=9 5 | org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve 6 | org.eclipse.jdt.core.compiler.compliance=9 7 | org.eclipse.jdt.core.compiler.debug.lineNumber=generate 8 | org.eclipse.jdt.core.compiler.debug.localVariable=generate 9 | org.eclipse.jdt.core.compiler.debug.sourceFile=generate 10 | org.eclipse.jdt.core.compiler.problem.assertIdentifier=error 11 | org.eclipse.jdt.core.compiler.problem.enablePreviewFeatures=disabled 12 | org.eclipse.jdt.core.compiler.problem.enumIdentifier=error 13 | org.eclipse.jdt.core.compiler.problem.reportPreviewFeatures=warning 14 | org.eclipse.jdt.core.compiler.release=disabled 15 | org.eclipse.jdt.core.compiler.source=9 16 | -------------------------------------------------------------------------------- /src/jdbc/controller/ReservasController.java: -------------------------------------------------------------------------------- 1 | package jdbc.controller; 2 | 3 | import java.sql.Connection; 4 | import java.sql.Date; 5 | import java.util.List; 6 | import jdb.factory.ConnectionFactory; 7 | import jdbc.dao.ReservaDAO; 8 | import jdbc.modelo.Reserva; 9 | 10 | public class ReservasController { 11 | private ReservaDAO reservaDAO; 12 | 13 | public ReservasController() { 14 | Connection connection = new ConnectionFactory().recuperarConexao(); 15 | this.reservaDAO = new ReservaDAO(connection); 16 | } 17 | 18 | public void salvar(Reserva reserva) { 19 | this.reservaDAO.salvar(reserva); 20 | } 21 | 22 | public List buscar() { 23 | return this.reservaDAO.buscar(); 24 | } 25 | 26 | public List buscarId(String id) { 27 | return this.reservaDAO.buscarId(id); 28 | } 29 | 30 | public void atualizar(Date dataEntrada, Date dataSaida, String valor, String formaPagamento, Integer id) { 31 | this.reservaDAO.atualizar(dataEntrada, dataSaida, valor, formaPagamento, id); 32 | } 33 | 34 | public void deletar(Integer id) { 35 | this.reservaDAO.deletar(id); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /src/jdbc/controller/HospedesController.java: -------------------------------------------------------------------------------- 1 | package jdbc.controller; 2 | import java.sql.Connection; 3 | import java.sql.Date; 4 | import java.util.List; 5 | 6 | import jdb.factory.ConnectionFactory; 7 | import jdbc.dao.HospedesDAO; 8 | import jdbc.modelo.Hospedes; 9 | 10 | 11 | public class HospedesController { 12 | private HospedesDAO hospedesDAO; 13 | 14 | public HospedesController() { 15 | Connection connection = new ConnectionFactory().recuperarConexao(); 16 | this.hospedesDAO = new HospedesDAO(connection); 17 | } 18 | 19 | public void salvar(Hospedes hospedes) { 20 | this.hospedesDAO.salvar(hospedes); 21 | } 22 | public List listarHospedes() { 23 | return this.hospedesDAO.listarHospedes(); 24 | } 25 | 26 | public List listarHospedesId(String id) { 27 | return this.hospedesDAO.buscarId(id); 28 | } 29 | 30 | public void atualizar(String nome, String sobrenome, Date dataNascimento, String nacionalidade, String telefone, Integer idReserva, Integer id) { 31 | this.hospedesDAO.atualizar(nome, sobrenome, dataNascimento, nacionalidade, telefone, idReserva, id); 32 | } 33 | public void deletar(Integer id) { 34 | this.hospedesDAO.deletar(id); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /src/jdbc/modelo/Reserva.java: -------------------------------------------------------------------------------- 1 | package jdbc.modelo; 2 | 3 | import java.sql.Date; 4 | 5 | public class Reserva { 6 | 7 | private Integer id; 8 | private Date dataEntrada; 9 | private Date dataSaida; 10 | private String valor; 11 | private String formaPagamento; 12 | 13 | public Reserva(Date dataEntrada, Date dataSaida, String valor, String formaPagamento) { 14 | super(); 15 | this.dataEntrada = dataEntrada; 16 | this.dataSaida = dataSaida; 17 | this.valor = valor; 18 | this.formaPagamento = formaPagamento; 19 | } 20 | 21 | public Reserva(Integer id, Date dataEntrada, Date dataSaida, String valor, String formaPagamento) { 22 | this.id = id; 23 | this.dataEntrada = dataEntrada; 24 | this.dataSaida = dataSaida; 25 | this.valor = valor; 26 | this.formaPagamento = formaPagamento; 27 | } 28 | 29 | public Integer getId() { 30 | return id; 31 | } 32 | 33 | public void setId(Integer id) { 34 | this.id = id; 35 | } 36 | 37 | public Date getDataEntrada() { 38 | return dataEntrada; 39 | } 40 | 41 | public Date getDataSaida() { 42 | return dataSaida; 43 | } 44 | 45 | public String getValor() { 46 | return valor; 47 | } 48 | 49 | public String getFormaPagamento() { 50 | return formaPagamento; 51 | } 52 | 53 | 54 | // @Override 55 | // public String toString() { 56 | // // TODO Auto-generated method stub 57 | // return String.format("La reserva generada fue: %d, %s, %s, %s, %s", this.id, this.fechaE, this.fechaS, this.valor, this.formaPago); 58 | // } 59 | // 60 | 61 | 62 | } 63 | 64 | -------------------------------------------------------------------------------- /src/jdbc/modelo/Hospedes.java: -------------------------------------------------------------------------------- 1 | package jdbc.modelo; 2 | 3 | import java.sql.Date; 4 | 5 | public class Hospedes { 6 | private Integer Id; 7 | private String nome; 8 | private String sobrenome; 9 | private Date dataNascimento; 10 | private String nacionalidade; 11 | private String telefone; 12 | private Integer idReserva; 13 | 14 | public Hospedes(String nome, String sobrenome, Date dataNascimento, String nacionalidade, String telefone, 15 | Integer idReserva) { 16 | super(); 17 | this.nome = nome; 18 | this.sobrenome = sobrenome; 19 | this.dataNascimento = dataNascimento; 20 | this.nacionalidade = nacionalidade; 21 | this.telefone = telefone; 22 | this.idReserva = idReserva; 23 | } 24 | 25 | public Hospedes(Integer id, String nome, String sobrenome, Date dataNascimento, String nacionalidade, 26 | String telefone, Integer idReserva) { 27 | super(); 28 | Id = id; 29 | this.nome = nome; 30 | this.sobrenome = sobrenome; 31 | this.dataNascimento = dataNascimento; 32 | this.nacionalidade = nacionalidade; 33 | this.telefone = telefone; 34 | this.idReserva = idReserva; 35 | } 36 | 37 | 38 | public Integer getId() { 39 | return Id; 40 | } 41 | 42 | public void setId(Integer id) { 43 | Id = id; 44 | } 45 | 46 | 47 | public String getNome() { 48 | return nome; 49 | } 50 | 51 | public void setNome(String nome) { 52 | this.nome = nome; 53 | } 54 | 55 | public String getSobrenome() { 56 | return sobrenome; 57 | } 58 | 59 | public void setSobrenome(String sobrenome) { 60 | this.sobrenome = sobrenome; 61 | } 62 | 63 | public String getNacionalidade() { 64 | return nacionalidade; 65 | } 66 | 67 | public void setNacionalidade(String nacionalidade) { 68 | this.nacionalidade = nacionalidade; 69 | } 70 | 71 | public Date getDataNascimento() { 72 | return dataNascimento; 73 | } 74 | 75 | public void setDataNascimento(Date dataNascimento) { 76 | this.dataNascimento = dataNascimento; 77 | } 78 | 79 | public String getTelefone() { 80 | return telefone; 81 | } 82 | 83 | public void setTelefone(String telefone) { 84 | this.telefone = telefone; 85 | } 86 | 87 | public Integer getIdReserva() { 88 | return idReserva; 89 | } 90 | 91 | public void setIdReserva(Integer idReserva) { 92 | this.idReserva = idReserva; 93 | } 94 | 95 | } 96 | -------------------------------------------------------------------------------- /AluraHotel-Esp.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | -------------------------------------------------------------------------------- /src/views/Sucesso.java: -------------------------------------------------------------------------------- 1 | package views; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.FlowLayout; 5 | 6 | import javax.swing.JButton; 7 | import javax.swing.JDialog; 8 | import javax.swing.JPanel; 9 | import javax.swing.border.EmptyBorder; 10 | import javax.swing.JLabel; 11 | import javax.swing.ImageIcon; 12 | import java.awt.Color; 13 | import java.awt.Font; 14 | import java.awt.event.ActionListener; 15 | import java.awt.event.ActionEvent; 16 | import java.awt.SystemColor; 17 | import java.awt.Toolkit; 18 | 19 | @SuppressWarnings("serial") 20 | public class Sucesso extends JDialog { 21 | 22 | private final JPanel contentPanel = new JPanel(); 23 | 24 | /** 25 | * Launch the application. 26 | */ 27 | public static void main(String[] args) { 28 | try { 29 | Sucesso dialog = new Sucesso(); 30 | dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); 31 | dialog.setVisible(true); 32 | } catch (Exception e) { 33 | e.printStackTrace(); 34 | } 35 | } 36 | 37 | /** 38 | * Create the dialog. 39 | */ 40 | public Sucesso() { 41 | setIconImage(Toolkit.getDefaultToolkit().getImage(Sucesso.class.getResource("/imagenes/aH-40px.png"))); 42 | setBounds(100, 100, 394, 226); 43 | getContentPane().setLayout(new BorderLayout()); 44 | contentPanel.setBackground(SystemColor.control); 45 | contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5)); 46 | getContentPane().add(contentPanel, BorderLayout.CENTER); 47 | setLocationRelativeTo(null); 48 | contentPanel.setLayout(null); 49 | { 50 | JLabel lblNewLabel = new JLabel(""); 51 | lblNewLabel.setIcon(new ImageIcon(Sucesso.class.getResource("/imagenes/Ha-100px.png"))); 52 | lblNewLabel.setBounds(123, 11, 100, 100); 53 | contentPanel.add(lblNewLabel); 54 | } 55 | { 56 | JLabel lblNewLabel_1 = new JLabel("Registro adicionado com sucesso"); 57 | lblNewLabel_1.setForeground(new Color (12, 138, 199)); 58 | lblNewLabel_1.setFont(new Font("Arial", Font.BOLD, 18)); 59 | lblNewLabel_1.setBounds(27, 122, 322, 21); 60 | contentPanel.add(lblNewLabel_1); 61 | } 62 | { 63 | JPanel buttonPane = new JPanel(); 64 | buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT)); 65 | getContentPane().add(buttonPane, BorderLayout.SOUTH); 66 | { 67 | JButton okButton = new JButton("OK"); 68 | okButton.addActionListener(new ActionListener() { 69 | public void actionPerformed(ActionEvent e) { 70 | dispose();//serve para fechar a janela atual 71 | MenuUsuario usuario = new MenuUsuario(); 72 | usuario.setVisible(true); 73 | } 74 | }); 75 | okButton.setActionCommand("OK"); 76 | buttonPane.add(okButton); 77 | getRootPane().setDefaultButton(okButton); 78 | } 79 | { 80 | JButton cancelButton = new JButton("Cancel"); 81 | cancelButton.setActionCommand("Cancel"); 82 | buttonPane.add(cancelButton); 83 | } 84 | } 85 | } 86 | 87 | } 88 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Challenge ONE | Java | Back-end | Hotel Alura 2 | 3 |

4 | 5 | 6 |

7 | 8 | --- 9 | ## Este repositório contém o código-fonte para resolver o desafio de criar um aplicativo CRUD usando JDBC e Swing. O objetivo do desafio é desenvolver um aplicativo que permita realizar operações CRUD em um banco de dados relacional. 10 | 11 | ## 🖥️ Tecnologias Utilizadas: 12 | 13 | - Java 14 | - Eclipse 15 | - MySql 16 | - Biblioteca JCalendar 17 | - Plugin WindowBuilder
18 | 19 | --- 20 | ## ⚠️ Importante! ⚠️ 21 | 22 | ☕ Use o Java na versão 8 ou superior para ter compatibilidade. 23 |

24 | 📝 Recomendamos utilizar o editor Eclipse para compatibilidade da interface gráfica.

25 | 26 | ## Videos de resolução 27 | 28 | Para te ajudar ainda mais nessa jornada de aprendizado, criamos esses vídeos de soluções com as partes estratégicas para realizar esse desafio. Lembre-se que esta é apenas uma das infinitas formas de realizar o desafio, aproveite para estudar os códigos e também compartilhar entre vocês suas resoluções e opiniões sobre o seu projeto. 29 | 30 | - [Faça uma conexão com o banco de dados e salve seus registros](https://www.youtube.com/watch?v=xSvhuCukFp0) 31 | - [Mostrar registros através do programa](https://youtu.be/QHC5IS-E1KY) 32 | --- 33 | 34 | ## 📬 Entrega 35 | 36 | ### Como incluir meu projeto com a "#" do desafio? 37 | 38 | 1) Tenha o Fork do projeto em seu repositório no Github. 39 | 2) Utilize o tópico **#challengeonealurahotelbr4**. Vá na aba esquerda do seu projeto na seção About e clique na engrenagem de configuração selecione o campo **topics** e insira a etiqueta **challengeonealurahotelbr4**. 40 | 41 | 42 | ![gif-vitrine](https://user-images.githubusercontent.com/91544872/153601047-62aee6cb-e3cf-42b3-92c3-7130c996113f.gif) 43 | 44 | ### Como faço a entrega final do meu Projeto? 45 | 46 | 4) Preencha o formulário a seguir com seus dados pessoais, juntamente com o link do seu repositório.🔹 [Link para o formulário](https://lp.alura.com.br/alura-latam-entrega-challenge-one-portugues-back-end) 47 | 48 |

49 | 50 |

51 | 52 | 53 | 5) Vá para seu e-mail e resgate sua badge conquistada por encerrar mais um desafio no Projeto ONE! 🏆 54 | 55 | 6) Não se esqueça de colocar um link ou vídeo de seu projeto no Linkedin! Marque com a #Oracle #AluraLatam 🏁 56 | 57 | 58 | 🧡 Oracle
59 | 60 | 61 | 62 | 💙 Alura Latam
63 | 64 | 65 | -------------------------------------------------------------------------------- /src/jdbc/dao/ReservaDAO.java: -------------------------------------------------------------------------------- 1 | package jdbc.dao; 2 | 3 | import java.sql.Connection; 4 | import java.sql.Date; 5 | import java.sql.PreparedStatement; 6 | import java.sql.ResultSet; 7 | import java.sql.SQLException; 8 | import java.sql.Statement; 9 | import java.util.ArrayList; 10 | import java.util.List; 11 | import jdbc.modelo.Reserva; 12 | 13 | public class ReservaDAO { 14 | 15 | private Connection connection; 16 | 17 | public ReservaDAO(Connection connection) { 18 | this.connection = connection; 19 | } 20 | 21 | public void salvar(Reserva reserva) { 22 | try { 23 | String sql = "INSERT INTO reservas (data_entrada, data_saida, valor, formaPagamento) VALUES (?, ?, ?, ?)"; 24 | 25 | try (PreparedStatement pstm = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { 26 | 27 | pstm.setDate(1, reserva.getDataEntrada()); 28 | pstm.setDate(2, reserva.getDataSaida()); 29 | pstm.setString(3, reserva.getValor()); 30 | pstm.setString(4, reserva.getFormaPagamento()); 31 | 32 | pstm.executeUpdate(); 33 | 34 | try (ResultSet rst = pstm.getGeneratedKeys()) { 35 | while (rst.next()) { 36 | reserva.setId(rst.getInt(1)); 37 | } 38 | } 39 | } 40 | } catch (SQLException e) { 41 | throw new RuntimeException(e); 42 | } 43 | 44 | } 45 | 46 | public List buscar() { 47 | List reservas = new ArrayList(); 48 | try { 49 | String sql = "SELECT id, data_entrada, data_saida, valor, formaPagamento FROM reservas"; 50 | 51 | try (PreparedStatement pstm = connection.prepareStatement(sql)) { 52 | pstm.execute(); 53 | 54 | transformarResultSetEmReserva(reservas, pstm); 55 | } 56 | return reservas; 57 | } catch (SQLException e) { 58 | throw new RuntimeException(e); 59 | } 60 | } 61 | 62 | public List buscarId(String id) { 63 | List reservas = new ArrayList(); 64 | try { 65 | 66 | String sql = "SELECT id, data_entrada, data_saida, valor, formaPagamento FROM reservas WHERE id = ?"; 67 | 68 | try (PreparedStatement pstm = connection.prepareStatement(sql)) { 69 | pstm.setString(1, id); 70 | pstm.execute(); 71 | 72 | transformarResultSetEmReserva(reservas, pstm); 73 | } 74 | return reservas; 75 | } catch (SQLException e) { 76 | throw new RuntimeException(e); 77 | } 78 | } 79 | 80 | public void deletar(Integer id) { 81 | try (PreparedStatement stm = connection.prepareStatement("DELETE FROM reservas WHERE id = ?")) { 82 | stm.setInt(1, id); 83 | stm.execute(); 84 | } catch (SQLException e) { 85 | throw new RuntimeException(e); 86 | } 87 | } 88 | 89 | public void atualizar(Date dataEntrada, Date dataSaida, String valor, String formaPagamento, Integer id) { 90 | try (PreparedStatement stm = connection 91 | .prepareStatement("UPDATE reservas SET data_entrada = ?, data_saida = ?, valor = ?, formaPagamento = ? WHERE id = ?")) { 92 | stm.setDate(1, dataEntrada); 93 | stm.setDate(2, dataSaida); 94 | stm.setString(3, valor); 95 | stm.setString(4, formaPagamento); 96 | stm.setInt(5, id); 97 | stm.execute(); 98 | } catch (SQLException e) { 99 | throw new RuntimeException(e); 100 | } 101 | } 102 | 103 | 104 | private void transformarResultSetEmReserva(List reservas, PreparedStatement pstm) throws SQLException { 105 | try (ResultSet rst = pstm.getResultSet()) { 106 | while (rst.next()) { 107 | Reserva reserva = new Reserva(rst.getInt(1), rst.getDate(2), rst.getDate(3), rst.getString(4), rst.getString(5)); 108 | 109 | reservas.add(reserva); 110 | } 111 | } 112 | } 113 | } 114 | -------------------------------------------------------------------------------- /src/jdbc/dao/HospedesDAO.java: -------------------------------------------------------------------------------- 1 | package jdbc.dao; 2 | 3 | import java.sql.*; 4 | import java.util.ArrayList; 5 | import java.util.List; 6 | 7 | import jdbc.modelo.Hospedes; 8 | 9 | 10 | public class HospedesDAO { 11 | private Connection connection; 12 | 13 | public HospedesDAO(Connection connection) { 14 | this.connection = connection; 15 | } 16 | 17 | public void salvar(Hospedes hospedes) { 18 | try { 19 | String sql = "INSERT INTO hospedes (nome, sobrenome, data_nascimento, nacionalidade, telefone, idReserva) VALUES (?, ?, ?, ?,?,?)"; 20 | 21 | try (PreparedStatement pstm = connection.prepareStatement(sql, Statement.RETURN_GENERATED_KEYS)) { 22 | 23 | pstm.setString(1, hospedes.getNome()); 24 | pstm.setString(2, hospedes.getSobrenome()); 25 | pstm.setDate(3, hospedes.getDataNascimento()); 26 | pstm.setString(4, hospedes.getNacionalidade()); 27 | pstm.setString(5, hospedes.getTelefone()); 28 | pstm.setInt(6, hospedes.getIdReserva()); 29 | 30 | pstm.execute(); 31 | 32 | try (ResultSet rst = pstm.getGeneratedKeys()) { 33 | while (rst.next()) { 34 | hospedes.setId(rst.getInt(1)); 35 | } 36 | } 37 | } 38 | } catch (SQLException e) { 39 | throw new RuntimeException(e); 40 | } 41 | } 42 | public List listarHospedes() { 43 | List hospedes = new ArrayList<>(); 44 | try { 45 | String sql = "SELECT id, nome, sobrenome, data_nascimento, nacionalidade, telefone, idReserva FROM hospedes"; 46 | 47 | try (PreparedStatement pstm = connection.prepareStatement(sql)) { 48 | pstm.execute(); 49 | 50 | transformarResultSetEmHospede(hospedes, pstm); 51 | } 52 | return hospedes; 53 | } catch (SQLException e) { 54 | throw new RuntimeException(e); 55 | } 56 | } 57 | 58 | public List buscarId(String id) { 59 | List hospedes = new ArrayList(); 60 | try { 61 | 62 | String sql = "SELECT id, nome, sobrenome, data_nascimento, nacionalidade, telefone, idReserva FROM hospedes WHERE id = ?"; 63 | 64 | try (PreparedStatement pstm = connection.prepareStatement(sql)) { 65 | pstm.setString(1, id); 66 | pstm.execute(); 67 | 68 | transformarResultSetEmHospede(hospedes, pstm); 69 | } 70 | return hospedes; 71 | } catch (SQLException e) { 72 | throw new RuntimeException(e); 73 | } 74 | } 75 | 76 | public void atualizar(String nome, String sobrenome, Date dataNascimento, String nacionalidade, String telefone, Integer idReserva, Integer id) { 77 | try (PreparedStatement stm = connection 78 | .prepareStatement("UPDATE hospedes SET nome = ?, sobrenome = ?, data_nascimento = ?, nacionalidade = ?, telefone = ?, idReserva = ? WHERE id = ?")) { 79 | stm.setString(1, nome); 80 | stm.setString(2, sobrenome); 81 | stm.setDate(3, dataNascimento); 82 | stm.setString(4, nacionalidade); 83 | stm.setString(5, telefone); 84 | stm.setInt(6, idReserva); 85 | stm.setInt(7, id); 86 | stm.execute(); 87 | } catch (SQLException e) { 88 | throw new RuntimeException(e); 89 | } 90 | } 91 | 92 | public void deletar(Integer id) { 93 | try (PreparedStatement stm = connection.prepareStatement("DELETE FROM hospedes WHERE id = ?")) { 94 | stm.setInt(1, id); 95 | stm.execute(); 96 | } catch (SQLException e) { 97 | throw new RuntimeException(e); 98 | } 99 | } 100 | 101 | private void transformarResultSetEmHospede(List reservas, PreparedStatement pstm) throws SQLException { 102 | try (ResultSet rst = pstm.getResultSet()) { 103 | while (rst.next()) { 104 | Hospedes hospedes = new Hospedes(rst.getInt(1), rst.getString(2), rst.getString(3), rst.getDate(4), rst.getString(5), rst.getString(6), rst.getInt(7)); 105 | reservas.add(hospedes); 106 | } 107 | } 108 | } 109 | 110 | 111 | 112 | } 113 | 114 | -------------------------------------------------------------------------------- /src/views/MenuPrincipal.java: -------------------------------------------------------------------------------- 1 | package views; 2 | 3 | import java.awt.EventQueue; 4 | import javax.swing.JFrame; 5 | import javax.swing.JPanel; 6 | import javax.swing.border.EmptyBorder; 7 | import java.awt.Panel; 8 | import java.awt.Color; 9 | import java.awt.SystemColor; 10 | import javax.swing.JLabel; 11 | import javax.swing.JOptionPane; 12 | import javax.swing.ImageIcon; 13 | import javax.swing.JButton; 14 | import java.awt.event.ActionListener; 15 | import java.awt.event.ActionEvent; 16 | import java.awt.Font; 17 | import java.awt.Toolkit; 18 | import javax.swing.SwingConstants; 19 | import java.awt.event.MouseAdapter; 20 | import java.awt.event.MouseEvent; 21 | import java.awt.event.MouseMotionAdapter; 22 | 23 | @SuppressWarnings("serial") 24 | public class MenuPrincipal extends JFrame { 25 | 26 | private JPanel contentPane; 27 | private JLabel labelExit; 28 | int xMouse, yMouse; 29 | 30 | /** 31 | * Launch the application. 32 | */ 33 | public static void main(String[] args) { 34 | EventQueue.invokeLater(new Runnable() { 35 | public void run() { 36 | try { 37 | MenuPrincipal frame = new MenuPrincipal(); 38 | frame.setVisible(true); 39 | } catch (Exception e) { 40 | e.printStackTrace(); 41 | } 42 | } 43 | }); 44 | } 45 | 46 | /** 47 | * Create the frame. 48 | */ 49 | public MenuPrincipal() { 50 | setIconImage(Toolkit.getDefaultToolkit().getImage(MenuPrincipal.class.getResource("/imagenes/aH-40px.png"))); 51 | setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE); 52 | setBounds(100, 100, 910, 537); 53 | contentPane = new JPanel(); 54 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 55 | setContentPane(contentPane); 56 | contentPane.setLayout(null); 57 | setResizable(false); 58 | setLocationRelativeTo(null); 59 | setUndecorated(true); 60 | 61 | 62 | Panel panel = new Panel(); 63 | panel.setBackground(SystemColor.window); 64 | panel.setBounds(0, 0, 910, 537); 65 | contentPane.add(panel); 66 | panel.setLayout(null); 67 | 68 | JLabel imagenFondo = new JLabel(""); 69 | imagenFondo.setBounds(-50, 0, 732, 501); 70 | imagenFondo.setIcon(new ImageIcon(MenuPrincipal.class.getResource("/imagenes/menu-img.png"))); 71 | panel.add(imagenFondo); 72 | 73 | JLabel Logo = new JLabel(""); 74 | Logo.setBounds(722, 80, 150, 156); 75 | Logo.setIcon(new ImageIcon(MenuPrincipal.class.getResource("/imagenes/aH-150px.png"))); 76 | panel.add(Logo); 77 | 78 | JPanel panel_1 = new JPanel(); 79 | panel_1.setBounds(0, 500, 910, 37); 80 | panel_1.setBackground(new Color(12, 138, 199)); 81 | panel.add(panel_1); 82 | panel_1.setLayout(null); 83 | 84 | JLabel lblCopyR = new JLabel("Desenvolvido por Fulanita de Tal © 2022"); 85 | lblCopyR.setBounds(315, 11, 284, 19); 86 | lblCopyR.setForeground(new Color(240, 248, 255)); 87 | lblCopyR.setFont(new Font("Roboto", Font.PLAIN, 16)); 88 | panel_1.add(lblCopyR); 89 | 90 | JPanel header = new JPanel(); 91 | header.setBounds(0, 0, 910, 36); 92 | header.addMouseMotionListener(new MouseMotionAdapter() { 93 | @Override 94 | public void mouseDragged(MouseEvent e) { 95 | headerMouseDragged(e); 96 | 97 | } 98 | }); 99 | header.addMouseListener(new MouseAdapter() { 100 | @Override 101 | public void mousePressed(MouseEvent e) { 102 | headerMousePressed(e); 103 | } 104 | }); 105 | header.setLayout(null); 106 | header.setBackground(Color.WHITE); 107 | panel.add(header); 108 | 109 | JPanel btnexit = new JPanel(); 110 | btnexit.addMouseListener(new MouseAdapter() { 111 | @Override 112 | public void mouseClicked(MouseEvent e) { 113 | System.exit(0); 114 | } 115 | @Override 116 | public void mouseEntered(MouseEvent e) { 117 | btnexit.setBackground(Color.red); 118 | labelExit.setForeground(Color.white); 119 | } 120 | @Override 121 | public void mouseExited(MouseEvent e) { 122 | btnexit.setBackground(Color.white); 123 | labelExit.setForeground(Color.black); 124 | } 125 | }); 126 | btnexit.setLayout(null); 127 | btnexit.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 128 | btnexit.setBackground(Color.WHITE); 129 | btnexit.setBounds(857, 0, 53, 36); 130 | header.add(btnexit); 131 | 132 | labelExit = new JLabel("X"); 133 | labelExit.setBounds(0, 0, 53, 36); 134 | btnexit.add(labelExit); 135 | labelExit.setHorizontalAlignment(SwingConstants.CENTER); 136 | labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); 137 | 138 | JPanel btnLogin = new JPanel(); 139 | btnLogin.setBounds(754, 300, 83, 70); 140 | btnLogin.addMouseListener(new MouseAdapter() { 141 | @Override 142 | public void mouseClicked(MouseEvent e) { 143 | Login login = new Login(); 144 | login.setVisible(true); 145 | dispose(); 146 | } 147 | }); 148 | btnLogin.setLayout(null); 149 | btnLogin.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 150 | btnLogin.setBackground(SystemColor.window); 151 | panel.add(btnLogin); 152 | 153 | JLabel lblLogin = new JLabel(""); 154 | lblLogin.setBounds(0, 0, 80, 70); 155 | btnLogin.add(lblLogin); 156 | lblLogin.setHorizontalAlignment(SwingConstants.CENTER); 157 | lblLogin.setIcon(new ImageIcon(MenuPrincipal.class.getResource("/imagenes/login.png"))); 158 | 159 | JLabel lblTitulo = new JLabel("LOGIN"); 160 | lblTitulo.setBounds(754, 265, 83, 24); 161 | lblTitulo.setBackground(SystemColor.window); 162 | panel.add(lblTitulo); 163 | lblTitulo.setHorizontalAlignment(SwingConstants.CENTER); 164 | lblTitulo.setForeground(SystemColor.textHighlight); 165 | lblTitulo.setFont(new Font("Roboto Light", Font.PLAIN, 20)); 166 | } 167 | 168 | private void headerMousePressed(java.awt.event.MouseEvent evt) { 169 | xMouse = evt.getX(); 170 | yMouse = evt.getY(); 171 | }//GEN-LAST:event_headerMousePressed 172 | 173 | private void headerMouseDragged(java.awt.event.MouseEvent evt) { 174 | int x = evt.getXOnScreen(); 175 | int y = evt.getYOnScreen(); 176 | this.setLocation(x - xMouse, y - yMouse); 177 | } 178 | } 179 | -------------------------------------------------------------------------------- /.idea/uiDesigner.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | -------------------------------------------------------------------------------- /src/views/Login.java: -------------------------------------------------------------------------------- 1 | package views; 2 | 3 | import java.awt.BorderLayout; 4 | import java.awt.EventQueue; 5 | 6 | import javax.swing.JFrame; 7 | import javax.swing.JPanel; 8 | import javax.swing.border.EmptyBorder; 9 | import javax.swing.JInternalFrame; 10 | import java.awt.Color; 11 | import javax.swing.JLabel; 12 | import javax.swing.JOptionPane; 13 | import javax.swing.ImageIcon; 14 | import javax.swing.JTextField; 15 | import javax.swing.JSeparator; 16 | import java.awt.SystemColor; 17 | import java.awt.Font; 18 | import javax.swing.JPasswordField; 19 | import javax.swing.SwingConstants; 20 | import java.awt.event.MouseAdapter; 21 | import java.awt.event.MouseEvent; 22 | import java.awt.event.MouseMotionAdapter; 23 | 24 | public class Login extends JFrame { 25 | 26 | private JPanel contentPane; 27 | private JTextField txtUsuario; 28 | private JPasswordField txtContrasena; 29 | int xMouse, yMouse; 30 | private JLabel labelExit; 31 | 32 | /** 33 | * Launch the application. 34 | */ 35 | public static void main(String[] args) { 36 | EventQueue.invokeLater(new Runnable() { 37 | public void run() { 38 | try { 39 | Login frame = new Login(); 40 | frame.setVisible(true); 41 | } catch (Exception e) { 42 | e.printStackTrace(); 43 | } 44 | } 45 | }); 46 | } 47 | 48 | /** 49 | * Create the frame. 50 | */ 51 | public Login() { 52 | setResizable(false); 53 | setUndecorated(true); 54 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 55 | setBounds(100, 100, 788, 527); 56 | contentPane = new JPanel(); 57 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 58 | setContentPane(contentPane); 59 | contentPane.setLayout(null); 60 | setLocationRelativeTo(null); 61 | 62 | 63 | JPanel panel = new JPanel(); 64 | panel.setBounds(0, 0, 788, 527); 65 | panel.setBackground(Color.WHITE); 66 | contentPane.add(panel); 67 | panel.setLayout(null); 68 | 69 | JPanel panel_1 = new JPanel(); 70 | panel_1.setBackground(new Color(12, 138, 199)); 71 | panel_1.setBounds(484, 0, 304, 527); 72 | panel.add(panel_1); 73 | panel_1.setLayout(null); 74 | 75 | JLabel imgHotel = new JLabel(""); 76 | imgHotel.setBounds(0, 0, 304, 538); 77 | panel_1.add(imgHotel); 78 | imgHotel.setIcon(new ImageIcon(Login.class.getResource("/imagenes/img-hotel-login-.png"))); 79 | 80 | JPanel btnexit = new JPanel(); 81 | btnexit.setBounds(251, 0, 53, 36); 82 | panel_1.add(btnexit); 83 | btnexit.addMouseListener(new MouseAdapter() { 84 | @Override 85 | public void mouseClicked(MouseEvent e) { 86 | System.exit(0); 87 | } 88 | @Override 89 | public void mouseEntered(MouseEvent e) { 90 | btnexit.setBackground(Color.red); 91 | labelExit.setForeground(Color.white); 92 | } 93 | @Override 94 | public void mouseExited(MouseEvent e) { 95 | btnexit.setBackground(new Color(12, 138, 199)); 96 | labelExit.setForeground(Color.white); 97 | } 98 | }); 99 | btnexit.setBackground(new Color(12, 138, 199)); 100 | btnexit.setLayout(null); 101 | btnexit.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 102 | 103 | labelExit = new JLabel("X"); 104 | labelExit.setBounds(0, 0, 53, 36); 105 | btnexit.add(labelExit); 106 | labelExit.setForeground(SystemColor.text); 107 | labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); 108 | labelExit.setHorizontalAlignment(SwingConstants.CENTER); 109 | 110 | txtUsuario = new JTextField(); 111 | txtUsuario.addMouseListener(new MouseAdapter() { 112 | @Override 113 | public void mousePressed(MouseEvent e) { 114 | if (txtUsuario.getText().equals("Digite seu nome de usuario")) { 115 | txtUsuario.setText(""); 116 | txtUsuario.setForeground(Color.black); 117 | } 118 | if (String.valueOf(txtContrasena.getPassword()).isEmpty()) { 119 | txtContrasena.setText("********"); 120 | txtContrasena.setForeground(Color.gray); 121 | } 122 | } 123 | }); 124 | txtUsuario.setFont(new Font("Roboto", Font.PLAIN, 16)); 125 | txtUsuario.setText("Digite seu nome de usuario"); 126 | txtUsuario.setBorder(javax.swing.BorderFactory.createEmptyBorder()); 127 | txtUsuario.setForeground(SystemColor.activeCaptionBorder); 128 | txtUsuario.setBounds(65, 256, 324, 32); 129 | panel.add(txtUsuario); 130 | txtUsuario.setColumns(10); 131 | 132 | JSeparator separator = new JSeparator(); 133 | separator.setBackground(new Color(0, 120, 215)); 134 | separator.setBounds(65, 292, 324, 2); 135 | panel.add(separator); 136 | 137 | JLabel labelTitulo = new JLabel("LOGIN"); 138 | labelTitulo.setForeground(SystemColor.textHighlight); 139 | labelTitulo.setFont(new Font("Roboto Black", Font.PLAIN, 26)); 140 | labelTitulo.setBounds(65, 149, 202, 26); 141 | panel.add(labelTitulo); 142 | 143 | JSeparator separator_1 = new JSeparator(); 144 | separator_1.setBackground(SystemColor.textHighlight); 145 | separator_1.setBounds(65, 393, 324, 2); 146 | panel.add(separator_1); 147 | 148 | txtContrasena = new JPasswordField(); 149 | txtContrasena.setText("********"); 150 | txtContrasena.addMouseListener(new MouseAdapter() { 151 | @Override 152 | public void mousePressed(MouseEvent e) { 153 | if (String.valueOf(txtContrasena.getPassword()).equals("********")) { 154 | txtContrasena.setText(""); 155 | txtContrasena.setForeground(Color.black); 156 | } 157 | if (txtUsuario.getText().isEmpty()) { 158 | txtUsuario.setText("Digite seu nome de usuario"); 159 | txtUsuario.setForeground(Color.gray); 160 | } 161 | } 162 | }); 163 | txtContrasena.setForeground(SystemColor.activeCaptionBorder); 164 | txtContrasena.setFont(new Font("Roboto", Font.PLAIN, 16)); 165 | txtContrasena.setBorder(javax.swing.BorderFactory.createEmptyBorder()); 166 | txtContrasena.setBounds(65, 353, 324, 32); 167 | panel.add(txtContrasena); 168 | 169 | JLabel LabelUsuario = new JLabel("USUARIO"); 170 | LabelUsuario.setForeground(SystemColor.textInactiveText); 171 | LabelUsuario.setFont(new Font("Roboto Black", Font.PLAIN, 20)); 172 | LabelUsuario.setBounds(65, 219, 107, 26); 173 | panel.add(LabelUsuario); 174 | 175 | JLabel lblContrasea = new JLabel("SENHA"); 176 | lblContrasea.setForeground(SystemColor.textInactiveText); 177 | lblContrasea.setFont(new Font("Roboto Black", Font.PLAIN, 20)); 178 | lblContrasea.setBounds(65, 316, 140, 26); 179 | panel.add(lblContrasea); 180 | 181 | JPanel btnLogin = new JPanel(); 182 | btnLogin.addMouseListener(new MouseAdapter() { 183 | @Override 184 | public void mouseEntered(MouseEvent e) { 185 | btnLogin.setBackground(new Color(0, 156, 223)); 186 | } 187 | 188 | @Override 189 | public void mouseExited(MouseEvent e) { 190 | btnLogin.setBackground(SystemColor.textHighlight); 191 | } 192 | @Override 193 | public void mouseClicked(MouseEvent e) { 194 | Login(); 195 | } 196 | }); 197 | btnLogin.setBackground(SystemColor.textHighlight); 198 | btnLogin.setBounds(65, 431, 122, 44); 199 | panel.add(btnLogin); 200 | btnLogin.setLayout(null); 201 | btnLogin.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 202 | 203 | JLabel lblNewLabel = new JLabel("ENTRAR"); 204 | lblNewLabel.setBounds(0, 0, 122, 44); 205 | btnLogin.add(lblNewLabel); 206 | lblNewLabel.setForeground(SystemColor.controlLtHighlight); 207 | lblNewLabel.setHorizontalAlignment(SwingConstants.CENTER); 208 | lblNewLabel.setFont(new Font("Roboto", Font.PLAIN, 18)); 209 | 210 | JLabel lblNewLabel_1 = new JLabel(""); 211 | lblNewLabel_1.setHorizontalAlignment(SwingConstants.CENTER); 212 | lblNewLabel_1.setIcon(new ImageIcon(Login.class.getResource("/imagenes/lOGO-50PX.png"))); 213 | lblNewLabel_1.setBounds(65, 65, 48, 59); 214 | panel.add(lblNewLabel_1); 215 | 216 | JPanel header = new JPanel(); 217 | header.addMouseMotionListener(new MouseMotionAdapter() { 218 | @Override 219 | public void mouseDragged(MouseEvent e) { 220 | headerMouseDragged(e); 221 | 222 | } 223 | }); 224 | header.addMouseListener(new MouseAdapter() { 225 | @Override 226 | public void mousePressed(MouseEvent e) { 227 | headerMousePressed(e); 228 | } 229 | }); 230 | header.setBackground(SystemColor.window); 231 | header.setBounds(0, 0, 784, 36); 232 | panel.add(header); 233 | header.setLayout(null); 234 | } 235 | 236 | private void Login() { 237 | String Usuario= "admin"; 238 | String Senha="admin"; 239 | 240 | String senhaa=new String (txtContrasena.getPassword()); 241 | 242 | if(txtUsuario.getText().equals(Usuario) && senhaa.equals(Senha)){ 243 | MenuUsuario menu = new MenuUsuario(); 244 | menu.setVisible(true); 245 | dispose(); 246 | }else { 247 | JOptionPane.showMessageDialog(this, "Usuario ou Senha não válidos"); 248 | } 249 | } 250 | //Código que permite movimentar a janela pela tela seguindo a posição de "x" e "y" 251 | private void headerMousePressed(java.awt.event.MouseEvent evt) { 252 | xMouse = evt.getX(); 253 | yMouse = evt.getY(); 254 | }//GEN-LAST:event_headerMousePressed 255 | 256 | private void headerMouseDragged(java.awt.event.MouseEvent evt) { 257 | int x = evt.getXOnScreen(); 258 | int y = evt.getYOnScreen(); 259 | this.setLocation(x - xMouse, y - yMouse); 260 | } 261 | } 262 | -------------------------------------------------------------------------------- /src/views/MenuUsuario.java: -------------------------------------------------------------------------------- 1 | package views; 2 | 3 | import java.awt.EventQueue; 4 | import javax.swing.JFrame; 5 | import javax.swing.JPanel; 6 | import javax.swing.border.EmptyBorder; 7 | import javax.swing.JLabel; 8 | import javax.swing.ImageIcon; 9 | import java.awt.Color; 10 | import java.awt.Font; 11 | import java.awt.event.MouseAdapter; 12 | import java.awt.event.MouseEvent; 13 | import java.awt.Toolkit; 14 | import javax.swing.SwingConstants; 15 | import java.awt.event.MouseMotionAdapter; 16 | import java.text.SimpleDateFormat; 17 | import java.util.Date; 18 | import java.awt.SystemColor; 19 | import javax.swing.JSeparator; 20 | 21 | @SuppressWarnings("serial") 22 | public class MenuUsuario extends JFrame { 23 | 24 | private JPanel contentPane; 25 | int xMouse, yMouse; 26 | private JLabel labelExit; 27 | private JLabel labelRegistro; 28 | 29 | /** 30 | * Launch the application. 31 | */ 32 | public static void main(String[] args) { 33 | EventQueue.invokeLater(new Runnable() { 34 | public void run() { 35 | try { 36 | MenuUsuario frame = new MenuUsuario(); 37 | frame.setVisible(true); 38 | } catch (Exception e) { 39 | e.printStackTrace(); 40 | } 41 | } 42 | }); 43 | } 44 | 45 | /** 46 | * Create the frame. 47 | */ 48 | public MenuUsuario() { 49 | setIconImage(Toolkit.getDefaultToolkit().getImage(MenuUsuario.class.getResource("/imagenes/aH-40px.png"))); 50 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 51 | setBounds(100, 100, 944, 609); 52 | contentPane = new JPanel(); 53 | contentPane.setBackground(Color.WHITE); 54 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 55 | setContentPane(contentPane); 56 | contentPane.setLayout(null); 57 | setResizable(false); 58 | setLocationRelativeTo(null); 59 | setUndecorated(true); 60 | 61 | JPanel header = new JPanel(); 62 | header.addMouseMotionListener(new MouseMotionAdapter() { 63 | @Override 64 | public void mouseDragged(MouseEvent e) { 65 | headerMouseDragged(e); 66 | } 67 | }); 68 | header.addMouseListener(new MouseAdapter() { 69 | @Override 70 | public void mousePressed(MouseEvent e) { 71 | headerMousePressed(e); 72 | } 73 | }); 74 | 75 | JPanel panelMenu = new JPanel(); 76 | panelMenu.setBackground(new Color(12, 138, 199)); 77 | panelMenu.setBounds(0, 0, 257, 609); 78 | contentPane.add(panelMenu); 79 | panelMenu.setLayout(null); 80 | 81 | JLabel logo = new JLabel(""); 82 | logo.setBounds(50, 58, 150, 150); 83 | panelMenu.add(logo); 84 | logo.setIcon(new ImageIcon(MenuUsuario.class.getResource("/imagenes/aH-150px.png"))); 85 | 86 | JPanel btnRegistro = new JPanel(); 87 | btnRegistro.addMouseListener(new MouseAdapter() { 88 | @Override 89 | public void mouseEntered(MouseEvent e) { 90 | btnRegistro.setBackground(new Color(118, 187, 223)); 91 | } 92 | @Override 93 | public void mouseExited(MouseEvent e) { 94 | btnRegistro.setBackground(new Color(12, 138, 199)); 95 | } 96 | @Override 97 | public void mouseClicked(MouseEvent e) { 98 | ReservasView reservas = new ReservasView(); 99 | reservas.setVisible(true); 100 | dispose(); 101 | } 102 | }); 103 | btnRegistro.setBounds(0, 255, 257, 56); 104 | btnRegistro.setBackground(new Color(12, 138, 199)); 105 | panelMenu.add(btnRegistro); 106 | btnRegistro.setLayout(null); 107 | btnRegistro.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 108 | 109 | labelRegistro = new JLabel("Registro de reservas"); 110 | labelRegistro.setIcon(new ImageIcon(MenuUsuario.class.getResource("/imagenes/reservado.png"))); 111 | labelRegistro.setForeground(SystemColor.text); 112 | labelRegistro.setBounds(25, 11, 205, 34); 113 | labelRegistro.setFont(new Font("Roboto", Font.PLAIN, 18)); 114 | labelRegistro.setHorizontalAlignment(SwingConstants.LEFT); 115 | btnRegistro.add(labelRegistro); 116 | 117 | JPanel btnBuscar = new JPanel(); 118 | btnBuscar.addMouseListener(new MouseAdapter() { 119 | @Override 120 | public void mouseEntered(MouseEvent e) { 121 | btnBuscar.setBackground(new Color(118, 187, 223)); 122 | } 123 | @Override 124 | public void mouseExited(MouseEvent e) { 125 | btnBuscar.setBackground(new Color(12, 138, 199)); 126 | } 127 | @Override 128 | public void mouseClicked(MouseEvent e) { 129 | Busca busca = new Busca(); 130 | busca.setVisible(true); 131 | dispose(); 132 | } 133 | }); 134 | btnBuscar.setBounds(0, 312, 257, 56); 135 | btnBuscar.setBackground(new Color(12, 138, 199)); 136 | panelMenu.add(btnBuscar); 137 | btnBuscar.setLayout(null); 138 | btnBuscar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 139 | 140 | JLabel lblBuscaDeReservas = new JLabel("Busca"); 141 | lblBuscaDeReservas.setIcon(new ImageIcon(MenuUsuario.class.getResource("/imagenes/pessoas.png"))); 142 | lblBuscaDeReservas.setBounds(27, 11, 200, 34); 143 | lblBuscaDeReservas.setHorizontalAlignment(SwingConstants.LEFT); 144 | lblBuscaDeReservas.setForeground(Color.WHITE); 145 | lblBuscaDeReservas.setFont(new Font("Roboto", Font.PLAIN, 18)); 146 | btnBuscar.add(lblBuscaDeReservas); 147 | 148 | JSeparator separator = new JSeparator(); 149 | separator.setBounds(26, 219, 201, 2); 150 | panelMenu.add(separator); 151 | header.setLayout(null); 152 | header.setBackground(Color.WHITE); 153 | header.setBounds(0, 0, 944, 36); 154 | contentPane.add(header); 155 | 156 | JPanel btnexit = new JPanel(); 157 | btnexit.addMouseListener(new MouseAdapter() { 158 | @Override 159 | public void mouseClicked(MouseEvent e) { 160 | System.exit(0); 161 | } 162 | @Override 163 | public void mouseEntered(MouseEvent e) { 164 | btnexit.setBackground(Color.red); 165 | labelExit.setForeground(Color.white); 166 | } 167 | @Override 168 | public void mouseExited(MouseEvent e) { 169 | btnexit.setBackground(Color.white); 170 | labelExit.setForeground(Color.black); 171 | } 172 | }); 173 | 174 | btnexit.setLayout(null); 175 | btnexit.setBackground(Color.WHITE); 176 | btnexit.setBounds(891, 0, 53, 36); 177 | header.add(btnexit); 178 | 179 | labelExit = new JLabel("X"); 180 | labelExit.setBounds(0, 0, 53, 36); 181 | btnexit.add(labelExit); 182 | labelExit.setHorizontalAlignment(SwingConstants.CENTER); 183 | labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); 184 | 185 | JPanel panelData = new JPanel(); 186 | panelData.setBackground(new Color(118, 187, 223)); 187 | panelData.setBounds(256, 84, 688, 121); 188 | contentPane.add(panelData); 189 | panelData.setLayout(null); 190 | 191 | JLabel lblTituloPrincipal = new JLabel("Sistema de reservas Hotel Alura"); 192 | lblTituloPrincipal.setBounds(180, 11, 356, 42); 193 | panelData.add(lblTituloPrincipal); 194 | lblTituloPrincipal.setForeground(Color.WHITE); 195 | lblTituloPrincipal.setFont(new Font("Roboto", Font.PLAIN, 24)); 196 | 197 | JLabel labelData = new JLabel("New label"); 198 | labelData.setBounds(35, 64, 294, 36); 199 | panelData.add(labelData); 200 | labelData.setForeground(Color.WHITE); 201 | labelData.setFont(new Font("Roboto", Font.PLAIN, 33)); 202 | Date dataAtual = new Date(); //data e hora atuais 203 | String data = new SimpleDateFormat("dd/MM/yyyy").format(dataAtual); //formata a data numa string 204 | labelData.setText("Hoje é " + data); //estabelece a data na label 205 | 206 | JLabel lblTitulo = new JLabel("Bem-vindo"); 207 | lblTitulo.setFont(new Font("Roboto", Font.BOLD, 24)); 208 | lblTitulo.setBounds(302, 234, 147, 46); 209 | contentPane.add(lblTitulo); 210 | 211 | String textoDescricao = "Sistema de reservas de hotéis. Controle e gerencie de forma otimizada e fácil
o fluxo de reservas e hóspedes do hotel "; 212 | JLabel labelDescricao = new JLabel(textoDescricao); 213 | labelDescricao.setFont(new Font("Roboto", Font.PLAIN, 17)); 214 | 215 | labelDescricao.setBounds(312, 291, 598, 66); 216 | contentPane.add(labelDescricao); 217 | 218 | String textoDescricao1 = " Esta ferramenta permitirá que você mantenha um controle completo e detalhado de suas reservas e hóspedes, você terá acesso a ferramentas especiais para tarefas específicas como:"; 219 | JLabel labelDescricao_1 = new JLabel(textoDescricao1); 220 | labelDescricao_1.setFont(new Font("Roboto", Font.PLAIN, 17)); 221 | labelDescricao_1.setBounds(311, 345, 569, 88); 222 | contentPane.add(labelDescricao_1); 223 | 224 | JLabel lblDescricao_3 = new JLabel("- Registro de Reservas e Hóspedes"); 225 | lblDescricao_3.setFont(new Font("Roboto", Font.PLAIN, 17)); 226 | lblDescricao_3.setBounds(312, 444, 295, 27); 227 | contentPane.add(lblDescricao_3); 228 | 229 | JLabel lblDescricao_4 = new JLabel("- Edição de Reservas e Hóspedes existentes"); 230 | lblDescricao_4.setFont(new Font("Roboto", Font.PLAIN, 17)); 231 | lblDescricao_4.setBounds(312, 482, 355, 27); 232 | contentPane.add(lblDescricao_4); 233 | 234 | JLabel lblDescricao_5 = new JLabel("- Excluir todos os tipos de registros"); 235 | lblDescricao_5.setFont(new Font("Roboto", Font.PLAIN, 17)); 236 | lblDescricao_5.setBounds(312, 520, 295, 27); 237 | contentPane.add(lblDescricao_5); 238 | } 239 | 240 | private void headerMousePressed(java.awt.event.MouseEvent evt) { 241 | xMouse = evt.getX(); 242 | yMouse = evt.getY(); 243 | }//GEN-LAST:event_headerMousePressed 244 | 245 | private void headerMouseDragged(java.awt.event.MouseEvent evt) { 246 | int x = evt.getXOnScreen(); 247 | int y = evt.getYOnScreen(); 248 | this.setLocation(x - xMouse, y - yMouse); 249 | } 250 | } 251 | -------------------------------------------------------------------------------- /src/views/ReservasView.java: -------------------------------------------------------------------------------- 1 | package views; 2 | 3 | import java.awt.EventQueue; 4 | import javax.swing.JFrame; 5 | import javax.swing.JPanel; 6 | import javax.swing.border.EmptyBorder; 7 | import java.awt.SystemColor; 8 | import javax.swing.JLabel; 9 | import javax.swing.JOptionPane; 10 | import javax.swing.ImageIcon; 11 | import java.awt.Color; 12 | import javax.swing.JTextField; 13 | import com.toedter.calendar.JDateChooser; 14 | import jdbc.controller.ReservasController; 15 | import jdbc.modelo.Reserva; 16 | 17 | import java.awt.Font; 18 | import javax.swing.JComboBox; 19 | import javax.swing.DefaultComboBoxModel; 20 | import java.sql.Date; 21 | import java.text.Format; 22 | import java.util.Calendar; 23 | import java.awt.event.MouseAdapter; 24 | import java.awt.event.MouseEvent; 25 | import java.awt.event.MouseMotionAdapter; 26 | import java.awt.Toolkit; 27 | import java.beans.PropertyChangeListener; 28 | import java.beans.PropertyChangeEvent; 29 | import javax.swing.JSeparator; 30 | import javax.swing.SwingConstants; 31 | import javax.swing.border.LineBorder; 32 | 33 | 34 | @SuppressWarnings("serial") 35 | public class ReservasView extends JFrame { 36 | 37 | private JPanel contentPane; 38 | public static JTextField txtValor; 39 | public static JDateChooser txtDataE; 40 | public static JDateChooser txtDataS; 41 | public static JComboBox txtFormaPagamento; 42 | private ReservasController reservaController; 43 | int xMouse, yMouse; 44 | private JLabel labelExit; 45 | private JLabel lblNewLabel_3; 46 | private JLabel labelAtras; 47 | private ReservasController reservasController; 48 | 49 | /** 50 | * Launch the application. 51 | */ 52 | public static void main(String[] args) { 53 | EventQueue.invokeLater(new Runnable() { 54 | public void run() { 55 | try { 56 | ReservasView frame = new ReservasView(); 57 | frame.setVisible(true); 58 | } catch (Exception e) { 59 | e.printStackTrace(); 60 | } 61 | } 62 | }); 63 | } 64 | 65 | /** 66 | * Create the frame. 67 | */ 68 | public ReservasView() { 69 | super("Reserva"); 70 | this.reservaController = new ReservasController(); 71 | 72 | setIconImage(Toolkit.getDefaultToolkit().getImage(ReservasView.class.getResource("/imagenes/aH-40px.png"))); 73 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 74 | setBounds(100, 100, 910, 560); 75 | setResizable(false); 76 | contentPane = new JPanel(); 77 | contentPane.setBackground(SystemColor.control); 78 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 79 | setContentPane(contentPane); 80 | contentPane.setLayout(null); 81 | setResizable(false); 82 | setLocationRelativeTo(null); 83 | setUndecorated(true); 84 | 85 | 86 | 87 | JPanel panel = new JPanel(); 88 | panel.setBorder(null); 89 | panel.setBackground(Color.WHITE); 90 | panel.setBounds(0, 0, 910, 560); 91 | contentPane.add(panel); 92 | panel.setLayout(null); 93 | 94 | 95 | JSeparator separator_1_2 = new JSeparator(); 96 | separator_1_2.setForeground(SystemColor.textHighlight); 97 | separator_1_2.setBounds(68, 195, 289, 2); 98 | separator_1_2.setBackground(SystemColor.textHighlight); 99 | panel.add(separator_1_2); 100 | 101 | JSeparator separator_1_3 = new JSeparator(); 102 | separator_1_3.setForeground(SystemColor.textHighlight); 103 | separator_1_3.setBackground(SystemColor.textHighlight); 104 | separator_1_3.setBounds(68, 453, 289, 2); 105 | panel.add(separator_1_3); 106 | 107 | JSeparator separator_1_1 = new JSeparator(); 108 | separator_1_1.setForeground(SystemColor.textHighlight); 109 | separator_1_1.setBounds(68, 281, 289, 11); 110 | separator_1_1.setBackground(SystemColor.textHighlight); 111 | panel.add(separator_1_1); 112 | 113 | txtDataE = new JDateChooser(); 114 | txtDataE.getCalendarButton().setBackground(SystemColor.textHighlight); 115 | txtDataE.getCalendarButton().setIcon(new ImageIcon(ReservasView.class.getResource("/imagenes/icon-reservas.png"))); 116 | txtDataE.getCalendarButton().setFont(new Font("Roboto", Font.PLAIN, 12)); 117 | txtDataE.setBounds(68, 161, 289, 35); 118 | txtDataE.getCalendarButton().setBounds(268, 0, 21, 33); 119 | txtDataE.setBackground(Color.WHITE); 120 | txtDataE.setBorder(new LineBorder(SystemColor.window)); 121 | txtDataE.setDateFormatString("yyyy-MM-dd"); 122 | txtDataE.setFont(new Font("Roboto", Font.PLAIN, 18)); 123 | panel.add(txtDataE); 124 | 125 | lblNewLabel_3 = new JLabel("$"); 126 | lblNewLabel_3.setBounds(121, 332, 17, 25); 127 | lblNewLabel_3.setForeground(SystemColor.textHighlight); 128 | lblNewLabel_3.setFont(new Font("Roboto", Font.BOLD, 17)); 129 | lblNewLabel_3.setEnabled(false); 130 | panel.add(lblNewLabel_3); 131 | 132 | JLabel lblCheckIn = new JLabel("DATA DE CHECK IN"); 133 | lblCheckIn.setForeground(SystemColor.textInactiveText); 134 | lblCheckIn.setBounds(68, 136, 169, 14); 135 | lblCheckIn.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 136 | panel.add(lblCheckIn); 137 | 138 | JLabel lblCheckOut = new JLabel("DATA DE CHECK OUT"); 139 | lblCheckOut.setForeground(SystemColor.textInactiveText); 140 | lblCheckOut.setBounds(68, 221, 187, 14); 141 | lblCheckOut.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 142 | panel.add(lblCheckOut); 143 | 144 | txtDataS = new JDateChooser(); 145 | txtDataS.getCalendarButton().setIcon(new ImageIcon(ReservasView.class.getResource("/imagenes/icon-reservas.png"))); 146 | txtDataS.getCalendarButton().setFont(new Font("Roboto", Font.PLAIN, 11)); 147 | txtDataS.setBounds(68, 246, 289, 35); 148 | txtDataS.getCalendarButton().setBounds(267, 1, 21, 31); 149 | txtDataS.setBackground(Color.WHITE); 150 | txtDataS.setFont(new Font("Roboto", Font.PLAIN, 18)); 151 | txtDataS.addPropertyChangeListener(new PropertyChangeListener() { 152 | public void propertyChange(PropertyChangeEvent evt) { 153 | calcularValor(txtDataE, txtDataS); 154 | lblNewLabel_3.setVisible(true); 155 | } 156 | }); 157 | txtDataS.setDateFormatString("yyyy-MM-dd"); 158 | txtDataS.getCalendarButton().setBackground(SystemColor.textHighlight); 159 | txtDataS.setBorder(new LineBorder(new Color(255, 255, 255), 0)); 160 | panel.add(txtDataS); 161 | 162 | 163 | 164 | txtValor = new JTextField(); 165 | txtValor.setBackground(SystemColor.text); 166 | txtValor.setHorizontalAlignment(SwingConstants.CENTER); 167 | txtValor.setForeground(Color.BLACK); 168 | txtValor.setBounds(78, 328, 43, 33); 169 | txtValor.setEditable(false); 170 | txtValor.setFont(new Font("Roboto Black", Font.BOLD, 17)); 171 | txtValor.setBorder(javax.swing.BorderFactory.createEmptyBorder()); 172 | panel.add(txtValor); 173 | txtValor.setColumns(10); 174 | 175 | JLabel lblValor = new JLabel("VALOR DA RESERVA"); 176 | lblValor.setForeground(SystemColor.textInactiveText); 177 | lblValor.setBounds(72, 303, 196, 14); 178 | lblValor.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 179 | panel.add(lblValor); 180 | 181 | txtFormaPagamento = new JComboBox(); 182 | txtFormaPagamento.setBounds(68, 417, 289, 38); 183 | txtFormaPagamento.setBackground(SystemColor.text); 184 | txtFormaPagamento.setBorder(new LineBorder(new Color(255, 255, 255), 1, true)); 185 | txtFormaPagamento.setFont(new Font("Roboto", Font.PLAIN, 16)); 186 | txtFormaPagamento.setModel(new DefaultComboBoxModel(new String[] {"Cartão de Crédito", "Cartão de Débito", "Dinheiro"})); 187 | panel.add(txtFormaPagamento); 188 | 189 | JLabel lblFormaPagamento = new JLabel("FORMA DE PAGAMENTO"); 190 | lblFormaPagamento.setForeground(SystemColor.textInactiveText); 191 | lblFormaPagamento.setBounds(68, 382, 187, 24); 192 | lblFormaPagamento.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 193 | panel.add(lblFormaPagamento); 194 | 195 | JLabel lblTitulo = new JLabel("SISTEMA DE RESERVAS"); 196 | lblTitulo.setBounds(109, 60, 219, 42); 197 | lblTitulo.setForeground(new Color(12, 138, 199)); 198 | lblTitulo.setFont(new Font("Roboto", Font.BOLD, 20)); 199 | panel.add(lblTitulo); 200 | 201 | JPanel panel_1 = new JPanel(); 202 | panel_1.setBounds(428, 0, 482, 560); 203 | panel_1.setBackground(new Color(12, 138, 199)); 204 | panel.add(panel_1); 205 | panel_1.setLayout(null); 206 | 207 | JLabel logo = new JLabel(""); 208 | logo.setBounds(197, 68, 104, 107); 209 | panel_1.add(logo); 210 | logo.setIcon(new ImageIcon(ReservasView.class.getResource("/imagenes/Ha-100px.png"))); 211 | 212 | JLabel imagemFundo = new JLabel(""); 213 | imagemFundo.setBounds(0, 140, 500, 409); 214 | panel_1.add(imagemFundo); 215 | imagemFundo.setBackground(Color.WHITE); 216 | imagemFundo.setIcon(new ImageIcon(ReservasView.class.getResource("/imagenes/reservas-img-3.png"))); 217 | 218 | JPanel btnexit = new JPanel(); 219 | btnexit.addMouseListener(new MouseAdapter() { 220 | @Override 221 | public void mouseClicked(MouseEvent e) { 222 | MenuPrincipal principal = new MenuPrincipal(); 223 | principal.setVisible(true); 224 | dispose(); 225 | } 226 | @Override 227 | public void mouseEntered(MouseEvent e) { 228 | btnexit.setBackground(Color.red); 229 | labelExit.setForeground(Color.white); 230 | } 231 | @Override 232 | public void mouseExited(MouseEvent e) { 233 | btnexit.setBackground(new Color(12, 138, 199)); 234 | labelExit.setForeground(Color.white); 235 | } 236 | }); 237 | btnexit.setLayout(null); 238 | btnexit.setBackground(new Color(12, 138, 199)); 239 | btnexit.setBounds(429, 0, 53, 36); 240 | panel_1.add(btnexit); 241 | 242 | labelExit = new JLabel("X"); 243 | labelExit.setForeground(Color.WHITE); 244 | labelExit.setBounds(0, 0, 53, 36); 245 | btnexit.add(labelExit); 246 | labelExit.setHorizontalAlignment(SwingConstants.CENTER); 247 | labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); 248 | 249 | JPanel header = new JPanel(); 250 | header.setBounds(0, 0, 910, 36); 251 | header.addMouseMotionListener(new MouseMotionAdapter() { 252 | @Override 253 | public void mouseDragged(MouseEvent e) { 254 | headerMouseDragged(e); 255 | 256 | } 257 | }); 258 | header.addMouseListener(new MouseAdapter() { 259 | @Override 260 | public void mousePressed(MouseEvent e) { 261 | headerMousePressed(e); 262 | } 263 | }); 264 | header.setLayout(null); 265 | header.setBackground(Color.WHITE); 266 | panel.add(header); 267 | 268 | JPanel btnAtras = new JPanel(); 269 | btnAtras.addMouseListener(new MouseAdapter() { 270 | @Override 271 | public void mouseClicked(MouseEvent e) { 272 | MenuUsuario usuario = new MenuUsuario(); 273 | usuario.setVisible(true); 274 | dispose(); 275 | } 276 | @Override 277 | public void mouseEntered(MouseEvent e) { 278 | btnAtras.setBackground(new Color(12, 138, 199)); 279 | labelAtras.setForeground(Color.white); 280 | } 281 | @Override 282 | public void mouseExited(MouseEvent e) { 283 | btnAtras.setBackground(Color.white); 284 | labelAtras.setForeground(Color.black); 285 | } 286 | }); 287 | btnAtras.setLayout(null); 288 | btnAtras.setBackground(Color.WHITE); 289 | btnAtras.setBounds(0, 0, 53, 36); 290 | header.add(btnAtras); 291 | 292 | labelAtras = new JLabel("<"); 293 | labelAtras.setBounds(0, 0, 53, 36); 294 | btnAtras.add(labelAtras); 295 | labelAtras.setHorizontalAlignment(SwingConstants.CENTER); 296 | labelAtras.setFont(new Font("Roboto", Font.PLAIN, 23)); 297 | 298 | JSeparator separator_1 = new JSeparator(); 299 | separator_1.setForeground(SystemColor.textHighlight); 300 | separator_1.setBounds(68, 362, 289, 2); 301 | separator_1.setBackground(SystemColor.textHighlight); 302 | panel.add(separator_1); 303 | 304 | JPanel btnProximo = new JPanel(); 305 | btnProximo.addMouseListener(new MouseAdapter() { 306 | @Override 307 | public void mouseClicked(MouseEvent e) { 308 | if (ReservasView.txtDataE.getDate() != null && ReservasView.txtDataS.getDate() != null) { 309 | salvarReserva(); 310 | } else { 311 | JOptionPane.showMessageDialog(null, "Deve preencher todos os campos."); 312 | } 313 | } 314 | }); 315 | btnProximo.setLayout(null); 316 | btnProximo.setBackground(SystemColor.textHighlight); 317 | btnProximo.setBounds(238, 493, 122, 35); 318 | panel.add(btnProximo); 319 | btnProximo.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 320 | 321 | JLabel lblProximo = new JLabel("PRÓXIMO"); 322 | lblProximo.setHorizontalAlignment(SwingConstants.CENTER); 323 | lblProximo.setForeground(Color.WHITE); 324 | lblProximo.setFont(new Font("Roboto", Font.PLAIN, 18)); 325 | lblProximo.setBounds(0, 0, 122, 35); 326 | btnProximo.add(lblProximo); 327 | } 328 | 329 | private void calcularValor(JDateChooser dataE,JDateChooser dataS) { 330 | if(dataE.getDate() != null && dataS.getDate() !=null) { 331 | Calendar inicio = dataE.getCalendar(); 332 | Calendar fin = dataS.getCalendar(); 333 | int dias = -1; 334 | int diaria = 180; 335 | int valor; 336 | 337 | while(inicio.before(fin)||inicio.equals(fin)) { 338 | dias++; 339 | inicio.add(Calendar.DATE,1); 340 | } 341 | valor = dias * diaria; 342 | txtValor.setText("" + valor); 343 | } 344 | } 345 | 346 | private void salvarReserva() { 347 | try { 348 | String dataE = ((JTextField)txtDataE.getDateEditor().getUiComponent()).getText(); 349 | String dataS = ((JTextField)txtDataS.getDateEditor().getUiComponent()).getText(); 350 | Reserva reserva = new Reserva(Date.valueOf(dataE), Date.valueOf(dataS), ReservasView.txtValor.getText(), ReservasView.txtFormaPagamento.getSelectedItem().toString()); 351 | this.reservasController.salvar(reserva); 352 | RegistroHospede hospede = new RegistroHospede(reserva.getId()); 353 | hospede.setVisible(true); 354 | dispose(); 355 | 356 | } catch (Exception ex) { 357 | JOptionPane.showMessageDialog(contentPane, "Error: " + ex.getMessage(), "Erro", JOptionPane.ERROR_MESSAGE); 358 | } 359 | } 360 | 361 | private void headerMousePressed(java.awt.event.MouseEvent evt) { 362 | xMouse = evt.getX(); 363 | yMouse = evt.getY(); 364 | } 365 | 366 | private void headerMouseDragged(java.awt.event.MouseEvent evt) { 367 | int x = evt.getXOnScreen(); 368 | int y = evt.getYOnScreen(); 369 | this.setLocation(x - xMouse, y - yMouse); 370 | } 371 | } 372 | -------------------------------------------------------------------------------- /src/views/RegistroHospede.java: -------------------------------------------------------------------------------- 1 | package views; 2 | 3 | import java.awt.EventQueue; 4 | import javax.swing.JFrame; 5 | import javax.swing.JPanel; 6 | import javax.swing.border.EmptyBorder; 7 | import javax.swing.JTextField; 8 | import java.awt.Color; 9 | import com.toedter.calendar.JDateChooser; 10 | 11 | import jdbc.controller.HospedesController; 12 | import jdbc.controller.ReservasController; 13 | import jdbc.modelo.Hospedes; 14 | import jdbc.modelo.Reserva; 15 | 16 | import javax.swing.JComboBox; 17 | import javax.swing.DefaultComboBoxModel; 18 | import javax.swing.JLabel; 19 | import javax.swing.JOptionPane; 20 | import java.awt.Font; 21 | import javax.swing.ImageIcon; 22 | import java.awt.SystemColor; 23 | import java.awt.event.MouseAdapter; 24 | import java.awt.event.MouseEvent; 25 | import java.text.Format; 26 | import java.awt.Toolkit; 27 | import javax.swing.SwingConstants; 28 | import javax.swing.JSeparator; 29 | 30 | @SuppressWarnings("serial") 31 | public class RegistroHospede extends JFrame { 32 | 33 | private JPanel contentPane; 34 | private JTextField txtNome; 35 | private JTextField txtSobrenome; 36 | private JTextField txtTelefone; 37 | private JTextField txtNreserva; 38 | private JDateChooser txtDataN; 39 | private JComboBox txtNacionalidade; 40 | private HospedesController hospedesController; 41 | private ReservasController reservasController; 42 | private JLabel labelExit; 43 | private JLabel labelAtras; 44 | int xMouse, yMouse; 45 | int id; 46 | 47 | /** 48 | * Launch the application. 49 | */ 50 | public static void main(String[] args) { 51 | EventQueue.invokeLater(new Runnable() { 52 | public void run() { 53 | try { 54 | RegistroHospede frame = new RegistroHospede(0); 55 | frame.setVisible(true); 56 | } catch (Exception e) { 57 | e.printStackTrace(); 58 | } 59 | } 60 | }); 61 | } 62 | 63 | /** 64 | * Create the frame. 65 | */ 66 | public RegistroHospede(int idReserva) { 67 | this.hospedesController = new HospedesController(); 68 | this.reservasController = new ReservasController(); 69 | 70 | 71 | setIconImage(Toolkit.getDefaultToolkit().getImage(RegistroHospede.class.getResource("/imagenes/lOGO-50PX.png"))); 72 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 73 | setBounds(100, 100, 910, 634); 74 | contentPane = new JPanel(); 75 | contentPane.setBackground(SystemColor.text); 76 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 77 | setContentPane(contentPane); 78 | setLocationRelativeTo(null); 79 | setUndecorated(true); 80 | contentPane.setLayout(null); 81 | 82 | 83 | JPanel header = new JPanel(); 84 | header.setLayout(null); 85 | header.setBackground(SystemColor.text); 86 | header.setOpaque(false); 87 | header.setBounds(0, 0, 910, 36); 88 | contentPane.add(header); 89 | 90 | JPanel btnAtras = new JPanel(); 91 | btnAtras.addMouseListener(new MouseAdapter() { 92 | @Override 93 | public void mouseClicked(MouseEvent e) { 94 | ReservasView reservas = new ReservasView(); 95 | reservas.setVisible(true); 96 | dispose(); 97 | } 98 | @Override 99 | public void mouseEntered(MouseEvent e) { 100 | btnAtras.setBackground(Color.white); 101 | labelAtras.setForeground(Color.black); 102 | } 103 | @Override 104 | public void mouseExited(MouseEvent e) { 105 | btnAtras.setBackground(new Color(12, 138, 199)); 106 | labelAtras.setForeground(Color.white); 107 | } 108 | }); 109 | btnAtras.setLayout(null); 110 | btnAtras.setBackground(new Color(12, 138, 199)); 111 | btnAtras.setBounds(0, 0, 53, 36); 112 | header.add(btnAtras); 113 | 114 | labelAtras = new JLabel("<"); 115 | labelAtras.setHorizontalAlignment(SwingConstants.CENTER); 116 | labelAtras.setForeground(Color.WHITE); 117 | labelAtras.setFont(new Font("Roboto", Font.PLAIN, 23)); 118 | labelAtras.setBounds(0, 0, 53, 36); 119 | btnAtras.add(labelAtras); 120 | 121 | 122 | txtNome = new JTextField(); 123 | txtNome.setFont(new Font("Roboto", Font.PLAIN, 16)); 124 | txtNome.setBounds(560, 135, 285, 33); 125 | txtNome.setBackground(Color.WHITE); 126 | txtNome.setColumns(10); 127 | txtNome.setBorder(javax.swing.BorderFactory.createEmptyBorder()); 128 | contentPane.add(txtNome); 129 | 130 | txtSobrenome = new JTextField(); 131 | txtSobrenome.setFont(new Font("Roboto", Font.PLAIN, 16)); 132 | txtSobrenome.setBounds(560, 204, 285, 33); 133 | txtSobrenome.setColumns(10); 134 | txtSobrenome.setBackground(Color.WHITE); 135 | txtSobrenome.setBorder(javax.swing.BorderFactory.createEmptyBorder()); 136 | contentPane.add(txtSobrenome); 137 | 138 | txtDataN = new JDateChooser(); 139 | txtDataN.setBounds(560, 278, 285, 36); 140 | txtDataN.getCalendarButton().setIcon(new ImageIcon(RegistroHospede.class.getResource("/imagenes/icon-reservas.png"))); 141 | txtDataN.getCalendarButton().setBackground(SystemColor.textHighlight); 142 | txtDataN.setDateFormatString("yyyy-MM-dd"); 143 | contentPane.add(txtDataN); 144 | 145 | txtNacionalidade = new JComboBox(); 146 | txtNacionalidade.setBounds(560, 350, 289, 36); 147 | txtNacionalidade.setBackground(SystemColor.text); 148 | txtNacionalidade.setFont(new Font("Roboto", Font.PLAIN, 16)); 149 | txtNacionalidade.setModel(new DefaultComboBoxModel(new String[] {"afegão-afegã", "alemão-", "alemã", "árabe-árabe", "argentino-argentina", "australiano-australiana", "belga-belga", "boliviano-boliviana", "brasileiro-brasileira", "cambojano-cambojana", "canadense-canadense", "chileno-chilena", "chinês-chinesa", "colombiano-colombiana", "coreano-coreana", "costa-riquenho-costa-riquenha", "cubano-cubana", "dinamarquês-dinamarquesa", "equatoriano-equatoriana", "egípcio-egípcia", "salvadorenho-salvadorenha", "escocês-escocesa", "espanhol-espanhola", "estadounidense-estadounidense", "estoniano-estoniana", "etíope-etíope", "filipino-filipina", "finlandês-finlandesa", "francês-francesa", "galês-galesa", "grego-grega", "guatemalteco-guatemalteca", "haitiano-haitiana", "holandês-holandesa", "hondurenho-hondurenha", "indonésio-indonésia", "inglês-inglesa", "iraquiano-iraquiana", "iraniano-iraniana", "irlandês-irlandesa", "israelita-israelita", "italiano-italiana", "japonês-japonesa", "jordaniano-jordaniana", "laosiano-laosiana", "letão-letã", "libanês-libanesa", "maliano-maliana", "marroquino-marroquina", "mexicano-mexicana", "nicaraguense-nicaraguense", "norueguês-norueguesa", "neozelandês-neozelandesa", "panamenho-panamenha", "paraguaio-paraguaia", "peruano-peruana", "polonês-polonesa", "português-portuguesa", "portorriquenho-portorriquenha", "dominicano-dominicana", "romeno-romena", "russo-russa", "sueco-sueca", "suíço-suíça", "tailandês-tailandesa", "taiwanês-taiwanesa", "turco-turca", "ucraniano-ucraniana", "uruguaio-uruguaia", "venezuelano-venezuelana", "vietnamita-vietnamita"})); 150 | contentPane.add(txtNacionalidade); 151 | 152 | JLabel lblNome = new JLabel("NOME"); 153 | lblNome.setBounds(562, 119, 253, 14); 154 | lblNome.setForeground(SystemColor.textInactiveText); 155 | lblNome.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 156 | contentPane.add(lblNome); 157 | 158 | JLabel lblSobrenome = new JLabel("SOBRENOME"); 159 | lblSobrenome.setBounds(560, 189, 255, 14); 160 | lblSobrenome.setForeground(SystemColor.textInactiveText); 161 | lblSobrenome.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 162 | contentPane.add(lblSobrenome); 163 | 164 | JLabel lblNascimento = new JLabel("DATA DE NASCIMENTO"); 165 | lblNascimento.setBounds(560, 256, 255, 14); 166 | lblNascimento.setForeground(SystemColor.textInactiveText); 167 | lblNascimento.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 168 | contentPane.add(lblNascimento); 169 | 170 | JLabel lblNacionalidade = new JLabel("NACIONALIDADE"); 171 | lblNacionalidade.setBounds(560, 326, 255, 14); 172 | lblNacionalidade.setForeground(SystemColor.textInactiveText); 173 | lblNacionalidade.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 174 | contentPane.add(lblNacionalidade); 175 | 176 | JLabel lblTelefone = new JLabel("TELEFONE"); 177 | lblTelefone.setBounds(562, 406, 253, 14); 178 | lblTelefone.setForeground(SystemColor.textInactiveText); 179 | lblTelefone.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 180 | contentPane.add(lblTelefone); 181 | 182 | txtTelefone = new JTextField(); 183 | txtTelefone.setFont(new Font("Roboto", Font.PLAIN, 16)); 184 | txtTelefone.setBounds(560, 424, 285, 33); 185 | txtTelefone.setColumns(10); 186 | txtTelefone.setBackground(Color.WHITE); 187 | txtTelefone.setBorder(javax.swing.BorderFactory.createEmptyBorder()); 188 | contentPane.add(txtTelefone); 189 | 190 | JLabel lblNewLabel_4 = new JLabel("REGISTRO HÓSPEDE"); 191 | lblNewLabel_4.setBounds(606, 55, 234, 42); 192 | lblNewLabel_4.setForeground(new Color(12, 138, 199)); 193 | lblNewLabel_4.setFont(new Font("Roboto Black", Font.PLAIN, 23)); 194 | contentPane.add(lblNewLabel_4); 195 | 196 | JLabel lblNreserva = new JLabel("NÚMERO DE RESERVA"); 197 | lblNreserva.setBounds(560, 474, 253, 14); 198 | lblNreserva.setForeground(SystemColor.textInactiveText); 199 | lblNreserva.setFont(new Font("Roboto Black", Font.PLAIN, 18)); 200 | contentPane.add(lblNreserva); 201 | 202 | txtNreserva = new JTextField(); 203 | 204 | txtNreserva.setFont(new Font("Roboto", Font.PLAIN, 16)); 205 | txtNreserva.setBounds(560, 495, 285, 33); 206 | txtNreserva.setColumns(10); 207 | txtNreserva.setBackground(Color.WHITE); 208 | txtNreserva.setBorder(javax.swing.BorderFactory.createEmptyBorder()); 209 | txtNreserva.setEditable(false); 210 | System.out.println(idReserva); 211 | String id = String.valueOf(idReserva); 212 | txtNreserva.setText(id); 213 | contentPane.add(txtNreserva); 214 | 215 | 216 | 217 | JSeparator separator_1_2 = new JSeparator(); 218 | separator_1_2.setBounds(560, 170, 289, 2); 219 | separator_1_2.setForeground(new Color(12, 138, 199)); 220 | separator_1_2.setBackground(new Color(12, 138, 199)); 221 | contentPane.add(separator_1_2); 222 | 223 | JSeparator separator_1_2_1 = new JSeparator(); 224 | separator_1_2_1.setBounds(560, 240, 289, 2); 225 | separator_1_2_1.setForeground(new Color(12, 138, 199)); 226 | separator_1_2_1.setBackground(new Color(12, 138, 199)); 227 | contentPane.add(separator_1_2_1); 228 | 229 | JSeparator separator_1_2_2 = new JSeparator(); 230 | separator_1_2_2.setBounds(560, 314, 289, 2); 231 | separator_1_2_2.setForeground(new Color(12, 138, 199)); 232 | separator_1_2_2.setBackground(new Color(12, 138, 199)); 233 | contentPane.add(separator_1_2_2); 234 | 235 | JSeparator separator_1_2_3 = new JSeparator(); 236 | separator_1_2_3.setBounds(560, 386, 289, 2); 237 | separator_1_2_3.setForeground(new Color(12, 138, 199)); 238 | separator_1_2_3.setBackground(new Color(12, 138, 199)); 239 | contentPane.add(separator_1_2_3); 240 | 241 | JSeparator separator_1_2_4 = new JSeparator(); 242 | separator_1_2_4.setBounds(560, 457, 289, 2); 243 | separator_1_2_4.setForeground(new Color(12, 138, 199)); 244 | separator_1_2_4.setBackground(new Color(12, 138, 199)); 245 | contentPane.add(separator_1_2_4); 246 | 247 | JSeparator separator_1_2_5 = new JSeparator(); 248 | separator_1_2_5.setBounds(560, 529, 289, 2); 249 | separator_1_2_5.setForeground(new Color(12, 138, 199)); 250 | separator_1_2_5.setBackground(new Color(12, 138, 199)); 251 | contentPane.add(separator_1_2_5); 252 | 253 | JPanel btnSalvar = new JPanel(); 254 | btnSalvar.setBounds(723, 560, 122, 35); 255 | btnSalvar.addMouseListener(new MouseAdapter() { 256 | @Override 257 | public void mouseClicked(MouseEvent e) { 258 | salvarHospede(); 259 | } 260 | }); 261 | btnSalvar.setLayout(null); 262 | btnSalvar.setBackground(new Color(12, 138, 199)); 263 | contentPane.add(btnSalvar); 264 | btnSalvar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 265 | 266 | JLabel labelSalvar = new JLabel("SALVAR"); 267 | labelSalvar.setHorizontalAlignment(SwingConstants.CENTER); 268 | labelSalvar.setForeground(Color.WHITE); 269 | labelSalvar.setFont(new Font("Roboto", Font.PLAIN, 18)); 270 | labelSalvar.setBounds(0, 0, 122, 35); 271 | btnSalvar.add(labelSalvar); 272 | 273 | JPanel panel = new JPanel(); 274 | panel.setBounds(0, 0, 489, 634); 275 | panel.setBackground(new Color(12, 138, 199)); 276 | contentPane.add(panel); 277 | panel.setLayout(null); 278 | 279 | JLabel imagemFundo = new JLabel(""); 280 | imagemFundo.setBounds(0, 121, 479, 502); 281 | panel.add(imagemFundo); 282 | imagemFundo.setIcon(new ImageIcon(RegistroHospede.class.getResource("/imagenes/registro.png"))); 283 | 284 | JLabel logo = new JLabel(""); 285 | logo.setBounds(194, 39, 104, 107); 286 | panel.add(logo); 287 | logo.setIcon(new ImageIcon(RegistroHospede.class.getResource("/imagenes/Ha-100px.png"))); 288 | 289 | JPanel btnexit = new JPanel(); 290 | btnexit.setBounds(857, 0, 53, 36); 291 | contentPane.add(btnexit); 292 | btnexit.addMouseListener(new MouseAdapter() { 293 | @Override 294 | public void mouseClicked(MouseEvent e) { 295 | MenuPrincipal principal = new MenuPrincipal(); 296 | principal.setVisible(true); 297 | dispose(); 298 | } 299 | @Override 300 | public void mouseEntered(MouseEvent e) { 301 | btnexit.setBackground(Color.red); 302 | labelExit.setForeground(Color.white); 303 | } 304 | @Override 305 | public void mouseExited(MouseEvent e) { 306 | btnexit.setBackground(Color.white); 307 | labelExit.setForeground(Color.black); 308 | } 309 | }); 310 | btnexit.setLayout(null); 311 | btnexit.setBackground(Color.white); 312 | 313 | labelExit = new JLabel("X"); 314 | labelExit.setBounds(0, 0, 53, 36); 315 | btnexit.add(labelExit); 316 | labelExit.setHorizontalAlignment(SwingConstants.CENTER); 317 | labelExit.setForeground(SystemColor.black); 318 | labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); 319 | } 320 | 321 | 322 | private void salvarHospede() { 323 | 324 | if (txtDataN.getDate() != null && !txtNome.equals("") && !txtSobrenome.equals("") && !txtTelefone.equals("")) { 325 | String dataNascimento = ((JTextField) txtDataN.getDateEditor().getUiComponent()).getText(); 326 | int nreserva = Integer.parseInt(txtNreserva.getText()); 327 | Hospedes hospedes = new Hospedes(txtNome.getText(), txtSobrenome.getText(), java.sql.Date.valueOf(dataNascimento), txtNacionalidade.getSelectedItem().toString(), txtTelefone.getText(), nreserva); 328 | this.hospedesController.salvar(hospedes); 329 | Sucesso sucesso = new Sucesso(); 330 | sucesso.setVisible(true); 331 | dispose(); 332 | } else { 333 | JOptionPane.showMessageDialog(this, "Você deve preencher todos os campos."); 334 | } 335 | } 336 | 337 | } 338 | -------------------------------------------------------------------------------- /src/views/Busca.java: -------------------------------------------------------------------------------- 1 | package views; 2 | 3 | import java.awt.EventQueue; 4 | import javax.swing.JFrame; 5 | import javax.swing.JPanel; 6 | import javax.swing.border.EmptyBorder; 7 | import javax.swing.table.DefaultTableModel; 8 | 9 | import jdbc.controller.HospedesController; 10 | import jdbc.controller.ReservasController; 11 | import jdbc.modelo.Hospedes; 12 | import jdbc.modelo.Reserva; 13 | import javax.swing.JTable; 14 | import javax.swing.JTextField; 15 | import javax.swing.ImageIcon; 16 | import java.awt.Color; 17 | import javax.swing.JLabel; 18 | import javax.swing.JOptionPane; 19 | 20 | import java.awt.Font; 21 | import java.sql.Date; 22 | import java.util.List; 23 | import javax.swing.JTabbedPane; 24 | import java.awt.Toolkit; 25 | import javax.swing.SwingConstants; 26 | import javax.swing.JSeparator; 27 | import java.awt.event.MouseAdapter; 28 | import java.awt.event.MouseEvent; 29 | import java.awt.event.MouseMotionAdapter; 30 | import java.util.Optional; 31 | import javax.swing.JScrollPane; 32 | 33 | @SuppressWarnings("serial") 34 | public class Busca extends JFrame { 35 | 36 | private JPanel contentPane; 37 | private JTextField txtBuscar; 38 | private JTable tbHospedes; 39 | private JTable tbReservas; 40 | private DefaultTableModel modelo; 41 | private DefaultTableModel modeloHospede; 42 | private ReservasController reservaController; 43 | private HospedesController hospedesController; 44 | private JLabel labelAtras; 45 | private JLabel labelExit; 46 | int xMouse, yMouse; 47 | String reserva; 48 | String hospedes; 49 | 50 | /** 51 | * Launch the application. 52 | */ 53 | public static void main(String[] args) { 54 | EventQueue.invokeLater(new Runnable() { 55 | public void run() { 56 | try { 57 | Busca frame = new Busca(); 58 | frame.setVisible(true); 59 | } catch (Exception e) { 60 | e.printStackTrace(); 61 | } 62 | } 63 | }); 64 | } 65 | 66 | /** 67 | * Create the frame. 68 | */ 69 | public Busca() { 70 | this.reservaController = new ReservasController(); 71 | this.hospedesController = new HospedesController(); 72 | setIconImage(Toolkit.getDefaultToolkit().getImage(Busca.class.getResource("/imagenes/lupa2.png"))); 73 | setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 74 | setBounds(100, 100, 910, 571); 75 | contentPane = new JPanel(); 76 | contentPane.setBackground(Color.WHITE); 77 | contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); 78 | setContentPane(contentPane); 79 | setLocationRelativeTo(null); 80 | setUndecorated(true); 81 | contentPane.setLayout(null); 82 | JScrollPane scrollPane = new JScrollPane(tbReservas); 83 | 84 | 85 | 86 | txtBuscar = new JTextField(); 87 | txtBuscar.setBounds(536, 127, 193, 31); 88 | txtBuscar.setBorder(javax.swing.BorderFactory.createEmptyBorder()); 89 | contentPane.add(txtBuscar); 90 | txtBuscar.setColumns(10); 91 | 92 | 93 | JLabel lblTitulo = new JLabel("SISTEMA DE BUSCA"); 94 | lblTitulo.setBounds(331, 62, 280, 42); 95 | lblTitulo.setForeground(new Color(12, 138, 199)); 96 | lblTitulo.setFont(new Font("Roboto Black", Font.BOLD, 24)); 97 | contentPane.add(lblTitulo); 98 | 99 | JTabbedPane panel = new JTabbedPane(JTabbedPane.TOP); 100 | panel.setBounds(20, 169, 865, 328); 101 | panel.setBackground(new Color(12, 138, 199)); 102 | panel.setFont(new Font("Roboto", Font.PLAIN, 16)); 103 | contentPane.add(panel); 104 | 105 | 106 | 107 | tbHospedes = new JTable(); 108 | tbHospedes.setFont(new Font("Roboto", Font.PLAIN, 16)); 109 | panel.addTab("Hóspedes", new ImageIcon(Busca.class.getResource("/imagenes/pessoas.png")), tbHospedes, null); 110 | modeloHospede = (DefaultTableModel) tbHospedes.getModel(); 111 | modeloHospede.addColumn("Numero de Hóspede"); 112 | modeloHospede.addColumn("Nome"); 113 | modeloHospede.addColumn("Sobrenome"); 114 | modeloHospede.addColumn("Data de Nascimento"); 115 | modeloHospede.addColumn("Nacionalidade"); 116 | modeloHospede.addColumn("Telefone"); 117 | modeloHospede.addColumn("Numero de Reserva"); 118 | preencherTabelaHospedes(); 119 | 120 | 121 | 122 | 123 | tbReservas = new JTable(); 124 | tbReservas.setFont(new Font("Roboto", Font.PLAIN, 16)); 125 | panel.addTab("Reservas", new ImageIcon(Busca.class.getResource("/imagenes/reservado.png")), tbReservas, null); 126 | modelo = (DefaultTableModel) tbReservas.getModel(); 127 | modelo.addColumn("Numero de Reserva"); 128 | modelo.addColumn("Data Check In"); 129 | modelo.addColumn("Data Check Out"); 130 | modelo.addColumn("Valor"); 131 | modelo.addColumn("Forma de Pagamento"); 132 | tbReservas.setAutoResizeMode(JTable.AUTO_RESIZE_ALL_COLUMNS); 133 | 134 | preencherTabelaReservas(); 135 | 136 | JLabel logo = new JLabel(""); 137 | logo.setBounds(56, 51, 104, 107); 138 | logo.setIcon(new ImageIcon(Busca.class.getResource("/imagenes/Ha-100px.png"))); 139 | contentPane.add(logo); 140 | 141 | JPanel header = new JPanel(); 142 | header.setBounds(0, 0, 910, 36); 143 | header.addMouseMotionListener(new MouseMotionAdapter() { 144 | @Override 145 | public void mouseDragged(MouseEvent e) { 146 | headerMouseDragged(e); 147 | 148 | } 149 | }); 150 | header.addMouseListener(new MouseAdapter() { 151 | @Override 152 | public void mousePressed(MouseEvent e) { 153 | headerMousePressed(e); 154 | } 155 | }); 156 | header.setLayout(null); 157 | header.setBackground(Color.WHITE); 158 | contentPane.add(header); 159 | 160 | JPanel btnAtras = new JPanel(); 161 | btnAtras.addMouseListener(new MouseAdapter() { 162 | @Override 163 | public void mouseClicked(MouseEvent e) { 164 | MenuUsuario usuario = new MenuUsuario(); 165 | usuario.setVisible(true); 166 | dispose(); 167 | } 168 | @Override 169 | public void mouseEntered(MouseEvent e) { 170 | btnAtras.setBackground(new Color(12, 138, 199)); 171 | labelAtras.setForeground(Color.white); 172 | } 173 | @Override 174 | public void mouseExited(MouseEvent e) { 175 | btnAtras.setBackground(Color.white); 176 | labelAtras.setForeground(Color.black); 177 | } 178 | }); 179 | btnAtras.setLayout(null); 180 | btnAtras.setBackground(Color.WHITE); 181 | btnAtras.setBounds(0, 0, 53, 36); 182 | header.add(btnAtras); 183 | 184 | labelAtras = new JLabel("<"); 185 | labelAtras.setHorizontalAlignment(SwingConstants.CENTER); 186 | labelAtras.setFont(new Font("Roboto", Font.PLAIN, 23)); 187 | labelAtras.setBounds(0, 0, 53, 36); 188 | btnAtras.add(labelAtras); 189 | 190 | JPanel btnexit = new JPanel(); 191 | btnexit.addMouseListener(new MouseAdapter() { 192 | @Override 193 | public void mouseClicked(MouseEvent e) { 194 | MenuUsuario usuario = new MenuUsuario(); 195 | usuario.setVisible(true); 196 | dispose(); 197 | } 198 | @Override 199 | public void mouseEntered(MouseEvent e) { 200 | btnexit.setBackground(Color.red); 201 | labelExit.setForeground(Color.white); 202 | } 203 | @Override 204 | public void mouseExited(MouseEvent e) { 205 | btnexit.setBackground(Color.white); 206 | labelExit.setForeground(Color.black); 207 | } 208 | }); 209 | btnexit.setLayout(null); 210 | btnexit.setBackground(Color.WHITE); 211 | btnexit.setBounds(857, 0, 53, 36); 212 | header.add(btnexit); 213 | 214 | labelExit = new JLabel("X"); 215 | labelExit.setHorizontalAlignment(SwingConstants.CENTER); 216 | labelExit.setForeground(Color.BLACK); 217 | labelExit.setFont(new Font("Roboto", Font.PLAIN, 18)); 218 | labelExit.setBounds(0, 0, 53, 36); 219 | btnexit.add(labelExit); 220 | 221 | JSeparator separator_1_2 = new JSeparator(); 222 | separator_1_2.setBounds(539, 159, 193, 2); 223 | separator_1_2.setForeground(new Color(12, 138, 199)); 224 | separator_1_2.setBackground(new Color(12, 138, 199)); 225 | contentPane.add(separator_1_2); 226 | 227 | JPanel btnbuscar = new JPanel(); 228 | btnbuscar.setBounds(748, 125, 122, 35); 229 | btnbuscar.addMouseListener(new MouseAdapter() { 230 | @Override 231 | public void mouseClicked(MouseEvent e) { 232 | limparTabela(); 233 | preencherTabelaReservasId(); 234 | preencherTabelaHospedesId(); 235 | } 236 | }); 237 | btnbuscar.setLayout(null); 238 | btnbuscar.setBackground(new Color(12, 138, 199)); 239 | btnbuscar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 240 | contentPane.add(btnbuscar); 241 | 242 | JLabel lblBuscar = new JLabel("BUSCAR"); 243 | lblBuscar.setBounds(0, 0, 122, 35); 244 | btnbuscar.add(lblBuscar); 245 | lblBuscar.setHorizontalAlignment(SwingConstants.CENTER); 246 | lblBuscar.setForeground(Color.WHITE); 247 | lblBuscar.setFont(new Font("Roboto", Font.PLAIN, 18)); 248 | 249 | JPanel btnEditar = new JPanel(); 250 | btnEditar.addMouseListener(new MouseAdapter() { 251 | @Override 252 | public void mouseClicked(MouseEvent e) { 253 | atualizarReservas(); 254 | limparTabela(); 255 | preencherTabelaReservas(); 256 | } 257 | }); 258 | btnEditar.setBounds(635, 508, 122, 35); 259 | btnEditar.setLayout(null); 260 | btnEditar.setBackground(new Color(12, 138, 199)); 261 | btnEditar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 262 | contentPane.add(btnEditar); 263 | 264 | JLabel lblEditar = new JLabel("EDITAR"); 265 | lblEditar.setHorizontalAlignment(SwingConstants.CENTER); 266 | lblEditar.setForeground(Color.WHITE); 267 | lblEditar.setFont(new Font("Roboto", Font.PLAIN, 18)); 268 | lblEditar.setBounds(0, 0, 122, 35); 269 | btnEditar.add(lblEditar); 270 | 271 | JPanel btnEliminar = new JPanel(); 272 | btnEliminar.setBounds(767, 508, 122, 35); 273 | btnEliminar.addMouseListener(new MouseAdapter() { 274 | @Override 275 | public void mouseClicked(MouseEvent e) { 276 | int filaReservas = tbReservas.getSelectedRow(); 277 | int filaHospedes = tbHospedes.getSelectedRow(); 278 | 279 | if (filaReservas >= 0) { 280 | 281 | reserva = tbReservas.getValueAt(filaReservas, 0).toString(); 282 | int confirmar = JOptionPane.showConfirmDialog(null, "¿Deseja excluir os dados?"); 283 | 284 | if(confirmar == JOptionPane.YES_OPTION){ 285 | 286 | String valor = tbReservas.getValueAt(filaReservas, 0).toString(); 287 | reservaController.deletar(Integer.valueOf(valor)); 288 | JOptionPane.showMessageDialog(contentPane, "Registro Excluído"); 289 | limparTabela(); 290 | preencherTabelaReservas(); 291 | } 292 | } 293 | 294 | if (filaHospedes >= 0) { 295 | 296 | hospedes = tbHospedes.getValueAt(filaHospedes, 0).toString(); 297 | int confirmarh = JOptionPane.showConfirmDialog(null, "¿Deseja excluir os dados?"); 298 | 299 | if(confirmarh == JOptionPane.YES_OPTION){ 300 | 301 | String valor = tbHospedes.getValueAt(filaHospedes, 0).toString(); 302 | hospedesController.deletar(Integer.valueOf(valor)); 303 | JOptionPane.showMessageDialog(contentPane, "Registro Excluído"); 304 | limparTabela(); 305 | preencherTabelaHospedes(); 306 | preencherTabelaReservas(); 307 | } 308 | }else { 309 | JOptionPane.showMessageDialog(null, "Erro: fileira não selecionada, por favor realize uma busca e selecione uma fileira para excluir"); 310 | } 311 | } 312 | }); 313 | btnEliminar.setLayout(null); 314 | btnEliminar.setBackground(new Color(12, 138, 199)); 315 | btnEliminar.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR)); 316 | contentPane.add(btnEliminar); 317 | 318 | JLabel lblEliminar = new JLabel("EXCLUIR"); 319 | lblEliminar.setHorizontalAlignment(SwingConstants.CENTER); 320 | lblEliminar.setForeground(Color.WHITE); 321 | lblEliminar.setFont(new Font("Roboto", Font.PLAIN, 18)); 322 | lblEliminar.setBounds(0, 0, 122, 35); 323 | btnEliminar.add(lblEliminar); 324 | setResizable(false); 325 | } 326 | private List buscarReservas() { 327 | return this.reservaController.buscar(); 328 | } 329 | 330 | private List buscarReservasId() { 331 | return this.reservaController.buscarId(txtBuscar.getText()); 332 | } 333 | private List buscarHospedes() { 334 | return this.hospedesController.listarHospedes(); 335 | } 336 | 337 | private List BuscarHospedesId() { 338 | return this.hospedesController.listarHospedesId(txtBuscar.getText()); 339 | } 340 | 341 | private void limparTabela() { 342 | ((DefaultTableModel) tbHospedes.getModel()).setRowCount(0); 343 | ((DefaultTableModel) tbReservas.getModel()).setRowCount(0); 344 | } 345 | private void preencherTabelaReservas() { 346 | 347 | // Povoar tabela 348 | List reservaLista = buscarReservas(); 349 | try { 350 | for (Reserva reserva : reservaLista) { 351 | modelo.addRow(new Object[] { reserva.getId(), reserva.getDataEntrada(), reserva.getDataSaida(), reserva.getValor(), reserva.getFormaPagamento() }); 352 | } 353 | } catch (Exception e) { 354 | throw e; 355 | } 356 | } 357 | 358 | private void preencherTabelaReservasId() { 359 | 360 | // Povoar tabela 361 | List reservaLista = buscarReservasId(); 362 | try { 363 | for (Reserva reserva : reservaLista) { 364 | modelo.addRow(new Object[] { reserva.getId(), reserva.getDataEntrada(), reserva.getDataSaida(), reserva.getValor(), reserva.getFormaPagamento() }); 365 | } 366 | } catch (Exception e) { 367 | throw e; 368 | } 369 | } 370 | 371 | private void preencherTabelaHospedes() { 372 | //Preencher Tabela 373 | List hospedesLista = buscarHospedes(); 374 | try { 375 | for (Hospedes hospede : hospedesLista) { 376 | modeloHospede.addRow(new Object[] { hospede.getId(), hospede.getNome(), hospede.getSobrenome(), hospede.getDataNascimento(), hospede.getNacionalidade(), hospede.getTelefone(), hospede.getIdReserva() }); 377 | } 378 | } catch (Exception e) { 379 | throw e; 380 | } 381 | } 382 | 383 | private void preencherTabelaHospedesId() { 384 | //Preencher Tabela 385 | List hospedesLista = BuscarHospedesId(); 386 | try { 387 | for (Hospedes hospede : hospedesLista) { 388 | modeloHospede.addRow(new Object[] { hospede.getId(), hospede.getNome(), hospede.getSobrenome(), hospede.getDataNascimento(), hospede.getNacionalidade(), hospede.getTelefone(), hospede.getIdReserva() }); 389 | } 390 | } catch (Exception e) { 391 | throw e; 392 | } 393 | } 394 | 395 | private void atualizarReservas() { 396 | 397 | Optional.ofNullable(modelo.getValueAt(tbReservas.getSelectedRow(), tbReservas.getSelectedColumn())) 398 | .ifPresentOrElse(fila -> { 399 | 400 | Date dataEntrada = Date.valueOf(modelo.getValueAt(tbReservas.getSelectedRow(), 1).toString()); 401 | Date dataSaida = Date.valueOf(modelo.getValueAt(tbReservas.getSelectedRow(), 2).toString()); 402 | String valor = (String) modelo.getValueAt(tbReservas.getSelectedRow(), 3); 403 | String formaPagamento = (String) modelo.getValueAt(tbReservas.getSelectedRow(), 4); 404 | Integer id = Integer.valueOf(modelo.getValueAt(tbReservas.getSelectedRow(), 0).toString()); 405 | this.reservaController.atualizar(dataEntrada,dataSaida, valor, formaPagamento, id); 406 | JOptionPane.showMessageDialog(this, String.format("Registro modificado com êxito")); 407 | }, () -> JOptionPane.showMessageDialog(this, "Por favor, escolha um registro")); 408 | } 409 | 410 | private void atualizarHospede() { 411 | Optional.ofNullable(modeloHospede.getValueAt(tbHospedes.getSelectedRow(), tbHospedes.getSelectedColumn())) 412 | .ifPresentOrElse(filaHuesped -> { 413 | 414 | String nome = (String) modeloHospede.getValueAt(tbHospedes.getSelectedRow(), 1); 415 | String sobrenome = (String) modeloHospede.getValueAt(tbHospedes.getSelectedRow(), 2); 416 | Date dataNascimento = Date.valueOf(modeloHospede.getValueAt(tbHospedes.getSelectedRow(), 3).toString()); 417 | String nacionalidade = (String) modeloHospede.getValueAt(tbHospedes.getSelectedRow(), 4); 418 | String telefone = (String) modeloHospede.getValueAt(tbHospedes.getSelectedRow(), 5); 419 | Integer idReserva = Integer.valueOf(modeloHospede.getValueAt(tbHospedes.getSelectedRow(), 6).toString()); 420 | Integer id = Integer.valueOf(modeloHospede.getValueAt(tbHospedes.getSelectedRow(), 0).toString()); 421 | this.hospedesController.atualizar(nome,sobrenome,dataNascimento, nacionalidade, telefone, idReserva, id); 422 | JOptionPane.showMessageDialog(this, String.format("Registro modificado com êxito")); 423 | }, () -> JOptionPane.showMessageDialog(this, "Por favor, escolha um registro")); 424 | 425 | } 426 | 427 | private void headerMousePressed(java.awt.event.MouseEvent evt) { 428 | xMouse = evt.getX(); 429 | yMouse = evt.getY(); 430 | } 431 | 432 | private void headerMouseDragged(java.awt.event.MouseEvent evt) { 433 | int x = evt.getXOnScreen(); 434 | int y = evt.getYOnScreen(); 435 | this.setLocation(x - xMouse, y - yMouse); 436 | } 437 | } 438 | --------------------------------------------------------------------------------