Ejemplo n.º 1
0
  public ActionForward guardarPlazoAjax(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response)
      throws Exception {

    PlazoForm plazoForm = (PlazoForm) form;
    String codPlazoHdn = plazoForm.getCodPlazoHdn();
    String codPlazo = plazoForm.getCodPlazo();
    String desPlazo = plazoForm.getDesPlazo();

    ReadProperties readProperties = new ReadProperties();
    Map<String, String> mapResult = parametrosService.savePlazo(codPlazoHdn, codPlazo, desPlazo);

    plazoForm.setDesPlazo("");
    plazoForm.setCodPlazo("");
    plazoForm.setCodPlazoHdn("");

    if (mapResult.get("msgError") != null) {
      response.setStatus(500);
      response.getWriter().write(readProperties.getProperty(mapResult.get("msgError")));
    }

    return null;
  }
Ejemplo n.º 2
0
  public String eliminarPlazoAjax(String selecciones) {

    ReadProperties readProperties = new ReadProperties();

    try {

      StringTokenizer st = new StringTokenizer(selecciones, "**");
      String concatIds = "";

      while (st.hasMoreTokens()) {
        String elemento = st.nextToken();
        StringTokenizer stComas = new StringTokenizer(elemento, "-");
        while (stComas.hasMoreTokens()) {
          stComas.nextToken();
          if (stComas.hasMoreTokens()) {
            String id = stComas.nextToken();
            concatIds = concatIds + "'" + id + "',";
          }
        }
      }

      if (!"".equals(concatIds)) {
        concatIds = concatIds.substring(0, concatIds.length() - 1);
        parametrosService.deletePlazosByCode(concatIds);
        return readProperties.getProperty("etiqueta.success.delete");
      }

      return "";

    } catch (Exception e) {

      try {
        if (e.getMessage().contains("ORA-02292")) {
          return readProperties.getProperty("etiqueta.error.delete.plazo");
        } else if (e.getCause().getCause().getMessage().contains("ORA-02292")) {
          return readProperties.getProperty("etiqueta.error.delete.plazo");
        } else {
          return readProperties.getProperty("etiqueta.error.delete");
        }
      } catch (Exception excep) {
        return readProperties.getProperty("etiqueta.error.delete");
      }
    }
  }
Ejemplo n.º 3
0
 public List<Plazo> consultarAjax() {
   List<Plazo> listaPlazos = parametrosService.getAllPlazos();
   return listaPlazos;
 }