Example #1
0
  public boolean AdicionarMaterial(JSONObject datos) {
    try {
      this.cn = getConnection();
      this.st = cn.createStatement();
      Material use = new Material("", String.valueOf(datos.get("material")));
      String tsql;
      tsql = "INSERT INTO material VALUES(DEFAULT, '";
      tsql += use.getNombre_material() + "')";
      this.st.execute(tsql);
      this.desconectar();
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }

    return true;
  }
Example #2
0
  public boolean ModificarMaterial(JSONObject datos, String Codigo) {
    try {
      this.cn = getConnection();
      this.st = cn.createStatement();
      Material use = new Material("", String.valueOf(datos.get("material")));
      String tsql;
      tsql =
          "UPDATE material SET material='"
              + use.getNombre_material()
              + "' WHERE codigo = "
              + Codigo
              + ";";
      this.st.execute(tsql);
      this.desconectar();
    } catch (Exception e) {
      e.printStackTrace();
      return false;
    }

    return true;
  }