Ejemplo n.º 1
0
 private void showProjectDetails(HttpServletRequest req, HttpServletResponse resp)
     throws ServletException, IOException {
   int projectid = Integer.valueOf(req.getParameter("projectid"));
   req.setAttribute("project", project.getProjectById(projectid));
   req.setAttribute("paymetVariants", project.getProjectById(projectid).getPaymetVariants());
   req.setAttribute("categoryId", categoryId);
   req.getRequestDispatcher("projectdetails.jsp").forward(req, resp);
 }
Ejemplo n.º 2
0
  @Override
  public void doPost(HttpServletRequest req, HttpServletResponse resp)
      throws IOException, ServletException {
    int projectid = Integer.valueOf(req.getParameter("projectid"));
    Project projectforEdit = project.getProjectById(projectid);
    String question = req.getParameter("question");
    if (question.length() > 0) {
      projectforEdit.asqAQuestion(req.getParameter("question"));
      project.save(projectforEdit);
    }

    Long donate = 0L;
    if (!req.getParameter("donate").equals("")) {
      donate = Long.valueOf(req.getParameter("donate"));
    }

    Long customDonate = 0L;
    if (!req.getParameter("customDonate").equals("")) {
      customDonate = Long.valueOf(req.getParameter("customDonate"));
    }

    if (donate > 0 || customDonate > 0) {
      if (customDonate > 0) {
        projectforEdit.updateBalance(customDonate);
        project.save(projectforEdit);
      } else {
        projectforEdit.updateBalance(donate);
        project.save(projectforEdit);
      }
    }
    this.showProjectDetails(req, resp);
  }