示例#1
0
文件: Vues.java 项目: T4g1/3eme
  public static String payement(HttpServletRequest request, HttpServletResponse response) {
    String html = "";
    try {
      // Ouvre la BDD
      BeanDBAccessORA dba = (BeanDBAccessORA) Beans.instantiate(null, "Bean.BeanDBAccessORA");

      if (dba.init()) {

        int session = 0;
        session = Integer.parseInt(request.getAttribute("session").toString());
        ResultSet result = dba.getcaddie(session);

        if (request.getParameter("action").equals("payer")) {
          dba.Paycaddie(session, 1);
          html += "paiement réussis !!!";
        } else {
          dba.Paycaddie(session, 0);
          html += "Annulation acceptée :( ";
        }

      } else {
        html = "dba.init() error";
      }
    } catch (SQLException ex) {
      html += "SQLException: " + ex.getMessage();
    } catch (IOException ex) {
      html += "IOException: " + ex.getMessage();
    } catch (ClassNotFoundException ex) {
      html += "ClassNotFoundException: " + ex.getMessage();
    }

    return html;
  }
示例#2
0
文件: Vues.java 项目: T4g1/3eme
  /**
   * Donne le code HTML du contenu du caddie donné
   *
   * @param caddie Caddie voulu
   * @return Code HTML du contenu
   */
  public static String getCaddieContent(HttpServletRequest request, HttpServletResponse response) {
    int session = 0;
    session = Integer.parseInt(request.getAttribute("session").toString());
    String html =
        "<table border=1px>\n"
            + "    <tr>\n"
            + "        <th>salle</th>\n"
            + "        <th>sceance</th>\n"
            + "        <th>film</th>\n"
            + "        <th>date</th>\n"
            + "        <th>nombre de place</th>\n"
            + "    </tr>";

    try {
      // Ouvre la BDD
      BeanDBAccessORA dba = (BeanDBAccessORA) Beans.instantiate(null, "Bean.BeanDBAccessORA");

      if (dba.init()) {

        ResultSet result = dba.getcaddie(session);

        // Parcourt le caddie
        if (result != null) {
          while (result.next()) {
            html += "<tr>";
            html += "<td>" + result.getInt("idsalle") + "</td>";
            html += "<td>" + getHeureSceances(result.getInt("numsceance")) + "</td>";
            html += "<td>" + result.getString("titre") + "</td>";
            html += "<td>" + result.getString("datejour") + "</td>";
            html += "<td align=\"center\">" + result.getInt("nbplace") + "</td>";
            html += "</tr>";
          }
        }

      } else {
        html = "dba.init() error";
      }
    } catch (SQLException ex) {
      html = "SQLException: " + ex.getMessage();
    } catch (IOException ex) {
      html = "IOException: " + ex.getMessage();
    } catch (ClassNotFoundException ex) {
      html = "ClassNotFoundException: " + ex.getMessage();
    }

    html += "</table>";
    html += "<a href=\"Search?action=payer&id=" + session + " \">Payer</a>  ";
    html += "<a href=\"Search?action=annuler&id=" + session + "\">Annuler</a>";
    return html;
  }