List of usage examples for org.joda.time LocalDateTime toDate
@SuppressWarnings("deprecation") public Date toDate()
java.util.Date
. From source file:py.com.palermo.servicioarthy.impl.gestioncomercial.PortalGeneralService.java
public String setFactura(Factura f) { if (f.getFechaCadena() != null) { LocalDateTime localDateTime = LocalDateTime.parse(f.getFechaCadena(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")); f.setFecha(localDateTime.toDate()); }/*w w w .j a v a 2 s. c o m*/ Factura vivo = em.find(Factura.class, f.getId()); if (vivo != null && vivo.getEstadoDescarga().compareToIgnoreCase("T") == 0) { return f.getId(); } for (FacturaCobro c : f.getCobros()) { if (c.getDocumentoId() != null && c.getDocumentoId().compareToIgnoreCase("0") == 0) { c.setDocumentoId(null); } } f.setEstadoDescarga("N"); em.merge(f); return f.getId(); }
From source file:py.com.palermo.servicioarthy.impl.gestioncomercial.PortalGeneralService.java
public String setLog(LogOperacion l) { if (l.getFechaCadena() != null) { LocalDateTime localDateTime = LocalDateTime.parse(l.getFechaCadena(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")); l.setFecha(localDateTime.toDate()); }/*from ww w . ja v a 2 s . c o m*/ String R = l.getId() + ""; l.setId(null); em.persist(l); return R; }
From source file:py.com.palermo.servicioarthy.impl.gestioncomercial.PortalGeneralService.java
public String setRelevamiento(Relevamiento r) { if (r.getFechaCadena() != null) { LocalDateTime localDateTime = LocalDateTime.parse(r.getFechaCadena(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")); r.setFecha(localDateTime.toDate()); }//from w ww .j a va 2 s. c om String R = r.getId() + ""; Relevamiento rbd = null; try { rbd = (Relevamiento) em.createQuery("SELECT r FROM Relevamiento r where r.hashKey = ?1") .setParameter(1, r.getHashKey()).getSingleResult(); } catch (Exception e) { } if (rbd != null && rbd.getEstadoDescarga().compareToIgnoreCase("T") == 0) { return R; } if (rbd == null) { r.setId(null); r.setEstadoDescarga("N"); em.persist(r); } else { rbd.setMotivoNoVentaId(r.getMotivoNoVentaId()); rbd.setEstadoAnulacion(r.getEstadoAnulacion()); rbd.setEstadoDescarga("N"); em.merge(rbd); } return R; }
From source file:py.com.palermo.servicioarthy.impl.gestioncomercial.PortalGeneralService.java
public String setDevolucion(Devolucion d, List<DevolucionDetalle> detalles) { if (d.getFechaCadena() != null) { LocalDateTime localDateTime = LocalDateTime.parse(d.getFechaCadena(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")); d.setFecha(localDateTime.toDate()); }/*from w w w.j a v a 2s. c o m*/ String R = d.getId() + ""; Devolucion rbd = null; try { rbd = (Devolucion) em.createQuery("SELECT d FROM Devolucion d where d.hashKey = :hash") .setParameter("hash", d.getHashKey().trim()).getSingleResult(); } catch (Exception e) { } if (rbd != null && rbd.getEstadoDescarga().compareToIgnoreCase("T") == 0) { return R; } d.setEstadoDescarga("N"); if (rbd == null) { System.out.println("Detalles devolucion: " + detalles); d.setId(null); System.out.println("Paso 1:"); em.persist(d); em.flush(); em.refresh(d); for (DevolucionDetalle dt : detalles) { dt.setId(null); dt.setDevolucionId(d.getId()); em.persist(dt); } } else { rbd = copiaDevolucion(rbd, d); rbd.setEstadoDescarga("N"); em.merge(rbd); em.flush(); em.refresh(rbd); em.createQuery("DELETE FROM DevolucionDetalle d WHERE d.devolucionId = ?1").setParameter(1, rbd.getId()) .executeUpdate(); for (DevolucionDetalle dt : detalles) { dt.setId(null); dt.setDevolucionId(rbd.getId()); em.persist(dt); } } return R; }
From source file:py.com.palermo.servicioarthy.impl.gestioncomercial.PortalGeneralService.java
public Cobranza setCobranza(Cobranza c, List<Cobranzadetalle> detalles, List<Cobranzaaplicacionpago> aplicaciones) { if (c.getFechaCadena() != null) { LocalDateTime localDateTime = LocalDateTime.parse(c.getFechaCadena(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")); c.setFecha(localDateTime.toDate()); }// ww w. ja va 2 s. c o m Cobranza vivo = em.find(Cobranza.class, c.getId()); if (vivo != null && vivo.getEstadodescarga().compareTo('T') == 0) { return c; } em.createQuery("DELETE FROM Cobranzadetalle c WHERE c.cobranzaid = ?1").setParameter(1, c.getId()) .executeUpdate(); em.createQuery("DELETE FROM Cobranzaaplicacionpago c WHERE c.cobranzaid = ?1").setParameter(1, c.getId()) .executeUpdate(); c.setEstadodescarga('N'); String[] arrayId = c.getId().split(","); short sucursalId = Short.valueOf(arrayId[1]); c.setSucursalId(sucursalId); em.merge(c); for (Cobranzadetalle cd : detalles) { if (cd.getFechaCadena() != null) { LocalDateTime localDateTime = LocalDateTime.parse(cd.getFechaCadena(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")); cd.setFechaFactura(localDateTime.toDate()); } cd.setCobranza(c); em.merge(cd); } for (Cobranzaaplicacionpago cap : aplicaciones) { if (cap.getFechaCadena() != null) { LocalDateTime localDateTime = LocalDateTime.parse(cap.getFechaCadena(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")); cap.setValorfecha(localDateTime.toDate()); } cap.setCobranza(c); em.merge(cap); } return c; }
From source file:py.com.palermo.servicioarthy.impl.gestioncomercial.PortalGeneralService.java
public Cobranzaaplicacionpago setCobranzaAplicacionPago(Cobranzaaplicacionpago c) { if (c.getFechaCadena() != null) { LocalDateTime localDateTime = LocalDateTime.parse(c.getFechaCadena(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")); c.setValorfecha(localDateTime.toDate()); }// ww w . ja v a2s .c o m em.merge(c); return c; }
From source file:py.com.palermo.servicioarthy.PuntosService.java
public void guarda(Evento e) { if (e.getFechaCadena() != null) { LocalDateTime localDateTime = LocalDateTime.parse(e.getFechaCadena(), DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ssZ")); e.setFecha(localDateTime.toDate()); }//from w w w. j a va 2s . c om em.merge(e); }
From source file:view.ConfigInternalFrame.java
private void BackupBtnActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BackupBtnActionPerformed Runnable t1 = () -> {//from w w w . java2s. com try { java.io.File file = new java.io.File( System.getProperty("user.home") + System.getProperty("file.separator") + ".jbiblioteca" + System.getProperty("file.separator") + "jbiblioteca_bkp.db"); Database.checkDatabase(); Database.backupDatabase(file); Runnable t2 = () -> { try { LocalDateTime ldt = new LocalDateTime(System.currentTimeMillis()); ConfigController.saveLastBackupDate("'" + ldt.toString() + "'"); backupLabel.setText(ldt.toDate().toLocaleString()); } catch (Exception e1) { } }; new Thread(t2).start(); JOptionPane.showMessageDialog(null, "O arquivo de backup foi salvo com xito."); } catch (Exception e1) { } }; new Thread(t1).start(); }