Search in sources :

Example 16 with RelatorioMudancas

use of br.senac.tads3.pi03b.gruposete.models.RelatorioMudancas in project Loja_Agencia_De_Viagens by ArtCouSan.

the class ExcluiClienteServlet method doGet.

@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String action = request.getParameter("action");
    ClienteDAO daoCliente = new ClienteDAO();
    RelatorioDAO relatorioDAO = new RelatorioDAO();
    RelatorioMudancas relatorio = new RelatorioMudancas();
    if ("delete".equalsIgnoreCase(action)) {
        int id = Integer.parseInt(request.getParameter("id"));
        try {
            daoCliente.excluir(id);
            HttpSession sessao = request.getSession();
            int identificacaoF = (int) sessao.getAttribute("id_func");
            relatorio.setId_func(identificacaoF);
            relatorio.setMudanca("Exclusão de cliente efetuada!");
            relatorioDAO.inserir(relatorio);
            RequestDispatcher dispatcher = request.getRequestDispatcher("WEB-INF/jsp/BuscaCliente.jsp");
            dispatcher.forward(request, response);
        } catch (SQLException | ClassNotFoundException ex) {
            Logger.getLogger(ExcluiClienteServlet.class.getName()).log(Level.SEVERE, null, ex);
        } catch (Exception ex) {
            Logger.getLogger(ExcluiClienteServlet.class.getName()).log(Level.SEVERE, null, ex);
        }
    }
}
Also used : SQLException(java.sql.SQLException) ClienteDAO(br.senac.tads3.pi03b.gruposete.dao.ClienteDAO) HttpSession(javax.servlet.http.HttpSession) RelatorioDAO(br.senac.tads3.pi03b.gruposete.dao.RelatorioDAO) RelatorioMudancas(br.senac.tads3.pi03b.gruposete.models.RelatorioMudancas) RequestDispatcher(javax.servlet.RequestDispatcher) ServletException(javax.servlet.ServletException) IOException(java.io.IOException) SQLException(java.sql.SQLException)

Aggregations

RelatorioMudancas (br.senac.tads3.pi03b.gruposete.models.RelatorioMudancas)16 RelatorioDAO (br.senac.tads3.pi03b.gruposete.dao.RelatorioDAO)15 IOException (java.io.IOException)14 ServletException (javax.servlet.ServletException)14 HttpSession (javax.servlet.http.HttpSession)14 SQLException (java.sql.SQLException)13 RequestDispatcher (javax.servlet.RequestDispatcher)12 ClienteDAO (br.senac.tads3.pi03b.gruposete.dao.ClienteDAO)4 HotelDAO (br.senac.tads3.pi03b.gruposete.dao.HotelDAO)4 VooDAO (br.senac.tads3.pi03b.gruposete.dao.VooDAO)4 FuncionarioDAO (br.senac.tads3.pi03b.gruposete.dao.FuncionarioDAO)3 Cliente (br.senac.tads3.pi03b.gruposete.models.Cliente)3 Hotel (br.senac.tads3.pi03b.gruposete.models.Hotel)3 Voo (br.senac.tads3.pi03b.gruposete.models.Voo)3 Funcionario (br.senac.tads3.pi03b.gruposete.models.Funcionario)2 ClienteService (br.senac.tads3.pi03b.gruposete.services.ClienteService)2 FuncionarioService (br.senac.tads3.pi03b.gruposete.services.FuncionarioService)2 HotelService (br.senac.tads3.pi03b.gruposete.services.HotelService)2 VooService (br.senac.tads3.pi03b.gruposete.services.VooService)2 VendaDAO (br.senac.tads3.pi03b.gruposete.dao.VendaDAO)1