use of br.senac.tads3.pi03b.gruposete.dao.RelatorioDAO in project Loja_Agencia_De_Viagens by ArtCouSan.
the class ExcluiHotelServlet method doGet.
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String action = request.getParameter("action");
HotelDAO query = new HotelDAO();
RelatorioDAO relatorioDAO = new RelatorioDAO();
RelatorioMudancas relatorio = new RelatorioMudancas();
if ("delete".equalsIgnoreCase(action)) {
int id = Integer.parseInt(request.getParameter("id"));
try {
query.excluir(id);
HttpSession sessao = request.getSession();
int identificacaoF = (int) sessao.getAttribute("id_func");
relatorio.setId_func(identificacaoF);
relatorio.setMudanca("Exclusão de hotel efetuada!");
relatorioDAO.inserir(relatorio);
RequestDispatcher dispatcher = request.getRequestDispatcher("WEB-INF/jsp/BuscaHotel.jsp");
dispatcher.forward(request, response);
} catch (SQLException | ClassNotFoundException ex) {
Logger.getLogger(ExcluiHotelServlet.class.getName()).log(Level.SEVERE, null, ex);
} catch (Exception ex) {
Logger.getLogger(ExcluiHotelServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
use of br.senac.tads3.pi03b.gruposete.dao.RelatorioDAO in project Loja_Agencia_De_Viagens by ArtCouSan.
the class ExcluiVooServlet method doGet.
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String action = request.getParameter("action");
VooDAO query = new VooDAO();
RelatorioDAO relatorioDAO = new RelatorioDAO();
RelatorioMudancas relatorio = new RelatorioMudancas();
if ("delete".equalsIgnoreCase(action)) {
int id = Integer.parseInt(request.getParameter("id"));
try {
query.excluir(id);
HttpSession sessao = request.getSession();
int identificacaoF = (int) sessao.getAttribute("id_func");
relatorio.setId_func(identificacaoF);
relatorio.setMudanca("Exclusão de vôo efetuada!");
relatorioDAO.inserir(relatorio);
RequestDispatcher dispatcher = request.getRequestDispatcher("WEB-INF/jsp/BuscaVoo.jsp");
dispatcher.forward(request, response);
} catch (SQLException | ClassNotFoundException ex) {
Logger.getLogger(ExcluiVooServlet.class.getName()).log(Level.SEVERE, null, ex);
} catch (Exception ex) {
Logger.getLogger(ExcluiVooServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
use of br.senac.tads3.pi03b.gruposete.dao.RelatorioDAO in project Loja_Agencia_De_Viagens by ArtCouSan.
the class AlteraHotelServlet method doPost.
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
HotelService service = new HotelService();
HotelDAO dao = new HotelDAO();
RelatorioDAO relatorioDAO = new RelatorioDAO();
RelatorioMudancas relatorio = new RelatorioMudancas();
String nome_hotel = request.getParameter("nome_hotel");
String data_entrada = request.getParameter("data_entrada");
String data_saida = request.getParameter("data_saida");
int quantidade_quartos = Integer.parseInt(request.getParameter("quantidade_quartos"));
int quantidade_hospedes = Integer.parseInt(request.getParameter("quantidade_hospedes"));
float preco = Float.parseFloat(request.getParameter("preco"));
int id = Integer.parseInt(request.getParameter("identificacao"));
request.setAttribute("erroNome_hotel", service.validaNome(nome_hotel));
request.setAttribute("erroData_entrada", service.validaEntrada(data_entrada));
request.setAttribute("erroData_saida", service.validaSaida(data_saida));
request.setAttribute("erroQuantidade_quartos", service.validaQuantidade_quartos(quantidade_quartos));
request.setAttribute("erroQuantidade_hospedes", service.validaQuantidade_hospedes(quantidade_hospedes));
request.setAttribute("erroPreco", service.validaPreco(preco));
Hotel hotel = new Hotel(nome_hotel.trim(), data_entrada.trim(), data_saida.trim(), quantidade_quartos, quantidade_hospedes, preco, true);
hotel.setId(id);
if (service.validaHotel(nome_hotel, quantidade_quartos, data_entrada, data_saida, quantidade_hospedes, preco)) {
try {
Hotel hoteis = dao.getHotelById(id);
request.setAttribute("hoteis", hoteis);
} catch (ClassNotFoundException | SQLException e) {
}
RequestDispatcher dispatcher = request.getRequestDispatcher("WEB-INF/jsp/EditarHotel.jsp");
dispatcher.forward(request, response);
} else {
try {
dao.alterar(hotel);
HttpSession sessao = request.getSession();
int identificacaoF = (int) sessao.getAttribute("id_func");
relatorio.setId_func(identificacaoF);
relatorio.setMudanca("Alteração de hotel efetuado!");
relatorioDAO.inserir(relatorio);
response.sendRedirect(request.getContextPath() + "/inicio");
} catch (Exception ex) {
Logger.getLogger(AlteraHotelServlet.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
use of br.senac.tads3.pi03b.gruposete.dao.RelatorioDAO in project Loja_Agencia_De_Viagens by ArtCouSan.
the class BuscarRelatorioMudanca method doGet.
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RelatorioDAO relatorio = new RelatorioDAO();
try {
JSONArray jsonArray = new JSONArray();
ArrayList<RelatorioMudancas> procurar = relatorio.procurarRelatorioMudanca();
for (RelatorioMudancas procurarVenda : procurar) {
JSONObject json = new JSONObject();
json.put("mudanca", procurarVenda.getMudanca());
json.put("data_m", procurarVenda.getData());
json.put("nome", procurarVenda.getFuncionario());
json.put("cargo", procurarVenda.getCargo());
json.put("filial", procurarVenda.getFilial());
jsonArray.add(json);
}
response.setCharacterEncoding("UTF-8");
try (PrintWriter out = response.getWriter()) {
out.println(jsonArray.toJSONString());
}
} catch (SQLException | ClassNotFoundException ex) {
Logger.getLogger(BuscarRelatorioMudanca.class.getName()).log(Level.SEVERE, null, ex);
}
}
use of br.senac.tads3.pi03b.gruposete.dao.RelatorioDAO in project Loja_Agencia_De_Viagens by ArtCouSan.
the class BuscarSLAServlet method doGet.
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
RelatorioDAO relatorio = new RelatorioDAO();
try {
JSONArray jsonArray = new JSONArray();
ArrayList<RelatorioSLA> procurar = null;
HttpSession sessao = request.getSession();
String identificacaoF = (String) sessao.getAttribute("tipo");
String filial = (String) sessao.getAttribute("filial");
if (identificacaoF.equalsIgnoreCase("Master") || identificacaoF.equalsIgnoreCase("Gerente_Informatica")) {
procurar = relatorio.procurarRelatorioSLA();
} else {
procurar = relatorio.procurarRelatorioSLA(filial);
}
for (RelatorioSLA procuraras : procurar) {
JSONObject json = new JSONObject();
json.put("id_sla", procuraras.getId_SLA());
json.put("mensagem", procuraras.getMensagem());
json.put("data_m", procuraras.getData());
json.put("nome", procuraras.getFuncionario());
json.put("cargo", procuraras.getCargo());
json.put("filial", procuraras.getFilial());
jsonArray.add(json);
}
response.setCharacterEncoding("UTF-8");
try (PrintWriter out = response.getWriter()) {
out.println(jsonArray.toJSONString());
}
} catch (SQLException | ClassNotFoundException ex) {
Logger.getLogger(BuscarRelatorioMudanca.class.getName()).log(Level.SEVERE, null, ex);
}
}
Aggregations