Avances con el modelo de datos
This commit is contained in:
parent
85782b21c8
commit
d684c59adc
ProyectoVentaBoletos/src/main/java
|
@ -1,9 +1,9 @@
|
|||
package com.cip.proyectoventaboletos;
|
||||
|
||||
import view.Menu;
|
||||
import javax.swing.UIManager;
|
||||
import com.formdev.flatlaf.themes.FlatMacLightLaf;
|
||||
import javax.swing.UnsupportedLookAndFeelException;
|
||||
import vista.*;
|
||||
|
||||
public class ProyectoVentaBoletos {
|
||||
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
package controlador;
|
||||
package controller;
|
||||
|
||||
import java.sql.DriverManager;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Connection;
|
||||
|
||||
public class ConexionSingleton {
|
||||
private static final String URL = "jdbc:mysql://localhost:3306/venta_boletos";
|
||||
private static final String USERNAME = "vboletos";
|
||||
private static final String PASSWORD = "vboletos";
|
||||
private static final String URL = "jdbc:mysql://localhost:3306/ventaboletos";
|
||||
private static final String USERNAME = "uservb";
|
||||
private static final String PASSWORD = "uservbps";
|
||||
private static Connection CONEXION = null;
|
||||
|
||||
private ConexionSingleton(){
|
|
@ -1,6 +1,6 @@
|
|||
package controlador;
|
||||
package controller;
|
||||
|
||||
import vista.Menu;
|
||||
import view.Menu;
|
||||
|
||||
public class MenuController {
|
||||
private Menu menu;
|
|
@ -0,0 +1,32 @@
|
|||
package model;
|
||||
|
||||
public class Asiento {
|
||||
private String idEvento;
|
||||
private String fila;
|
||||
private int numero;
|
||||
|
||||
public void setIdEvento(String idEvento) {
|
||||
this.idEvento = idEvento;
|
||||
}
|
||||
|
||||
public void setFila(String fila) {
|
||||
this.fila = fila;
|
||||
}
|
||||
|
||||
public void setNumero(int numero) {
|
||||
this.numero = numero;
|
||||
}
|
||||
|
||||
public String getIdEvento() {
|
||||
return idEvento;
|
||||
}
|
||||
|
||||
public String getFila() {
|
||||
return fila;
|
||||
}
|
||||
|
||||
public int getNumero() {
|
||||
return numero;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,81 @@
|
|||
package model;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
public class Boleto {
|
||||
private int idBoleto;
|
||||
private int idEvento;
|
||||
private int idAsiento;
|
||||
private double precio;
|
||||
private String estado;
|
||||
private LocalDateTime fechaVenta;
|
||||
private Integer idVenta;
|
||||
|
||||
public Boleto(int idBoleto, int idEvento, int idAsiento, double precio, String estado, LocalDateTime fechaVenta, Integer idVenta) {
|
||||
this.idBoleto = idBoleto;
|
||||
this.idEvento = idEvento;
|
||||
this.idAsiento = idAsiento;
|
||||
this.precio = precio;
|
||||
this.estado = estado;
|
||||
this.fechaVenta = fechaVenta;
|
||||
this.idVenta = idVenta;
|
||||
}
|
||||
|
||||
public void setIdBoleto(int idBoleto) {
|
||||
this.idBoleto = idBoleto;
|
||||
}
|
||||
|
||||
public void setIdEvento(int idEvento) {
|
||||
this.idEvento = idEvento;
|
||||
}
|
||||
|
||||
public void setIdAsiento(int idAsiento) {
|
||||
this.idAsiento = idAsiento;
|
||||
}
|
||||
|
||||
public void setPrecio(double precio) {
|
||||
this.precio = precio;
|
||||
}
|
||||
|
||||
public void setEstado(String estado) {
|
||||
this.estado = estado;
|
||||
}
|
||||
|
||||
public void setFechaVenta(LocalDateTime fechaVenta) {
|
||||
this.fechaVenta = fechaVenta;
|
||||
}
|
||||
|
||||
public void setIdVenta(Integer idVenta) {
|
||||
this.idVenta = idVenta;
|
||||
}
|
||||
|
||||
public int getIdBoleto() {
|
||||
return idBoleto;
|
||||
}
|
||||
|
||||
public int getIdEvento() {
|
||||
return idEvento;
|
||||
}
|
||||
|
||||
public int getIdAsiento() {
|
||||
return idAsiento;
|
||||
}
|
||||
|
||||
public double getPrecio() {
|
||||
return precio;
|
||||
}
|
||||
|
||||
public String getEstado() {
|
||||
return estado;
|
||||
}
|
||||
|
||||
public LocalDateTime getFechaVenta() {
|
||||
return fechaVenta;
|
||||
}
|
||||
|
||||
public Integer getIdVenta() {
|
||||
return idVenta;
|
||||
}
|
||||
|
||||
// Método para cambiar estado venderBoleto() que establezca estado, fechaVenta e idVenta.
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
package model;
|
||||
|
||||
import java.time.LocalDate;
|
||||
|
||||
public class Evento {
|
||||
private int idEvento;
|
||||
private String nombre;
|
||||
private LocalDate fecha;
|
||||
|
||||
public void setIdEvento(int idEvento) {
|
||||
this.idEvento = idEvento;
|
||||
}
|
||||
|
||||
public void setNombre(String nombre) {
|
||||
this.nombre = nombre;
|
||||
}
|
||||
|
||||
public void setFecha(LocalDate fecha) {
|
||||
this.fecha = fecha;
|
||||
}
|
||||
|
||||
public int getIdEvento() {
|
||||
return idEvento;
|
||||
}
|
||||
|
||||
public String getNombre() {
|
||||
return nombre;
|
||||
}
|
||||
|
||||
public LocalDate getFecha() {
|
||||
return fecha;
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
package model;
|
||||
|
||||
import controller.ConexionSingleton;
|
||||
import java.sql.*;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class ModeloSQL {
|
||||
Connection con;
|
||||
|
||||
public ModeloSQL(){
|
||||
con = ConexionSingleton.getInstance();
|
||||
}
|
||||
|
||||
// Eventos
|
||||
public ResultSet obtenerEventos(){
|
||||
ResultSet rs = null;
|
||||
return rs;
|
||||
}
|
||||
|
||||
// Boleto
|
||||
|
||||
public ResultSet obtenerBoletosPorEvento(int idEvento){
|
||||
ResultSet rs = null;
|
||||
return rs;
|
||||
}
|
||||
|
||||
public boolean actualizarEstadoBoleto(int idBoleto, String nuevoEstado, LocalDateTime fechaVenta, Integer idVenta){
|
||||
return true;
|
||||
}
|
||||
|
||||
public ResultSet getBoleto(int idEvento, int idAsiento){
|
||||
ResultSet rs = null;
|
||||
return rs;
|
||||
}
|
||||
|
||||
// Venta
|
||||
public boolean registrarVenta(Venta venta){
|
||||
return true;
|
||||
}
|
||||
|
||||
public ResultSet getVentasPorPeriodo(LocalDateTime inicio, LocalDateTime fin){
|
||||
ResultSet rs = null;
|
||||
return rs;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,55 @@
|
|||
package model;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
public class Venta {
|
||||
private int idVenta;
|
||||
private int idEvento;
|
||||
private LocalDateTime fechaVenta;
|
||||
private String vendedor;
|
||||
private List<Boleto> boletos;
|
||||
|
||||
public void setIdVenta(int idVenta) {
|
||||
this.idVenta = idVenta;
|
||||
}
|
||||
|
||||
public void setIdEvento(int idEvento) {
|
||||
this.idEvento = idEvento;
|
||||
}
|
||||
|
||||
public void setFechaVenta(LocalDateTime fechaVenta) {
|
||||
this.fechaVenta = fechaVenta;
|
||||
}
|
||||
|
||||
public void setBoletos(List<Boleto> boletos) {
|
||||
this.boletos = boletos;
|
||||
}
|
||||
|
||||
public void setVendedor(String vendedor) {
|
||||
this.vendedor = vendedor;
|
||||
}
|
||||
|
||||
public int getIdVenta() {
|
||||
return idVenta;
|
||||
}
|
||||
|
||||
public int getIdEvento() {
|
||||
return idEvento;
|
||||
}
|
||||
|
||||
public LocalDateTime getFechaVenta() {
|
||||
return fechaVenta;
|
||||
}
|
||||
|
||||
public String getVendedor() {
|
||||
return vendedor;
|
||||
}
|
||||
|
||||
public List<Boleto> getBoletos() {
|
||||
return boletos;
|
||||
}
|
||||
|
||||
// métodos para agregar boletos, calcular total, etc.
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package modelo;
|
||||
|
||||
public class Asiento {
|
||||
private String idEvento;
|
||||
private boolean reservado;
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package modelo;
|
||||
|
||||
public class Boleto {
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package modelo;
|
||||
|
||||
public class Evento {
|
||||
private int id_evento;
|
||||
private String nombre;
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package modelo;
|
||||
|
||||
public class Reporte {
|
||||
|
||||
}
|
|
@ -1,5 +0,0 @@
|
|||
package modelo;
|
||||
|
||||
public class Venta {
|
||||
|
||||
}
|
|
@ -10,9 +10,6 @@
|
|||
<Property name="location" type="java.awt.Point" editor="org.netbeans.beaninfo.editors.PointEditor">
|
||||
<Point value="[0, 0]"/>
|
||||
</Property>
|
||||
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[1280, 720]"/>
|
||||
</Property>
|
||||
<Property name="size" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
|
||||
<Dimension value="[0, 0]"/>
|
||||
</Property>
|
|
@ -1,4 +1,4 @@
|
|||
package vista;
|
||||
package view;
|
||||
|
||||
import java.awt.BorderLayout;
|
||||
|
||||
|
@ -24,7 +24,6 @@ public class Menu extends javax.swing.JFrame {
|
|||
setTitle("Aplicación de venta de boletos");
|
||||
setBackground(new java.awt.Color(255, 255, 255));
|
||||
setLocation(new java.awt.Point(0, 0));
|
||||
setPreferredSize(new java.awt.Dimension(1280, 720));
|
||||
setSize(new java.awt.Dimension(0, 0));
|
||||
|
||||
jLabel1.setFont(new java.awt.Font("Gill Sans MT", 0, 14)); // NOI18N
|
|
@ -2,7 +2,7 @@
|
|||
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
|
||||
* Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JPanel.java to edit this template
|
||||
*/
|
||||
package vista;
|
||||
package view;
|
||||
|
||||
import javax.swing.JToggleButton;
|
||||
|
Loading…
Reference in New Issue