コード例 #1
0
 public void setPeriods(String cmds) {
   if (cmds.trim().isEmpty()) {
     return;
   }
   ArrayList<String> list =
       StringUtils.parseStringToArray(cmds, ",", StringUtils.CASE_INSENSITIVE);
   listmodel1.removeAllElements();
   for (int i = 0; i < list.size(); i++) {
     String interval = list.get(i);
     // System.out.println("detectat::"+interval);
     String2Date s2d = new String2Date(interval);
     jDateChooser1.setDate(s2d.getInici());
     jCalendar1.setDate(s2d.date1);
     jDateChooser2.setDate(s2d.getFinal());
     listmodel1.addElement(
         new DataCtrl(s2d.getInici()).getDiaMesComplet()
             + " a "
             + new DataCtrl(s2d.getFinal()).getDiaMesComplet());
     updateEntry();
   }
   jList1.setSelectedIndex(0);
   if (listmodel1.getSize() > 1) {
     jButton2.setEnabled(true);
   }
 }
コード例 #2
0
  public void doDBUpdate(boolean write) {

    String SQL1 = "DELETE FROM tuta_dies_sancions WHERE idActuacio=" + idTask;
    int nup = coreCfg.getMysql().executeUpdate(SQL1);

    if (write && mexp2 > 0 && idTask > 0) {
      for (int i = 0; i < listmodel1.size(); i++) {
        String cmd = (String) listmodel1.get(i);
        String2Date s2d = new String2Date(cmd);

        String SQL2 =
            "INSERT INTO tuta_dies_sancions (exp2, idActuacio, desde, fins, tipus) VALUES (?,?,?,?,?)";
        Object[] obj = new Object[] {mexp2, idTask, s2d.getInici(), s2d.getFinal(), mtipus};
        nup = coreCfg.getMysql().preparedUpdate(SQL2, obj);
      }
    }
  }