Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static void createBDCustomers(){
- String sql = "CREATE TABLE IF NOT EXISTS Cliente1 (n"
- + " id integer PRIMARY KEY,n"
- + " name varchar NOT NULL,n"
- + " ruc varchar,n"
- + " repLegal varchar,n"
- + " nombreContactoEmpresa varchar,n"
- + " correoContactoEmpresa varchar,n"
- + " numeroContacto varchar,n"
- + " cedulaRepLegal varchar,n"
- + " nit varchar,n"
- + " noContribuyenteMuniPa varchar,n"
- + " contraMuniPa varcharn"
- + ");";
- String url = "jdbc:sqlite:Cliente1.db";
- try (Connection miConexion = DriverManager.getConnection(url);
- Statement stmt = miConexion.createStatement()) {
- stmt.execute(sql);
- } catch (SQLException e) {
- System.out.println(e.getMessage());
- }
- }
- public static void createDBPDF(){
- String sql = "CREATE TABLE IF NOT EXISTS PDF (n"
- + " id INTEGER PRIMARY KEY,n"
- + " nombrecliente varchar,n"
- + " nombrepdf varchar,n"
- + " archivopdf mediumblobn"
- + ");";
- String url = "jdbc:sqlite:PDF.db";
- try (Connection miConexion = DriverManager.getConnection(url);
- Statement stmt = miConexion.createStatement()) {
- stmt.execute(sql);
- } catch (SQLException e) {
- System.out.println(e.getMessage());
- }
- }
- public static void createDBObligaciones(){
- String sql = "CREATE TABLE IF NOT EXISTS Obligaciones (n"
- + " id INTEGER PRIMARY KEY,n"
- + " nombrecliente varchar,n"
- + " obligacion varchar,n"
- + " fecha varchar,n"
- + " hora varchar,n"
- + " color integer,n"
- + " send varcharn"
- + ");";
- String url = "jdbc:sqlite:Obligaciones.db";
- try (Connection miConexion = DriverManager.getConnection(url);
- Statement stmt = miConexion.createStatement()) {
- stmt.execute(sql);
- } catch (SQLException e) {
- System.out.println(e.getMessage());
- }
- }
- public void Reminders(){
- ActionListener timerReminders = (ActionEvent e) -> {
- try(Connection miConexion = DriverManager.getConnection("jdbc:sqlite:Obligaciones.db");
- Statement miStatement = miConexion.createStatement();
- ResultSet miResultSet = miStatement.executeQuery("SELECT obligacion, fecha, hora, color, send FROM Obligaciones");){
- while(miResultSet.next()){
- SimpleDateFormat FormatterDate = new SimpleDateFormat("dd-MM-yyyy HH:mm");
- Calendar cal = Calendar.getInstance();
- try {
- cal.setTime(FormatterDate.parse(miResultSet.getString("fecha")+" "+miResultSet.getString("hora")));
- } catch (ParseException ex) {
- Logger.getLogger(Interface.class.getName()).log(Level.SEVERE, null, ex);
- }
- Date dateUser = cal.getTime();
- Date date = new Date();
- if(dateUser.before(date) || dateUser.equals(date)){
- JOptionPane.showMessageDialog(this, "Se paso el primer if");
- if(miResultSet.getString("send").equals("notsent")){
- JOptionPane.showMessageDialog(this, "Se paso el segundo if");
- JOptionPane.showMessageDialog(this, "Se paso el tercer if");
- UpdateObligacionesColorAndSend(miResultSet.getString("obligacion"), 0, "sent");
- pnlObligaciones.removeAll();
- loadBtnObligacion(lblNameC.getText());
- if (SystemTray.isSupported()) {
- sendNotification("Nombre Cliente", "Bañar al perro", "/img/logo.jpg");
- } else {
- System.err.println("System tray not supported!");
- }
- UpdateObligacionesColorAndSend(miResultSet.getString("obligacion"), 0, "sent");
- pnlObligaciones.removeAll();
- loadBtnObligacion(lblNameC.getText());
- if (SystemTray.isSupported()) {
- sendNotification("Nombre Cliente", "Bañar al perro", "/img/logo.jpg");
- } else {
- System.err.println("System tray not supported!");
- }
- }
- }else{
- }
- miConexion.close();
- miStatement.close();
- miResultSet.close();
- }
- }catch(SQLException ev){
- System.out.println(ev);
- }
- };
- Timer timer = new Timer(1000, timerReminders);
- timer.setInitialDelay(0);
- timer.start();
- }
Add Comment
Please, Sign In to add comment