package imis_hous.com.util;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import imis_hous.com.factory.SessionFactoryDAO;
public class RoomRepairApply extends HttpServlet {

	/**
	 * Constructor of the object.
	 */
	public RoomRepairApply() {
		super();
	}

	
	public void doGet(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		response.setContentType("text/html");
		boolean flag=false;
		String num=request.getParameter("id");
		String RoomRepairApplyId=request.getParameter("RoomRepairApplyId");
		if (num.equals("delete")) {
			int id=Integer.parseInt(RoomRepairApplyId);
			flag=SessionFactoryDAO.getRoomRepairApplyDAOInstance().del(id);
			if (flag) {
				request.getRequestDispatcher("../delSuccess.jsp").forward(request, response);
			} else {
				request.getRequestDispatcher("../delFail.jsp").forward(request, response);
			}
		}
		
	}

	
	public void doPost(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {

		this.doGet(request, response);
		
	}

}