示例#1
0
  protected void register_suplier(HttpServletRequest request, HttpServletResponse response)
      throws IOException, SQLException, ClassNotFoundException {

    String ruc = request.getParameter("f_ruc");
    String phone = request.getParameter("f_phone");
    String address = request.getParameter("f_address");
    String state = request.getParameter("f_state");

    p.setRuc(ruc);
    p.setPhone(phone);
    p.setAddress(address);
    p.setState(state);

    p.registrationSuplier(p); // Meto el objeto en la BBDD

    response.sendRedirect("suplier.jsp");
  }
示例#2
0
  protected void update_suplier(HttpServletRequest request, HttpServletResponse response)
      throws IOException {
    //        int idp = Integer.valueOf(request.getParameter("f_id"));
    String msj = "";

    String idp = request.getParameter("f_id");
    String ruc = request.getParameter("f_ruc");
    String phone = request.getParameter("f_phone");
    String address = request.getParameter("f_address");
    String state = request.getParameter("f_state");

    p.setIdSuplier(idp);
    p.setRuc(ruc);
    p.setPhone(phone);
    p.setAddress(address);
    p.setState(state);

    int valor = 0;
    try {
      valor = p.updateSuplier(p); // Meto el objeto en la BBDD

    } catch (SQLException ex) {
      Logger.getLogger(cSuplier.class.getName()).log(Level.SEVERE, null, ex);
    } catch (ClassNotFoundException ex) {
      Logger.getLogger(cSuplier.class.getName()).log(Level.SEVERE, null, ex);
    }

    if (valor == 1) {
      msj = "3"; // Correcto
    } else {
      msj = "4"; // Error en la eliminacion
    }

    response.sendRedirect("suplier.jsp?msj=" + msj);
  }
示例#3
0
  protected void eliminarProveedor(HttpServletRequest request, HttpServletResponse response)
      throws ClassNotFoundException, SQLException, IOException {

    String id = request.getParameter("id");

    String msj = "";

    int valor = p.deleteSuplier(id);
    if (valor == 1) {
      msj = "1"; // Correcto
    } else {
      msj = "2"; // Error en la eliminacion
    }
    response.sendRedirect("suplier.jsp?opc=del&msj=" + msj);
  }