String method = request.getParameter("method")==null?"":request.getParameter("method");
if("add".equals(method)){
int creditRatingTypeId=Integer.parseInt(request.getParameter("creditRatingTypeId"));
double creditRatingScore=Double.valueOf(request.getParameter("creditRatingScore"));
if(new TbCreditRatingDAO().add(new TbCreditRating(creditRatingTypeId,creditRatingScore,new UtilDAO().decodeDate()))){
request.getSession().setAttribute("result", "添加成功");
}else{
request.getSession().setAttribute("result", "添加失败");
}
request.getSession(true).setAttribute("tbCreditRatingList",new TbCreditRatingDAO().getTbCreditRatingAll());
response.sendRedirect("CreditratingModule/TbCreditRatingList.jsp");
}
if("del".equals(method)){
if(UtilDAO.delin("Tb_CreditRating", "CreditRatingId", request.getParameter("delIds"))){
request.getSession().setAttribute("result", "删除成功");
}else{
request.getSession().setAttribute("result", "删除失败");
}
request.getSession(true).setAttribute("tbCreditRatingList",new TbCreditRatingDAO().getTbCreditRatingAll());
response.sendRedirect("CreditratingModule/TbCreditRatingList.jsp");
}
if("edit".equals(method)){
int creditRatingId=Integer.parseInt(request.getParameter("creditRatingId"));
int creditRatingTypeId=Integer.parseInt(request.getParameter("creditRatingTypeId"));
double creditRatingScore=Double.valueOf(request.getParameter("creditRatingScore"));
if(new TbCreditRatingDAO().edit(new TbCreditRating(creditRatingId,creditRatingTypeId,creditRatingScore,new UtilDAO().decodeDate()))){
request.getSession().setAttribute("result", "修改成功");
}else{
request.getSession().setAttribute("result", "修改失败");
}
request.getSession(true).setAttribute("tbCreditRatingList",new TbCreditRatingDAO().getTbCreditRatingAll());