if("add".equals(method)){
String areaPostCode=request.getParameter("areaPostCode");
String areaName=request.getParameter("areaName");
int parentAreaId=Integer.parseInt(request.getParameter("parentAreaId")==null?"0":request.getParameter("parentAreaId"));
String areaMemo=request.getParameter("areaMemo");
if(new TbAreaDAO().add(new TbArea(areaPostCode,areaName,parentAreaId,areaMemo,new UtilDAO().decodeDate()))){
request.getSession().setAttribute("result", "添加成功");
}else{
request.getSession().setAttribute("result", "添加失败");
}
request.getSession(true).setAttribute("tbAreaList",new TbAreaDAO().getTbAreaAll());
response.sendRedirect("AreaModule/TbAreaList.jsp");
}
if("del".equals(method)){
if(UtilDAO.delin("Tb_Area", "AreaId", request.getParameter("delIds"))){
request.getSession().setAttribute("result", "删除成功");
}else{
request.getSession().setAttribute("result", "删除失败");
}
request.getSession(true).setAttribute("tbAreaList",new TbAreaDAO().getTbAreaAll());
response.sendRedirect("AreaModule/TbAreaList.jsp");
}
if("edit".equals(method)){
int areaId=Integer.parseInt(request.getParameter("areaId"));
String areaPostCode=request.getParameter("areaPostCode");
String areaName=request.getParameter("areaName");
int parentAreaId=Integer.parseInt(request.getParameter("parentAreaId"));
String areaMemo=request.getParameter("areaMemo");
if(new TbAreaDAO().edit(new TbArea(areaId,areaPostCode,areaName,parentAreaId,areaMemo,new UtilDAO().decodeDate()))){
request.getSession().setAttribute("result", "修改成功");
}else{
request.getSession().setAttribute("result", "修改失败");
}
request.getSession(true).setAttribute("tbAreaList",new TbAreaDAO().getTbAreaAll());