├── lib
├── mail-1.4.5.jar
├── mail-1.4.7.jar
├── activation-1.1.1.jar
├── commons-email-1.5.jar
├── postgresql-42.2.5.jar
└── commons-email-1.3.1.jar
├── manifest.mf
├── src
├── ViewsImagens
│ ├── Banner.jpg
│ ├── MenuBar.jpg
│ ├── service.jpg
│ ├── BannerPC.jpg
│ ├── Logo (2).png
│ └── Logo_resized.png
├── ViewsIcons
│ ├── agenda-icon.png
│ ├── cliente-icon.png
│ ├── tesoura-icon.png
│ ├── usuario-icon.png
│ ├── agenda32-icon.png
│ ├── cliente32-icon.png
│ ├── tesoura32-icon.png
│ ├── usuario32-icon.png
│ ├── relatorioTrabalho-icon.png
│ ├── relatorioTrabalho24-icon.png
│ └── relatorioTrabalho32-icon.png
├── DAO
│ ├── Conexao.java
│ ├── ServiceDAO.java
│ ├── UsuarioDAO.java
│ ├── ClienteDAO.java
│ └── AgendamentoDAO.java
├── ServiceEmail
│ ├── EmailTeste.java
│ ├── Correio.java
│ └── Email.java
├── Model
│ ├── Cliente.java
│ ├── Service.java
│ ├── Usuario.java
│ └── Agendamento.java
├── Controller
│ ├── ClienteController.java
│ ├── HorarioController.java
│ ├── ServicesController.java
│ ├── AgendamentoController.java
│ └── BarbeiroController.java
└── Views
│ ├── MenuCliente.java
│ ├── TelaService.form
│ ├── MenuCliente.form
│ ├── TelaService.java
│ ├── LoginBarbeiro.java
│ ├── LoginBarbeiro.form
│ ├── MenuBarbeiro.form
│ ├── MenuBarbeiro.java
│ ├── ControleHorario.form
│ └── AddService.form
├── nbproject
├── private
│ ├── private.properties
│ └── private.xml
├── genfiles.properties
├── project.xml
└── project.properties
└── README.md
/lib/mail-1.4.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/lib/mail-1.4.5.jar
--------------------------------------------------------------------------------
/lib/mail-1.4.7.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/lib/mail-1.4.7.jar
--------------------------------------------------------------------------------
/lib/activation-1.1.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/lib/activation-1.1.1.jar
--------------------------------------------------------------------------------
/lib/commons-email-1.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/lib/commons-email-1.5.jar
--------------------------------------------------------------------------------
/lib/postgresql-42.2.5.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/lib/postgresql-42.2.5.jar
--------------------------------------------------------------------------------
/manifest.mf:
--------------------------------------------------------------------------------
1 | Manifest-Version: 1.0
2 | X-COMMENT: Main-Class will be added automatically by build
3 |
4 |
--------------------------------------------------------------------------------
/lib/commons-email-1.3.1.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/lib/commons-email-1.3.1.jar
--------------------------------------------------------------------------------
/src/ViewsImagens/Banner.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsImagens/Banner.jpg
--------------------------------------------------------------------------------
/src/ViewsImagens/MenuBar.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsImagens/MenuBar.jpg
--------------------------------------------------------------------------------
/src/ViewsImagens/service.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsImagens/service.jpg
--------------------------------------------------------------------------------
/src/ViewsIcons/agenda-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/agenda-icon.png
--------------------------------------------------------------------------------
/src/ViewsIcons/cliente-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/cliente-icon.png
--------------------------------------------------------------------------------
/src/ViewsIcons/tesoura-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/tesoura-icon.png
--------------------------------------------------------------------------------
/src/ViewsIcons/usuario-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/usuario-icon.png
--------------------------------------------------------------------------------
/src/ViewsImagens/BannerPC.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsImagens/BannerPC.jpg
--------------------------------------------------------------------------------
/src/ViewsImagens/Logo (2).png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsImagens/Logo (2).png
--------------------------------------------------------------------------------
/src/ViewsIcons/agenda32-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/agenda32-icon.png
--------------------------------------------------------------------------------
/src/ViewsIcons/cliente32-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/cliente32-icon.png
--------------------------------------------------------------------------------
/src/ViewsIcons/tesoura32-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/tesoura32-icon.png
--------------------------------------------------------------------------------
/src/ViewsIcons/usuario32-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/usuario32-icon.png
--------------------------------------------------------------------------------
/src/ViewsImagens/Logo_resized.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsImagens/Logo_resized.png
--------------------------------------------------------------------------------
/src/ViewsIcons/relatorioTrabalho-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/relatorioTrabalho-icon.png
--------------------------------------------------------------------------------
/src/ViewsIcons/relatorioTrabalho24-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/relatorioTrabalho24-icon.png
--------------------------------------------------------------------------------
/src/ViewsIcons/relatorioTrabalho32-icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/FGabriel0/BarberShop/HEAD/src/ViewsIcons/relatorioTrabalho32-icon.png
--------------------------------------------------------------------------------
/nbproject/private/private.properties:
--------------------------------------------------------------------------------
1 | compile.on.save=true
2 | user.properties.file=C:\\Users\\Biel\\AppData\\Roaming\\NetBeans\\18\\build.properties
3 |
--------------------------------------------------------------------------------
/nbproject/genfiles.properties:
--------------------------------------------------------------------------------
1 | build.xml.data.CRC32=48162130
2 | build.xml.script.CRC32=4da77d47
3 | build.xml.stylesheet.CRC32=f85dc8f2@1.107.0.48
4 | # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
5 | # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
6 | nbproject/build-impl.xml.data.CRC32=48162130
7 | nbproject/build-impl.xml.script.CRC32=7d1ce527
8 | nbproject/build-impl.xml.stylesheet.CRC32=12e0a6c2@1.107.0.48
9 |
--------------------------------------------------------------------------------
/nbproject/project.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 | org.netbeans.modules.java.j2seproject
4 |
5 |
6 | BarberShop
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/src/DAO/Conexao.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package DAO;
6 |
7 | import java.sql.Connection;
8 | import java.sql.DriverManager;
9 | import java.sql.SQLException;
10 | /**
11 | *
12 | * @author Biel
13 | */
14 | public class Conexao {
15 |
16 | public Connection getConnection() throws SQLException{
17 | Connection conexao = DriverManager.getConnection("jdbc:postgresql://localhost:5432/BarberShop","postgres", "admin");
18 | return conexao;
19 | }
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/nbproject/private/private.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | file:/C:/Users/Biel/Documents/NetBeansProjects/BarberShop/src/Model/Agendamento.java
7 | file:/C:/Users/Biel/Documents/NetBeansProjects/BarberShop/src/Views/MenuCliente.java
8 | file:/C:/Users/Biel/Documents/NetBeansProjects/BarberShop/src/Views/CadastroCliente.java
9 |
10 |
11 |
12 |
--------------------------------------------------------------------------------
/src/ServiceEmail/EmailTeste.java:
--------------------------------------------------------------------------------
1 | /*
2 | * To change this license header, choose License Headers in Project Properties.
3 | * To change this template file, choose Tools | Templates
4 | * and open the template in the editor.
5 | */
6 | package ServiceEmail;
7 |
8 | import org.apache.commons.mail.DefaultAuthenticator;
9 | import org.apache.commons.mail.EmailException;
10 | import org.apache.commons.mail.SimpleEmail;
11 |
12 | /**
13 | *
14 | * @author Denner Dias
15 | */
16 | public class EmailTeste {
17 |
18 | /**
19 | * @param args the command line arguments
20 | */
21 | public static void main(String[] args) {
22 |
23 |
24 | Email email = new Email("Senha e Usuário Sistema Service Desk", "Seggue usuário e senha para acesso ao sistema de auditoria\n"+"Usuario:FelipeSoster\n"+"gabrielcarrosel", "carrosel3g@gmail.com");
25 |
26 | email.enviar();
27 |
28 |
29 | }
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/src/ServiceEmail/Correio.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package ServiceEmail;
6 |
7 | import Model.Agendamento;
8 | /**
9 | *
10 | * @author Biel
11 | */
12 | public class Correio {
13 | public void NotificarEmail(Agendamento agendamento){
14 |
15 | String emailFormat = formartEmail(agendamento);
16 | String destinatario = agendamento.getEmail();
17 |
18 | Email email = new Email("BarberShop", emailFormat, destinatario);
19 |
20 | }
21 |
22 | private String formartEmail(Agendamento agendamento) {
23 | String nomeCliente = agendamento.getNome();
24 | String Servico = agendamento.getServico_id();
25 | String Data = agendamento.getData();
26 | String Hora = agendamento.getHora();
27 | String price = agendamento.getPrice_agendamento();
28 | String Observacao = agendamento.getObservacao();
29 |
30 | return "Olá " + nomeCliente + "Vai dar um Tapa no visu... Seu agendamento para "+
31 | Servico + ",Esta marcado para o dia " + Data + "às " + Hora + "o vai sair baratinho de " +
32 | price + ".\n Um Forte Abraço e aguadamos você..." ;
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/src/Model/Cliente.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package Model;
6 |
7 | /**
8 | *
9 | * @author Biel
10 | */
11 | public class Cliente {
12 |
13 | private int id;
14 | private String nome;
15 | private String email;
16 | private String senha;
17 |
18 | public Cliente(int id, String nome, String email, String senha) {
19 | this.id = id;
20 | this.nome = nome;
21 | this.email = email;
22 | this.senha = senha;
23 | }
24 |
25 | public Cliente(String nome, String email, String senha) {
26 | this.nome = nome;
27 | this.email = email;
28 | this.senha = senha;
29 | }
30 |
31 | public Cliente(String email, String senha) {
32 | this.email = email;
33 | this.senha = senha;
34 | }
35 | public Cliente(int id,String nome, String senha) {
36 | this.id = id;
37 | this.nome = nome;
38 | this.senha = senha;
39 | }
40 |
41 |
42 | public int getId() {
43 | return id;
44 | }
45 |
46 | public void setId(int id) {
47 | this.id = id;
48 | }
49 |
50 | public String getNome() {
51 | return nome;
52 | }
53 |
54 | public void setNome(String nome) {
55 | this.nome = nome;
56 | }
57 |
58 | public String getEmail() {
59 | return email;
60 | }
61 |
62 | public void setEmail(String email) {
63 | this.email = email;
64 | }
65 |
66 | public String getSenha() {
67 | return senha;
68 | }
69 |
70 | public void setSenha(String senha) {
71 | this.senha = senha;
72 | }
73 |
74 |
75 |
76 | }
77 |
--------------------------------------------------------------------------------
/src/Model/Service.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package Model;
6 |
7 | /**
8 | *
9 | * @author Biel
10 | */
11 |
12 | public class Service {
13 | private int id;
14 | private String imagem;
15 | private String nome;
16 | private String price;
17 |
18 | public Service(int id, String imagem, String nome, String price) {
19 | this.id = id;
20 | this.imagem = imagem;
21 | this.nome = nome;
22 | this.price = price;
23 | }
24 |
25 | public Service(int id) {
26 | this.id = id;
27 | }
28 |
29 |
30 | public Service(String imagem, String nome, String price) {
31 | this.imagem = imagem;
32 | this.nome = nome;
33 | this.price = price;
34 | }
35 |
36 | public Service(int id, String nome, String price) {
37 | this.id = id;
38 | this.nome = nome;
39 | this.price = price;
40 | }
41 |
42 |
43 | public Service(String nome) {
44 | this.nome = nome;
45 | }
46 |
47 | public int getId() {
48 | return id;
49 | }
50 |
51 | public void setId(int id) {
52 | this.id = id;
53 | }
54 |
55 | public String getImagem() {
56 | return imagem;
57 | }
58 |
59 | public void setImagem(String imagem) {
60 | this.imagem = imagem;
61 | }
62 |
63 | public String getNome() {
64 | return nome;
65 | }
66 |
67 | public void setNome(String nome) {
68 | this.nome = nome;
69 | }
70 |
71 | public String getPrice() {
72 | return price;
73 | }
74 |
75 | public void setPrice(String price) {
76 | this.price = price;
77 | }
78 |
79 | @Override
80 | public String toString() {
81 | return "Service{" + "nome=" + nome + '}';
82 | }
83 |
84 |
85 |
86 |
87 | }
88 |
--------------------------------------------------------------------------------
/src/Model/Usuario.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package Model;
6 |
7 | /**
8 | *
9 | * @author Biel
10 | */
11 | public class Usuario {
12 |
13 | private int id;
14 | private String nome;
15 | private String email;
16 | private String cpf;
17 | private String data_Nasc;
18 | private String senha;
19 |
20 | public Usuario(int id, String nome, String email, String cpf, String data_Nasc, String senha) {
21 | this.id = id;
22 | this.nome = nome;
23 | this.email = email;
24 | this.cpf = cpf;
25 | this.data_Nasc = data_Nasc;
26 | this.senha = senha;
27 | }
28 |
29 | public Usuario(String nome, String senha) {
30 | this.nome = nome;
31 | this.senha = senha;
32 | }
33 |
34 | public Usuario(String nome, String email, String cpf, String data_Nasc, String senha) {
35 | this.nome = nome;
36 | this.email = email;
37 | this.cpf = cpf;
38 | this.data_Nasc = data_Nasc;
39 | this.senha = senha;
40 | }
41 |
42 | public Usuario(String nome) {
43 | this.nome = nome;
44 | }
45 |
46 |
47 |
48 |
49 | public int getId() {
50 | return id;
51 | }
52 |
53 | public void setId(int id) {
54 | this.id = id;
55 | }
56 |
57 | public String getNome() {
58 | return nome;
59 | }
60 |
61 | public void setNome(String nome) {
62 | this.nome = nome;
63 | }
64 |
65 | public String getSenha() {
66 | return senha;
67 | }
68 |
69 | public String getEmail() {
70 | return email;
71 | }
72 |
73 | public void setEmail(String email) {
74 | this.email = email;
75 | }
76 |
77 | public String getCpf() {
78 | return cpf;
79 | }
80 |
81 | public void setCpf(String cpf) {
82 | this.cpf = cpf;
83 | }
84 |
85 | public String getData_Nasc() {
86 | return data_Nasc;
87 | }
88 |
89 | public void setData_Nasc(String data_Nasc) {
90 | this.data_Nasc = data_Nasc;
91 | }
92 |
93 | public void setSenha(String senha) {
94 | this.senha = senha;
95 | }
96 |
97 |
98 |
99 |
100 | }
101 |
--------------------------------------------------------------------------------
/src/ServiceEmail/Email.java:
--------------------------------------------------------------------------------
1 | package ServiceEmail;
2 |
3 | import org.apache.commons.mail.DefaultAuthenticator;
4 | import org.apache.commons.mail.EmailException;
5 | import org.apache.commons.mail.HtmlEmail;
6 | import org.apache.commons.mail.SimpleEmail;
7 |
8 | /**
9 | * Classe responsável por enviar E-mail.
10 | * @author Biel
11 | */
12 | public class Email {
13 | static final String REMETENTE_NOME = "sbaber026@gmail.com";
14 | static final String REMETENTE_SENHA = "barbershopadmin";
15 | private String assunto ;
16 | private String mensagem;
17 | private String destinatario;
18 |
19 | /**
20 | *
21 | * @param assunto Assunto para envio do E-mail.
22 | * @param mensagem Mensagem qual vai ser enviado ao destinatário.
23 | * @param destinatario E-mail do destinatário.
24 | */
25 | public Email(String assunto, String mensagem, String destinatario) {
26 | this.assunto = assunto;
27 | this.mensagem = mensagem;
28 | this.destinatario = destinatario;
29 | }
30 |
31 |
32 |
33 | public String getAssunto() {
34 | return assunto;
35 | }
36 |
37 | public void setAssunto(String assunto) {
38 | this.assunto = assunto;
39 | }
40 |
41 | public String getMensagem() {
42 | return mensagem;
43 | }
44 |
45 | public void setMensagem(String mensagem) {
46 | this.mensagem = mensagem;
47 | }
48 |
49 | public String getDestinatario() {
50 | return destinatario;
51 | }
52 |
53 | public void setDestinatario(String destinatario) {
54 | this.destinatario = destinatario;
55 | }
56 |
57 | /**
58 | * Função para enviar o e-mail ao destinatário.
59 | */
60 | public void enviar (){
61 |
62 | System.setProperty("mail.smtp.starttls.enable", "true");
63 |
64 |
65 | HtmlEmail email = new HtmlEmail();
66 | email.setSSL(true);
67 | email.setHostName("smtp.gmail.com");
68 | email.setSmtpPort(465); // Use a porta 465 para SSL
69 | email.setAuthenticator(new DefaultAuthenticator(REMETENTE_NOME, REMETENTE_SENHA));
70 |
71 |
72 | try {
73 | email.setFrom(REMETENTE_NOME);
74 |
75 | email.setDebug(true);
76 |
77 | email.setSubject(this.assunto);
78 | email.setMsg(this.mensagem);
79 | email.addTo(this.destinatario);//por favor trocar antes de testar!!!!
80 |
81 | email.send();
82 |
83 | } catch (EmailException e) {
84 | e.printStackTrace();
85 | }
86 | }
87 |
88 | }
89 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # BarberShop
2 |
3 | Este é um projeto de sistema de gerenciamento para uma barbearia, desenvolvido em Java e utilizando PostgreSQL como banco de dados. O desenvolvimento foi realizado utilizando o IDE NetBeans.
4 |
5 | ## Descrição
6 |
7 | O projeto BarberShop foi criado para gerenciar agendamentos, clientes, serviços e funcionários de uma barbearia. Com este sistema, é possível realizar cadastros, atualizações, exclusões e consultas de dados relacionados à barbearia, além de facilitar o controle de horários e a organização do estabelecimento.
8 |
9 | ## Tecnologias Utilizadas
10 |
11 | - **Java:** Linguagem de programação utilizada para desenvolver a aplicação.
12 | - **PostgreSQL:** Sistema de gerenciamento de banco de dados relacional utilizado para armazenar os dados da aplicação.
13 | - **NetBeans:** Ambiente de desenvolvimento integrado (IDE) utilizado para o desenvolvimento do projeto.
14 |
15 | ## Funcionalidades
16 |
17 | - Cadastro de clientes
18 | - Cadastro de funcionários
19 | - Cadastro de serviços
20 | - Agendamento de horários
21 | - Consulta e atualização de dados
22 | - Relatórios de atendimentos
23 |
24 | ## Requisitos
25 |
26 | - **Java 11 ou superior**
27 | - **PostgreSQL 12 ou superior**
28 | - **NetBeans 12 ou superior**
29 |
30 | ## Instalação
31 |
32 | 1. Clone o repositório para a sua máquina local:
33 | ```bash
34 | git clone https://github.com/seu-usuario/barberShop.git
35 | ```
36 |
37 | 2. Abra o NetBeans e importe o projeto:
38 | - Vá em `File` > `Open Project` e selecione o diretório onde o projeto foi clonado.
39 |
40 | 3. Configure o banco de dados PostgreSQL:
41 | - Crie um banco de dados chamado `barbershop`:
42 | ```sql
43 | CREATE DATABASE barbershop;
44 | ```
45 |
46 | - Execute o script SQL de criação das tabelas (localizado em `sql/create_tables.sql`):
47 | ```bash
48 | psql -U seu_usuario -d barbershop -f sql/create_tables.sql
49 | ```
50 |
51 | 4. Configure as credenciais do banco de dados no arquivo `src/main/resources/application.properties`:
52 | ```properties
53 | spring.datasource.url=jdbc:postgresql://localhost:5432/barbershop
54 | spring.datasource.username=seu_usuario
55 | spring.datasource.password=sua_senha
56 | ```
57 |
58 | 5. Compile e execute a aplicação pelo NetBeans:
59 | - Clique com o botão direito no projeto e selecione `Clean and Build`.
60 | - Após a compilação, clique com o botão direito no projeto novamente e selecione `Run`.
61 |
62 | ## Uso
63 |
64 | 1. Abra o navegador e acesse `http://localhost:8080` para acessar a interface do sistema.
65 | 2. Utilize os menus para navegar pelas funcionalidades disponíveis, como cadastro de clientes, agendamento de horários, etc.
66 |
67 |
68 |
--------------------------------------------------------------------------------
/src/Controller/ClienteController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package Controller;
6 |
7 | import DAO.AgendamentoDAO;
8 | import DAO.ClienteDAO;
9 | import DAO.Conexao;
10 | import Model.Agendamento;
11 | import Model.Cliente;
12 | import Views.Agendar;
13 | import Views.CadastroCliente;
14 | import Views.LoginCliente;
15 | import Views.MenuCliente;
16 | import java.sql.Connection;
17 | import java.sql.SQLException;
18 | import java.text.ParseException;
19 | import java.text.SimpleDateFormat;
20 | import java.util.ArrayList;
21 | import java.util.Date;
22 | import java.util.List;
23 | import java.util.logging.Level;
24 | import java.util.logging.Logger;
25 | import javax.swing.JLabel;
26 | import javax.swing.JOptionPane;
27 | import javax.swing.table.DefaultTableModel;
28 |
29 | /**
30 | *
31 | * @author Biel
32 | */
33 | public class ClienteController {
34 |
35 | private LoginCliente login;
36 | private CadastroCliente cadastrar;
37 | private Agendar agendar;
38 | private MenuCliente menu;
39 |
40 |
41 | public ClienteController(MenuCliente menu) {
42 | this.menu = menu;
43 | }
44 |
45 | public ClienteController(LoginCliente login) {
46 | this.login = login;
47 | }
48 |
49 | public ClienteController(CadastroCliente cadastrar) {
50 | this.cadastrar = cadastrar;
51 | }
52 |
53 |
54 |
55 | public void Autenticar() throws SQLException {
56 | String email = login.getTextName().getText();
57 | String senha = login.getTextPassword().getText();
58 |
59 | Cliente clienteAutenticar = new Cliente(email, senha);
60 |
61 | // Verificar se o cliente existe no banco de dados
62 | Connection conexao = new Conexao().getConnection();
63 | ClienteDAO clienteDAO = new ClienteDAO(conexao);
64 |
65 | Cliente clienteAutenticado = clienteDAO.autenticarCliente(clienteAutenticar);
66 |
67 | if (clienteAutenticado != null) {
68 | // Autenticação bem-sucedida
69 | MenuCliente menu = new MenuCliente();
70 | ClienteController controller = new ClienteController(menu);
71 | menu.setVisible(true);
72 | login.setVisible(false);
73 |
74 | // Chame a função para atualizar a tabela de agendamentos, passando o cliente autenticado
75 | } else {
76 | JOptionPane.showMessageDialog(null, "Cliente Não Encontrado no Banco");
77 | }
78 | }
79 |
80 | public void salvarCliente(){
81 |
82 | String nome = cadastrar.getTextNome().getText();
83 | String email = cadastrar.getTextEmail().getText();
84 | String senha = cadastrar.getTextSenha().getText();
85 |
86 | Cliente cliente = new Cliente(nome, email, senha);
87 |
88 |
89 | try {
90 | Connection conexao = new Conexao().getConnection();
91 | ClienteDAO clienteDAO = new ClienteDAO(conexao);
92 | clienteDAO.Salvar(cliente);
93 |
94 | JOptionPane.showMessageDialog(null, "Cliente Salvo com Sucesso");
95 | cadastrar.dispose();
96 | LoginCliente loginCliente = new LoginCliente();
97 | loginCliente.setVisible(true);
98 |
99 | } catch (SQLException ex) {
100 | Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, ex);
101 | }
102 | }
103 |
104 | public void atualizarTextoBoasVindas(String nome){
105 | JLabel welcomeLabel = menu.getWelcomeCliente();
106 | welcomeLabel.setText("Seja Bem-Vindo: "+ nome);
107 |
108 | }
109 |
110 |
111 |
112 |
113 | }
114 |
--------------------------------------------------------------------------------
/src/Controller/HorarioController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package Controller;
6 |
7 | import DAO.Conexao;
8 | import DAO.ServiceDAO;
9 | import Model.Service;
10 | import Views.ControleHorario;
11 | import java.sql.Connection;
12 | import java.sql.SQLException;
13 | import java.text.SimpleDateFormat;
14 | import java.time.LocalTime;
15 | import java.time.format.DateTimeFormatter;
16 | import java.util.ArrayList;
17 | import java.util.Calendar;
18 | import java.util.Date;
19 | import javax.swing.JComboBox;
20 |
21 | /**
22 | *
23 | * @author Biel
24 | */
25 | public class HorarioController {
26 |
27 | private ControleHorario controller;
28 |
29 | public HorarioController(ControleHorario controller) {
30 | this.controller = controller;
31 | }
32 |
33 | public void AdicionandoHorasTermino() throws SQLException{
34 | Connection conexao = new Conexao().getConnection();
35 | ServiceDAO serviceDAO = new ServiceDAO(conexao);
36 |
37 | ArrayList listar = serviceDAO.Buscar();
38 |
39 |
40 | ArrayList horas = new ArrayList<>();
41 | LocalTime currentTime = LocalTime.of(8, 0);
42 |
43 | while(currentTime.isBefore(LocalTime.of(20, 30))){
44 | horas.add(currentTime.format(DateTimeFormatter.ofPattern("HH:mm")));
45 |
46 | currentTime = currentTime.plusMinutes(30);
47 | }
48 | JComboBox dataComboBox = controller.getHoradeInicio();
49 | dataComboBox.removeAllItems();
50 | for(String hora : horas){
51 | dataComboBox.addItem(hora);
52 | }
53 |
54 | }
55 |
56 |
57 | public void AdicionandoHoras() throws SQLException{
58 | Connection conexao = new Conexao().getConnection();
59 | ServiceDAO serviceDAO = new ServiceDAO(conexao);
60 |
61 | ArrayList listar = serviceDAO.Buscar();
62 |
63 |
64 | ArrayList horas = new ArrayList<>();
65 | LocalTime currentTime = LocalTime.of(8, 0);
66 |
67 | while(currentTime.isBefore(LocalTime.of(20, 30))){
68 | horas.add(currentTime.format(DateTimeFormatter.ofPattern("HH:mm")));
69 |
70 | currentTime = currentTime.plusMinutes(30);
71 | }
72 | JComboBox dataComboBox = controller.getHoradeInicio();
73 | dataComboBox.removeAllItems();
74 | for(String hora : horas){
75 | dataComboBox.addItem(hora);
76 | }
77 |
78 | }
79 |
80 | public void AdicionandoData(){
81 |
82 | Calendar calendar = Calendar.getInstance();
83 | SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
84 |
85 |
86 | int year = calendar.get(Calendar.YEAR);
87 | int month = calendar.get(Calendar.MONTH);
88 | int day = calendar.get(Calendar.DAY_OF_MONTH);
89 |
90 | //Data Atual
91 | calendar.set(Calendar.YEAR, year);
92 | calendar.set(Calendar.MONTH, month);
93 | calendar.set(Calendar.DAY_OF_MONTH, day);
94 |
95 |
96 | while (year == calendar.get(Calendar.YEAR)) {
97 | Date date = calendar.getTime();
98 | boolean horaJaAgendada = false;
99 |
100 | if (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
101 | controller.getDiaController().addItem(dateFormat.format(date));
102 | }
103 | calendar.add(Calendar.DAY_OF_MONTH, 1);
104 |
105 | }
106 |
107 | }
108 |
109 |
110 | }
111 |
--------------------------------------------------------------------------------
/nbproject/project.properties:
--------------------------------------------------------------------------------
1 | annotation.processing.enabled=true
2 | annotation.processing.enabled.in.editor=false
3 | annotation.processing.processor.options=
4 | annotation.processing.processors.list=
5 | annotation.processing.run.all.processors=true
6 | annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
7 | build.classes.dir=${build.dir}/classes
8 | build.classes.excludes=**/*.java,**/*.form
9 | # This directory is removed when the project is cleaned:
10 | build.dir=build
11 | build.generated.dir=${build.dir}/generated
12 | build.generated.sources.dir=${build.dir}/generated-sources
13 | # Only compile against the classpath explicitly listed here:
14 | build.sysclasspath=ignore
15 | build.test.classes.dir=${build.dir}/test/classes
16 | build.test.results.dir=${build.dir}/test/results
17 | # Uncomment to specify the preferred debugger connection transport:
18 | #debug.transport=dt_socket
19 | debug.classpath=\
20 | ${run.classpath}
21 | debug.modulepath=\
22 | ${run.modulepath}
23 | debug.test.classpath=\
24 | ${run.test.classpath}
25 | debug.test.modulepath=\
26 | ${run.test.modulepath}
27 | # Files in build.classes.dir which should be excluded from distribution jar
28 | dist.archive.excludes=
29 | # This directory is removed when the project is cleaned:
30 | dist.dir=dist
31 | dist.jar=${dist.dir}/BarberShop.jar
32 | dist.javadoc.dir=${dist.dir}/javadoc
33 | dist.jlink.dir=${dist.dir}/jlink
34 | dist.jlink.output=${dist.jlink.dir}/BarberShop
35 | excludes=
36 | file.reference.activation-1.1.1.jar=lib\\activation-1.1.1.jar
37 | file.reference.commons-email-1.3.1.jar=lib\\commons-email-1.3.1.jar
38 | file.reference.commons-email-1.5.jar=lib\\commons-email-1.5.jar
39 | file.reference.mail-1.4.5.jar=lib\\mail-1.4.5.jar
40 | file.reference.mail-1.4.7.jar=lib\\mail-1.4.7.jar
41 | file.reference.postgresql-42.2.5.jar=lib\\postgresql-42.2.5.jar
42 | includes=**
43 | jar.compress=false
44 | javac.classpath=\
45 | ${libs.absolutelayout.classpath}:\
46 | ${file.reference.postgresql-42.2.5.jar}:\
47 | ${file.reference.activation-1.1.1.jar}:\
48 | ${file.reference.commons-email-1.3.1.jar}:\
49 | ${file.reference.mail-1.4.5.jar}:\
50 | ${file.reference.commons-email-1.5.jar}:\
51 | ${file.reference.mail-1.4.7.jar}
52 | # Space-separated list of extra javac options
53 | javac.compilerargs=
54 | javac.deprecation=false
55 | javac.external.vm=true
56 | javac.modulepath=
57 | javac.processormodulepath=
58 | javac.processorpath=\
59 | ${javac.classpath}
60 | javac.source=11
61 | javac.target=11
62 | javac.test.classpath=\
63 | ${javac.classpath}:\
64 | ${build.classes.dir}
65 | javac.test.modulepath=\
66 | ${javac.modulepath}
67 | javac.test.processorpath=\
68 | ${javac.test.classpath}
69 | javadoc.additionalparam=
70 | javadoc.author=false
71 | javadoc.encoding=${source.encoding}
72 | javadoc.html5=false
73 | javadoc.noindex=false
74 | javadoc.nonavbar=false
75 | javadoc.notree=false
76 | javadoc.private=false
77 | javadoc.splitindex=true
78 | javadoc.use=true
79 | javadoc.version=false
80 | javadoc.windowtitle=
81 | # The jlink additional root modules to resolve
82 | jlink.additionalmodules=
83 | # The jlink additional command line parameters
84 | jlink.additionalparam=
85 | jlink.launcher=true
86 | jlink.launcher.name=BarberShop
87 | main.class=Views.LoginCliente
88 | manifest.file=manifest.mf
89 | meta.inf.dir=${src.dir}/META-INF
90 | mkdist.disabled=false
91 | platform.active=default_platform
92 | run.classpath=\
93 | ${javac.classpath}:\
94 | ${build.classes.dir}
95 | # Space-separated list of JVM arguments used when running the project.
96 | # You may also define separate properties like run-sys-prop.name=value instead of -Dname=value.
97 | # To set system properties for unit tests define test-sys-prop.name=value:
98 | run.jvmargs=
99 | run.modulepath=\
100 | ${javac.modulepath}
101 | run.test.classpath=\
102 | ${javac.test.classpath}:\
103 | ${build.test.classes.dir}
104 | run.test.modulepath=\
105 | ${javac.test.modulepath}
106 | source.encoding=UTF-8
107 | src.dir=src
108 | test.src.dir=test
109 |
--------------------------------------------------------------------------------
/src/DAO/ServiceDAO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package DAO;
6 | import Model.Service;
7 | import java.sql.Connection;
8 | import java.sql.PreparedStatement;
9 | import java.sql.ResultSet;
10 | import java.sql.SQLException;
11 | import java.util.ArrayList;
12 | /**
13 | *
14 | * @author Biel
15 | */
16 | public class ServiceDAO {
17 |
18 | private final Connection connection;
19 |
20 | public ServiceDAO(Connection connection) {
21 | this.connection = connection;
22 | }
23 |
24 | public void Salvar(Service services) throws SQLException{
25 |
26 | String sql = "insert into services(imagem,nome,price) values(? , ?, ?)";
27 |
28 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
29 | prepareStatement.setString(1, services.getImagem());
30 | prepareStatement.setString(2, services.getNome());
31 | prepareStatement.setString(3, services.getPrice());
32 |
33 | prepareStatement.execute();
34 | connection.close();
35 |
36 | }
37 |
38 | public void Atualizar(Service services) throws SQLException{
39 | String sql = "update services set imagem = ? ,nome = ?, price = ? where id = ? ";
40 |
41 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
42 | prepareStatement.setString(1, services.getImagem());
43 | prepareStatement.setString(2, services.getNome());
44 | prepareStatement.setString(3, services.getPrice());
45 | prepareStatement.setInt(4, services.getId());
46 | prepareStatement.execute();
47 |
48 | connection.close();
49 | }
50 |
51 | public void SalvarouAtualiza(Service services) throws SQLException{
52 | if(services.getId() > 0){
53 | Atualizar(services);
54 | }
55 | else{
56 | Salvar(services);
57 | }
58 | }
59 |
60 | public void Deleta(Service services) throws SQLException{
61 | String sql = "DELETE from services where id = ? ";
62 |
63 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
64 | prepareStatement.setInt(1, services.getId());
65 | prepareStatement.executeUpdate();
66 |
67 | connection.close();
68 | }
69 |
70 | public ArrayList Buscar() throws SQLException{
71 | String sql = "select * from services";
72 |
73 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
74 | prepareStatement.execute();
75 |
76 | return pesquisa(prepareStatement);
77 | }
78 |
79 | private ArrayList pesquisa(PreparedStatement prepareStatement) throws SQLException {
80 | ArrayList services = new ArrayList();
81 |
82 | prepareStatement.execute();
83 | ResultSet resultSet = prepareStatement.getResultSet();
84 |
85 | while(resultSet.next()){
86 | int id = resultSet.getInt("id");
87 |
88 | String imagem = resultSet.getString("imagem");
89 | String nome = resultSet.getString("nome");
90 | String price = resultSet.getString("price");
91 |
92 | Service serviceEncontrado = new Service(id, imagem, nome, price);
93 | services.add(serviceEncontrado);
94 |
95 | }
96 | return services;
97 | }
98 |
99 | public Service BuscarPorId(int id) throws SQLException {
100 | String sql = "SELECT * FROM services WHERE id = ?";
101 |
102 | PreparedStatement preparedStatement = connection.prepareStatement(sql);
103 | preparedStatement.setInt(1, id);
104 |
105 | ArrayList services = pesquisa(preparedStatement);
106 |
107 | if (!services.isEmpty()) {
108 | return services.get(0);
109 | } else {
110 | return null; // ou lançar uma exceção se preferir
111 | }
112 | }
113 |
114 | }
115 |
--------------------------------------------------------------------------------
/src/Model/Agendamento.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package Model;
6 |
7 | /**
8 | *
9 | * @author Biel
10 | */
11 | public class Agendamento {
12 |
13 | private int id;
14 | private String nome;
15 | private String email;
16 | private String telefone;
17 | private String servico_id;
18 | private String price_agendamento;
19 | private String data;
20 | private String hora;
21 | private String observacao;
22 |
23 | public Agendamento(int id, String nome, String email, String telefone, String servico_id, String price_agendamento, String data, String hora, String observacao, int Cliente_id) {
24 | this.id = id;
25 | this.nome = nome;
26 | this.email = email;
27 | this.telefone = telefone;
28 | this.servico_id = servico_id;
29 | this.price_agendamento = price_agendamento;
30 | this.data = data;
31 | this.hora = hora;
32 | this.observacao = observacao;
33 | }
34 |
35 | public Agendamento(int id, String nome, String email, String telefone, String servico_id, String price_agendamento, String data, String hora, String observacao) {
36 | this.id = id;
37 | this.nome = nome;
38 | this.email = email;
39 | this.telefone = telefone;
40 | this.servico_id = servico_id;
41 | this.price_agendamento = price_agendamento;
42 | this.data = data;
43 | this.hora = hora;
44 | this.observacao = observacao;
45 | }
46 |
47 | public Agendamento(int id, String nome, String telefone, String servico_id, String price_agendamento, String data, String hora, String observacao, int Cliente_id) {
48 | this.id = id;
49 | this.nome = nome;
50 | this.telefone = telefone;
51 | this.servico_id = servico_id;
52 | this.price_agendamento = price_agendamento;
53 | this.data = data;
54 | this.hora = hora;
55 | this.observacao = observacao;
56 | }
57 |
58 |
59 |
60 | public Agendamento(int id) {
61 | this.id = id;
62 | }
63 |
64 | public Agendamento(String email) {
65 | this.email = email;
66 | }
67 |
68 |
69 |
70 | public Agendamento(String nome, String email, String telefone, String servico_id, String price_agendamento, String data, String hora, String observacao) {
71 | this.nome = nome;
72 | this.email = email;
73 | this.telefone = telefone;
74 | this.servico_id = servico_id;
75 | this.price_agendamento = price_agendamento;
76 | this.data = data;
77 | this.hora = hora;
78 | this.observacao = observacao;
79 | }
80 |
81 | public String getTelefone() {
82 | return telefone;
83 | }
84 |
85 | public void setTelefone(String telefone) {
86 | this.telefone = telefone;
87 | }
88 |
89 |
90 | public int getId() {
91 | return id;
92 | }
93 |
94 | public void setId(int id) {
95 | this.id = id;
96 | }
97 |
98 | public String getNome() {
99 | return nome;
100 | }
101 |
102 | public void setNome(String nome) {
103 | this.nome = nome;
104 | }
105 |
106 | public String getServico_id() {
107 | return servico_id;
108 | }
109 |
110 | public void setServico_id(String servico_id) {
111 | this.servico_id = servico_id;
112 | }
113 |
114 | public String getPrice_agendamento() {
115 | return price_agendamento;
116 | }
117 |
118 | public void setPrice_agendamento(String price_agendamento) {
119 | this.price_agendamento = price_agendamento;
120 | }
121 |
122 | public String getData() {
123 | return data;
124 | }
125 |
126 | public void setData(String data) {
127 | this.data = data;
128 | }
129 |
130 | public String getHora() {
131 | return hora;
132 | }
133 |
134 | public void setHora(String hora) {
135 | this.hora = hora;
136 | }
137 | public String getObservacao() {
138 | return observacao;
139 | }
140 |
141 | public void setObservacao(String observacao) {
142 | this.observacao = observacao;
143 | }
144 |
145 | public String getEmail() {
146 | return email;
147 | }
148 |
149 | public void setEmail(String email) {
150 | this.email = email;
151 | }
152 |
153 |
154 |
155 |
156 |
157 | }
158 |
--------------------------------------------------------------------------------
/src/DAO/UsuarioDAO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package DAO;
6 |
7 | import Model.Usuario;
8 | import java.sql.Connection;
9 | import java.sql.PreparedStatement;
10 | import java.sql.ResultSet;
11 | import java.sql.SQLException;
12 | import java.util.ArrayList;
13 |
14 | /**
15 | *
16 | * @author Biel
17 | */
18 | public class UsuarioDAO {
19 | private final Connection connection;
20 |
21 | public UsuarioDAO(Connection connection) {
22 | this.connection = connection;
23 | }
24 |
25 | public void Salvar(Usuario usuarios) throws SQLException{
26 |
27 | String sql = "insert into usuario(nome,senha,email,cpf,datanasc) values(? , ?, ?, ? , ?)";
28 |
29 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
30 | prepareStatement.setString(1, usuarios.getNome());
31 | prepareStatement.setString(3, usuarios.getEmail());
32 | prepareStatement.setString(4, usuarios.getCpf());
33 | prepareStatement.setString(5, usuarios.getData_Nasc());
34 | prepareStatement.setString(2, usuarios.getSenha());
35 | prepareStatement.execute();
36 | connection.close();
37 |
38 |
39 | }
40 |
41 | public boolean autenticarUsuario(Usuario usuarioAutenticar) throws SQLException {
42 | String sql = "select * from usuario where nome = ? and senha = ?";
43 |
44 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
45 | prepareStatement.setString(1, usuarioAutenticar.getNome());
46 | prepareStatement.setString(2, usuarioAutenticar.getSenha());
47 | prepareStatement.execute();
48 | connection.close();
49 |
50 | ResultSet resultSet = prepareStatement.getResultSet();
51 |
52 | return resultSet.next();
53 | }
54 |
55 |
56 | public void Atualizar(Usuario usuarios) throws SQLException{
57 | String sql = "update usuario set nome = ?, senha = ? where id = ? ";
58 |
59 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
60 | prepareStatement.setString(1, usuarios.getNome());
61 | prepareStatement.setString(2, usuarios.getSenha());
62 | prepareStatement.setInt(3, usuarios.getId());
63 | prepareStatement.execute();
64 |
65 | connection.close();
66 | }
67 |
68 | public void SalvarouAtualiza(Usuario usuarios) throws SQLException{
69 | if(usuarios.getId() > 0){
70 | Atualizar(usuarios);
71 | }
72 | else{
73 | Salvar(usuarios);
74 | }
75 | }
76 |
77 | public void Deleta(Usuario usuarios) throws SQLException{
78 | String sql = "delete from usuario where id = ? ";
79 |
80 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
81 | prepareStatement.setInt(1, usuarios.getId());
82 | prepareStatement.execute();
83 |
84 | connection.close();
85 | }
86 |
87 | public ArrayList Buscar() throws SQLException{
88 | String sql = "select * from usuario";
89 |
90 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
91 | prepareStatement.execute();
92 |
93 | return pesquisa(prepareStatement);
94 | }
95 |
96 | private ArrayList pesquisa(PreparedStatement prepareStatement) throws SQLException {
97 | ArrayList usuarios = new ArrayList();
98 |
99 | prepareStatement.execute();
100 | ResultSet resultSet = prepareStatement.getResultSet();
101 |
102 | while(resultSet.next()){
103 | int id = resultSet.getInt("id");
104 | String nome = resultSet.getString("nome");
105 | String email = resultSet.getString("email");
106 | String cpf = resultSet.getString("cpf");
107 | String data_nasc = resultSet.getString("DataNasc");
108 | String Senha = resultSet.getString("senha");
109 |
110 |
111 | Usuario usuarioEncontrado = new Usuario(id, nome, email, cpf, data_nasc, Senha);
112 | usuarios.add(usuarioEncontrado);
113 |
114 | }
115 | return usuarios;
116 | }
117 |
118 | public Usuario BuscarPorId(Usuario usuarios) throws SQLException{
119 | String sql = "select from usuario where id = ? ";
120 |
121 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
122 | prepareStatement.setInt(1, usuarios.getId());
123 |
124 | return pesquisa(prepareStatement).get(0);
125 | }
126 |
127 |
128 | }
129 |
--------------------------------------------------------------------------------
/src/Controller/ServicesController.java:
--------------------------------------------------------------------------------
1 | package Controller;
2 |
3 | import DAO.Conexao;
4 | import DAO.ServiceDAO;
5 | import Model.Service;
6 | import Views.AddService;
7 | import Views.AlterarService;
8 | import Views.CadastroCliente;
9 | import Views.TelaService;
10 | import java.sql.Connection;
11 | import java.sql.SQLException;
12 | import java.util.logging.Level;
13 | import java.util.logging.Logger;
14 | import javax.swing.JOptionPane;
15 |
16 | public class ServicesController {
17 | private AddService views;
18 | private Service currentService;
19 | private AlterarService edit;
20 | private TelaService services;
21 |
22 | public ServicesController(TelaService services) {
23 | this.services = services;
24 | }
25 |
26 | public ServicesController(AddService views) {
27 | this.views = views;
28 | }
29 |
30 | public ServicesController(AlterarService edit) {
31 | this.edit = edit;
32 | }
33 |
34 | public void salvarServico(){
35 |
36 | String nome = views.getVarNameService().getText();
37 | String price = views.getVarPriceService().getText();
38 | String imagem = views.getTfCaminho().getText();
39 |
40 | Service service = new Service(imagem, nome, price);
41 |
42 | try {
43 | Connection conexao = new Conexao().getConnection();
44 | ServiceDAO serviceDAO = new ServiceDAO(conexao);
45 | serviceDAO.Salvar(service);
46 |
47 | JOptionPane.showMessageDialog(null, "Service Salvo com Sucesso");
48 |
49 | views.dispose();
50 | TelaService tela = new TelaService();
51 | tela.setVisible(true);
52 |
53 |
54 | } catch (SQLException ex) {
55 | Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, ex);
56 | }
57 |
58 | }
59 |
60 | public void AtualizarService(){
61 | String nome = edit.getVarEditNameService().getText();
62 | String price = edit.getVarEditPriceService().getText();
63 | String idStr = edit.getVarCodigo().getText();
64 | String imagem = edit.getTfEditCaminho().getText();
65 |
66 | Service service = new Service(imagem, nome, price);
67 |
68 | try {
69 | Connection conexao = new Conexao().getConnection();
70 | ServiceDAO serviceDAO = new ServiceDAO(conexao);
71 |
72 | int id = Integer.parseInt(idStr);
73 |
74 | Service existingService = serviceDAO.BuscarPorId(id);
75 |
76 | if (existingService != null) {
77 | // Se o serviço com o ID existir, atualize seus valores
78 | existingService.setNome(nome);
79 | existingService.setPrice(price);
80 | existingService.setImagem(imagem);
81 |
82 | serviceDAO.Atualizar(existingService);
83 | JOptionPane.showMessageDialog(null, "Service Atualizado com Sucesso");
84 |
85 | views.dispose();
86 | TelaService tela = new TelaService();
87 | tela.setVisible(true);
88 | } else {
89 | // Se o serviço com o ID não existe, exiba uma mensagem de erro
90 | JOptionPane.showMessageDialog(null, "ID não encontrado. Não é possível atualizar o serviço.");
91 | }
92 |
93 | conexao.close();
94 | } catch (Exception e) {
95 | Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, e);
96 |
97 | }
98 | }
99 |
100 | public void Excluir() {
101 | String idStr = JOptionPane.showInputDialog(null, "Digite o Código a ser excluído:");
102 | Service service = new Service(0);
103 | if (idStr != null && !idStr.isEmpty()) {
104 | try {
105 | int id = Integer.parseInt(idStr); // Converter a string para int
106 | Connection conexao = new Conexao().getConnection();
107 | ServiceDAO serviceDAO = new ServiceDAO(conexao);
108 |
109 | // Verificar se o serviço com o ID fornecido existe no banco de dados
110 | Service existingService = serviceDAO.BuscarPorId(id);
111 |
112 | if (existingService != null) {
113 | // Se o serviço com o ID existir, exclua-o
114 | serviceDAO.Deleta(existingService);
115 | JOptionPane.showMessageDialog(null, "Service excluído com sucesso.");
116 | } else {
117 | // Se o serviço com o ID não existe, exiba uma mensagem de erro
118 | JOptionPane.showMessageDialog(null, "Código não encontrado. Não é possível excluir o serviço.");
119 | }
120 |
121 | conexao.close();
122 | } catch (NumberFormatException e) {
123 | JOptionPane.showMessageDialog(null, "Código inválido. Digite um número válido.");
124 | } catch (Exception e) {
125 | Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, e);
126 | }
127 | } else {
128 | JOptionPane.showMessageDialog(null, "Nenhum ID fornecido. A exclusão foi cancelada.");
129 | }
130 | }
131 |
132 |
133 |
134 |
135 | }
136 |
137 |
--------------------------------------------------------------------------------
/src/DAO/ClienteDAO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package DAO;
6 | import Model.Agendamento;
7 | import java.sql.Connection;
8 | import Model.Cliente;
9 | import java.sql.PreparedStatement;
10 | import java.sql.ResultSet;
11 | import java.sql.SQLException;
12 | import java.util.ArrayList;
13 |
14 | /**
15 | *
16 | * @author Biel
17 | */
18 | public class ClienteDAO {
19 |
20 | private final Connection connection;
21 |
22 | public ClienteDAO(Connection connection) {
23 | this.connection = connection;
24 | }
25 |
26 | public void Salvar(Cliente clientes) throws SQLException{
27 |
28 | String sql = "insert into clientes(nome,email,senha) values(? , ?, ?)";
29 |
30 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
31 | prepareStatement.setString(1, clientes.getNome());
32 | prepareStatement.setString(2, clientes.getEmail());
33 | prepareStatement.setString(3, clientes.getSenha());
34 | prepareStatement.execute();
35 | connection.close();
36 |
37 |
38 | }
39 |
40 | public Cliente autenticarCliente(Cliente cliente) throws SQLException {
41 | String sql = "SELECT * FROM clientes WHERE email = ? AND senha = ?";
42 | try (PreparedStatement preparedStatement = connection.prepareStatement(sql)) {
43 | preparedStatement.setString(1, cliente.getEmail());
44 | preparedStatement.setString(2, cliente.getSenha());
45 | try (ResultSet resultSet = preparedStatement.executeQuery()) {
46 | if (resultSet.next()) {
47 | int id = resultSet.getInt("id");
48 | String nome = resultSet.getString("nome");
49 | // Outros campos, se necessário
50 |
51 | return new Cliente(id, nome, cliente.getEmail(), cliente.getSenha());
52 | }
53 | }
54 | }
55 | return null;
56 | }
57 |
58 |
59 | public void Atualizar(Cliente clientes) throws SQLException{
60 | String sql = "update clientes set nome = ?, senha = ? where id = ? ";
61 |
62 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
63 | prepareStatement.setString(1, clientes.getNome());
64 | prepareStatement.setString(2, clientes.getSenha());
65 | prepareStatement.setInt(3, clientes.getId());
66 | prepareStatement.execute();
67 |
68 | connection.close();
69 | }
70 |
71 | public void SalvarouAtualiza(Cliente clientes) throws SQLException{
72 | if(clientes.getId() > 0){
73 | Atualizar(clientes);
74 | }
75 | else{
76 | Salvar(clientes);
77 | }
78 | }
79 |
80 | public void Deleta(Cliente clientes) throws SQLException{
81 | String sql = "delete from clientes where id = ? ";
82 |
83 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
84 | prepareStatement.setInt(1, clientes.getId());
85 | prepareStatement.execute();
86 |
87 | connection.close();
88 | }
89 |
90 | public ArrayList Buscar() throws SQLException{
91 | String sql = "select * from clientes";
92 |
93 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
94 | prepareStatement.execute();
95 |
96 | return pesquisa(prepareStatement);
97 | }
98 |
99 | private ArrayList pesquisa(PreparedStatement prepareStatement) throws SQLException {
100 | ArrayList clientes = new ArrayList();
101 |
102 | prepareStatement.execute();
103 | ResultSet resultSet = prepareStatement.getResultSet();
104 |
105 | while(resultSet.next()){
106 | int id = resultSet.getInt("id");
107 | String nome = resultSet.getString("nome");
108 | String Senha = resultSet.getString("senha");
109 |
110 | Cliente clienteEncontrado = new Cliente(id,nome, Senha);
111 | clientes.add(clienteEncontrado);
112 |
113 | }
114 | return clientes;
115 | }
116 |
117 | public Cliente BuscarPorId(Cliente cliente) throws SQLException{
118 | String sql = "select from clientes where id = ? ";
119 |
120 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
121 | prepareStatement.setInt(1, cliente.getId());
122 |
123 | return pesquisa(prepareStatement).get(0);
124 | }
125 |
126 | public String getNomeClienteByEmail(String email) throws SQLException {
127 | String nomeCliente = null;
128 |
129 | String query = "SELECT nome FROM clientes WHERE email = ?";
130 |
131 | try (PreparedStatement preparedStatement = connection.prepareStatement(query)) {
132 | preparedStatement.setString(1, email);
133 | try (ResultSet resultSet = preparedStatement.executeQuery()) {
134 | if (resultSet.next()) {
135 | nomeCliente = resultSet.getString("nome");
136 | }
137 | }
138 | }
139 |
140 | return nomeCliente;
141 | }
142 |
143 |
144 | }
145 |
--------------------------------------------------------------------------------
/src/DAO/AgendamentoDAO.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package DAO;
6 |
7 | import Model.Agendamento;
8 | import Model.Cliente;
9 | import java.sql.PreparedStatement;
10 | import java.sql.ResultSet;
11 | import java.sql.SQLException;
12 | import java.util.ArrayList;
13 | import java.sql.Connection;
14 | import java.util.List;
15 |
16 | /**
17 | *
18 | * @author Biel
19 | */
20 | public class AgendamentoDAO {
21 |
22 | private final Connection connection;
23 |
24 | public AgendamentoDAO(Connection connection) {
25 | this.connection = connection;
26 | }
27 |
28 |
29 |
30 | public void Salvar(Agendamento agendamentos) throws SQLException{
31 |
32 | String sql = "insert into agendamentos(nome,telefone,email,service_id,price_service,data,hora,observacao) values(? , ?, ?, ?, ?, ?, ?, ?)";
33 |
34 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
35 | prepareStatement.setString(1, agendamentos.getNome());
36 | prepareStatement.setString(2, agendamentos.getTelefone());
37 | prepareStatement.setString(3, agendamentos.getEmail());
38 | prepareStatement.setString(4, agendamentos.getServico_id());
39 | prepareStatement.setString(5, agendamentos.getPrice_agendamento());
40 | prepareStatement.setString(6, agendamentos.getData());
41 | prepareStatement.setString(7, agendamentos.getHora());
42 | prepareStatement.setString(8, agendamentos.getObservacao());
43 | prepareStatement.execute();
44 | connection.close();
45 |
46 |
47 | }
48 |
49 |
50 | public void Atualizar(Agendamento agendamentos) throws SQLException{
51 | String sql = "update agendamentos set nome = ?, telefone = ?,email = ?,service_id = ?, price_service = ?,data= ?,hora = ?,observacao = ? where id = ? ";
52 |
53 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
54 | prepareStatement.setString(1, agendamentos.getNome());
55 | prepareStatement.setString(2, agendamentos.getTelefone());
56 | prepareStatement.setString(3, agendamentos.getEmail());
57 | prepareStatement.setString(4, agendamentos.getServico_id());
58 | prepareStatement.setString(5, agendamentos.getPrice_agendamento());
59 | prepareStatement.setString(6, agendamentos.getData());
60 | prepareStatement.setString(7, agendamentos.getHora());
61 | prepareStatement.setString(8, agendamentos.getObservacao());
62 | prepareStatement.setInt(9, agendamentos.getId());
63 | prepareStatement.execute();
64 |
65 | connection.close();
66 | }
67 |
68 | /* public void SalvarouAtualiza(Agendamento agendamentos) throws SQLException{;
69 | if(agendamentos.getId() > 0){
70 | Atualizar(agendamentos);
71 | }
72 | else{
73 | Salvar(agendamentos);
74 | }
75 | }*/
76 |
77 | public void Deleta(Agendamento agendamentos) throws SQLException{
78 | String sql = "DELETE from agendamentos where id = ? ";
79 |
80 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
81 | prepareStatement.setInt(1, agendamentos.getId());
82 | prepareStatement.executeUpdate();
83 |
84 | connection.close();
85 | }
86 |
87 | public ArrayList Buscar() throws SQLException{
88 | String sql = "select * from agendamentos";
89 |
90 | PreparedStatement prepareStatement = connection.prepareStatement(sql);
91 | prepareStatement.execute();
92 |
93 | return pesquisa(prepareStatement);
94 | }
95 |
96 | private ArrayList pesquisa(PreparedStatement prepareStatement) throws SQLException {
97 | ArrayList agendamentos = new ArrayList();
98 |
99 | prepareStatement.execute();
100 | ResultSet resultSet = prepareStatement.getResultSet();
101 |
102 | while(resultSet.next()){
103 | int Id = resultSet.getInt("id");
104 |
105 | String Nome = resultSet.getString("nome");
106 | String Telefone = resultSet.getString("telefone");
107 | String Email = resultSet.getString("email");
108 | String Service_id = resultSet.getString("service_id");
109 | String Price_service = resultSet.getString("price_service");
110 | String Data = resultSet.getString("data");
111 | String Hora = resultSet.getString("hora");
112 | String Observacao = resultSet.getString("observacao");
113 |
114 | Agendamento AgendamentoEncontrado = new Agendamento(Id, Nome, Email, Telefone, Service_id, Price_service, Data, Hora, Observacao);
115 | agendamentos.add(AgendamentoEncontrado);
116 |
117 | }
118 | return agendamentos;
119 | }
120 |
121 | public Agendamento BuscarPorId(int id) throws SQLException {
122 | String sql = "SELECT * FROM agendamentos WHERE id = ?";
123 |
124 | PreparedStatement preparedStatement = connection.prepareStatement(sql);
125 | preparedStatement.setInt(1, id);
126 |
127 | ArrayList services = pesquisa(preparedStatement);
128 |
129 | if (!services.isEmpty()) {
130 | return services.get(0);
131 | } else {
132 | return null;
133 | }
134 | }
135 |
136 | public boolean existeAgendamentoNaDataHora(String data, String hora) throws SQLException {
137 | String sql = "SELECT COUNT(*) FROM agendamentos WHERE data = ? AND hora = ?";
138 | try (PreparedStatement stmt = connection.prepareStatement(sql)) {
139 | stmt.setString(1, data);
140 | stmt.setString(2, hora);
141 | try (ResultSet resultSet = stmt.executeQuery()) {
142 | if (resultSet.next()) {
143 | int count = resultSet.getInt(1);
144 | return count > 0;
145 | }
146 | }
147 | }
148 | return false;
149 | }
150 |
151 | public Agendamento BuscarPorEmail(String email) throws SQLException {
152 | String sql = "select from agendamentos where email = ? ";
153 |
154 | PreparedStatement preparedStatement = connection.prepareStatement(sql);
155 | preparedStatement.setString(1,email);
156 |
157 | ArrayList services = pesquisa(preparedStatement);
158 |
159 | if (!services.isEmpty()) {
160 | return services.get(0);
161 | } else {
162 | return null; // ou lançar uma exceção se preferir
163 | }
164 | }
165 |
166 |
167 |
168 |
169 |
170 | }
171 |
--------------------------------------------------------------------------------
/src/Controller/AgendamentoController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package Controller;
6 |
7 | import DAO.AgendamentoDAO;
8 | import DAO.Conexao;
9 | import DAO.ServiceDAO;
10 | import Model.Agendamento;
11 | import Model.Service;
12 | import Views.Agendar;
13 | import Views.CadastroCliente;
14 | import Views.ControleHorario;
15 | import Views.MenuBarbeiro;
16 | import Views.MenuCliente;
17 | import Views.TelaAgendamentoBarbeiro;
18 | import java.awt.Image;
19 | import java.awt.event.ActionEvent;
20 | import java.awt.event.ActionListener;
21 | import java.sql.Connection;
22 | import java.sql.SQLException;
23 | import java.text.SimpleDateFormat;
24 | import java.time.LocalTime;
25 | import java.time.format.DateTimeFormatter;
26 | import java.util.ArrayList;
27 | import java.util.Calendar;
28 | import java.util.Date;
29 | import java.util.logging.Level;
30 | import java.util.logging.Logger;
31 | import javax.swing.ImageIcon;
32 | import javax.swing.JComboBox;
33 | import javax.swing.JOptionPane;
34 |
35 | /**
36 | *
37 | * @author Biel
38 | */
39 | public class AgendamentoController {
40 | private Agendar view;
41 | private MenuBarbeiro menu;
42 | private ControleHorario controller;
43 | private TelaAgendamentoBarbeiro AgendamentoBarbeiro;
44 |
45 | public AgendamentoController(MenuBarbeiro menu) {
46 | this.menu = menu;
47 | }
48 |
49 | public AgendamentoController(TelaAgendamentoBarbeiro AgendamentoBarbeiro) {
50 | this.AgendamentoBarbeiro = AgendamentoBarbeiro;
51 | }
52 |
53 | public AgendamentoController(Agendar view) {
54 | this.view = view;
55 | }
56 |
57 | public void ComboboxService() throws SQLException {
58 | Connection conexao = new Conexao().getConnection();
59 | ServiceDAO serviceDAO = new ServiceDAO(conexao);
60 |
61 | ArrayList listar = serviceDAO.Buscar();
62 |
63 | view.getComboBoxService().removeAll(); // Remove itens do ComboBox
64 |
65 | for (Service service : listar) {
66 | view.getComboBoxService().addItem(service.getNome());
67 | }
68 |
69 | view.getComboBoxService().addActionListener(new ActionListener() {
70 |
71 | @Override
72 | public void actionPerformed(ActionEvent e) {
73 | // Quando um item é selecionado no ComboBox, este código será executado.
74 | String selectedItem = (String) view.getComboBoxService().getSelectedItem();
75 |
76 | if (selectedItem != null) {
77 | for (Service service : listar) {
78 | if (selectedItem.equals(service.getNome())) {
79 | view.getVarPrice().setText(service.getPrice());
80 |
81 | ImageIcon imagem = new ImageIcon(service.getImagem());
82 | view.getImagemCorte().setIcon(new ImageIcon(imagem.getImage().getScaledInstance(view.getImagemCorte().getWidth()
83 | , view.getImagemCorte().getHeight(), Image.SCALE_DEFAULT)));
84 | break;
85 | }
86 | }
87 | } else {
88 | view.getVarPrice().setText("");
89 |
90 | }
91 | }
92 | });
93 | }
94 |
95 | public void AdicionandoHoras() throws SQLException{
96 | Connection conexao = new Conexao().getConnection();
97 | ServiceDAO serviceDAO = new ServiceDAO(conexao);
98 |
99 | ArrayList listar = serviceDAO.Buscar();
100 |
101 |
102 | ArrayList horas = new ArrayList<>();
103 | LocalTime currentTime = LocalTime.of(8, 0);
104 |
105 | while(currentTime.isBefore(LocalTime.of(20, 30))){
106 | horas.add(currentTime.format(DateTimeFormatter.ofPattern("HH:mm")));
107 |
108 | currentTime = currentTime.plusMinutes(30);
109 | }
110 | JComboBox dataComboBox = view.getVarHora();
111 | dataComboBox.removeAllItems();
112 | for(String hora : horas){
113 | dataComboBox.addItem(hora);
114 | }
115 |
116 | }
117 |
118 | public void AdicionandoData(){
119 |
120 | Calendar calendar = Calendar.getInstance();
121 | SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
122 |
123 |
124 | int year = calendar.get(Calendar.YEAR);
125 | int month = calendar.get(Calendar.MONTH);
126 | int day = calendar.get(Calendar.DAY_OF_MONTH);
127 |
128 | //Data Atual
129 | calendar.set(Calendar.YEAR, year);
130 | calendar.set(Calendar.MONTH, month);
131 | calendar.set(Calendar.DAY_OF_MONTH, day);
132 |
133 |
134 | while (year == calendar.get(Calendar.YEAR)) {
135 | Date date = calendar.getTime();
136 | boolean horaJaAgendada = false;
137 |
138 | if (calendar.get(Calendar.DAY_OF_WEEK) != Calendar.SUNDAY) {
139 | view.getVarData().addItem(dateFormat.format(date));
140 | }
141 | calendar.add(Calendar.DAY_OF_MONTH, 1);
142 |
143 | }
144 |
145 | }
146 |
147 | public void salvarAgendamento(){
148 | String Nome = view.getVarName().getText();
149 | String Email = view.getVarEmail().getText();
150 | String Telefone = view.getVarTelefone().getText();
151 | String Data = (String) view.getVarData().getSelectedItem();
152 | String Hora = (String) view.getVarHora().getSelectedItem();
153 | String Servico = (String) view.getComboBoxService().getSelectedItem();
154 | String Price = view.getVarPrice().getText();
155 | String Observacao = view.getVarObeservacao().getText();
156 |
157 |
158 | Agendamento agendamento = new Agendamento(Nome, Email, Telefone, Servico, Price, Data, Hora, Observacao);
159 |
160 | try {
161 | Connection conexao = new Conexao().getConnection();
162 | AgendamentoDAO agendamentoDAO = new AgendamentoDAO(conexao);
163 |
164 | // Verifique se já existe um agendamento para a mesma data e hora
165 | if (agendamentoDAO.existeAgendamentoNaDataHora(Data, Hora)) {
166 | view.getVarHora().removeItem(Hora);
167 | JOptionPane.showMessageDialog(null, "Já existe um agendamento para essa data e hora. Escolha outra data ou hora.");
168 | } else {
169 | agendamentoDAO.Salvar(agendamento);
170 | JOptionPane.showMessageDialog(null, "Agendamento Salvo com Sucesso");
171 |
172 | view.dispose();
173 | MenuCliente menuCliente = new MenuCliente();
174 | menuCliente.setVisible(true);
175 | }
176 | } catch (SQLException ex) {
177 | Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, ex);
178 | }
179 | }
180 |
181 | public void ExcluirAgendamento() {
182 | String idStr = JOptionPane.showInputDialog(null, "Digite o Código a ser excluído:");
183 | Agendamento agendamento = new Agendamento(0);
184 | if (idStr != null && !idStr.isEmpty()) {
185 | try {
186 | int id = Integer.parseInt(idStr); // Converter a string para int
187 | Connection conexao = new Conexao().getConnection();
188 | AgendamentoDAO agendamentoDAO = new AgendamentoDAO(conexao);
189 |
190 | // Verificar se o serviço com o ID fornecido existe no banco de dados
191 | Agendamento existingService = agendamentoDAO.BuscarPorId(id);
192 |
193 | if (existingService != null) {
194 | // Se o serviço com o ID existir, exclua-o
195 | agendamentoDAO.Deleta(existingService);
196 | JOptionPane.showMessageDialog(null, "Agendamento excluído com sucesso.");
197 | } else {
198 | // Se o serviço com o ID não existe, exiba uma mensagem de erro
199 | JOptionPane.showMessageDialog(null, "Código não encontrado. Não é possível excluir o Agendamento.");
200 | }
201 |
202 | conexao.close();
203 | } catch (NumberFormatException e) {
204 | JOptionPane.showMessageDialog(null, "Código inválido. Digite um número válido.");
205 | } catch (Exception e) {
206 | Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, e);
207 | }
208 | } else {
209 | JOptionPane.showMessageDialog(null, "Nenhum ID fornecido. A exclusão foi cancelada.");
210 | }
211 | }
212 |
213 |
214 |
215 | }
216 |
--------------------------------------------------------------------------------
/src/Controller/BarbeiroController.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
4 | */
5 | package Controller;
6 |
7 | import DAO.AgendamentoDAO;
8 | import DAO.Conexao;
9 | import DAO.ServiceDAO;
10 | import DAO.UsuarioDAO;
11 | import Model.Agendamento;
12 | import Model.Service;
13 | import Model.Usuario;
14 | import Views.CadastrarBarbeiro;
15 | import Views.CadastroCliente;
16 | import Views.LoginBarbeiro;
17 | import Views.MenuBarbeiro;
18 | import Views.TelaService;
19 | import java.awt.Image;
20 | import java.sql.Connection;
21 | import java.sql.SQLException;
22 | import java.text.ParseException;
23 | import java.text.SimpleDateFormat;
24 | import java.util.ArrayList;
25 | import java.util.Date;
26 | import java.util.logging.Level;
27 | import java.util.logging.Logger;
28 | import javax.swing.ImageIcon;
29 | import javax.swing.JLabel;
30 | import javax.swing.JOptionPane;
31 | import javax.swing.table.DefaultTableModel;
32 |
33 | /**
34 | *
35 | * @author Biel
36 | */
37 | public class BarbeiroController {
38 |
39 | private LoginBarbeiro view;
40 | private CadastrarBarbeiro cadastrar;
41 | private TelaService service;
42 | private MenuBarbeiro menu;
43 |
44 |
45 | public BarbeiroController(LoginBarbeiro view) {
46 | this.view = view;
47 | }
48 |
49 | public BarbeiroController(CadastrarBarbeiro cadastrar){
50 | this.cadastrar = cadastrar;
51 | }
52 |
53 | public BarbeiroController(TelaService service) {
54 | this.service = service;
55 | }
56 |
57 | public BarbeiroController(MenuBarbeiro menu) {
58 | this.menu = menu;
59 | }
60 |
61 | public void atualizarTextoBoasVindas(String nome){
62 | JLabel welcomeLabel = menu.getWelcome();
63 | welcomeLabel.setText("Seja Bem-Vindo: "+ nome);
64 |
65 |
66 | }
67 |
68 |
69 | public void Autenticar() throws SQLException {
70 | // Buscar usuario da View
71 | String nome = view.getVarNameBarbeiro().getText();
72 | String senha = view.getVarPasswordBarbeiro().getText();
73 |
74 | Usuario usuarioAutenticar = new Usuario(nome, senha);
75 |
76 | // Verificar Se existir no banco de dados
77 | Connection conexao = new Conexao().getConnection();
78 | UsuarioDAO usuarioDAO = new UsuarioDAO(conexao);
79 | boolean existe = usuarioDAO.autenticarUsuario(usuarioAutenticar);
80 |
81 | if (existe) {
82 | MenuBarbeiro menubarbeiro = new MenuBarbeiro();
83 | menubarbeiro.setVisible(true);
84 | view.setVisible(false);
85 |
86 | BarbeiroController barbeiroController = new BarbeiroController(menubarbeiro);
87 |
88 | // Passe o nome do usuário para o método de atualização
89 | barbeiroController.atualizarTextoBoasVindas(nome);
90 | } else {
91 | JOptionPane.showMessageDialog(null, "Usuario Não Encontrado no Banco");
92 | }
93 | }
94 |
95 | public void salvarBarbeiro(){
96 |
97 | String Nome = cadastrar.getTextNome().getText();
98 | String Email = cadastrar.getTextEmail().getText();
99 | String Senha = cadastrar.getTextSenha().getText();
100 | String Cpf = cadastrar.getTextCpf().getText();
101 | String Data_nasc = cadastrar.getTextNascimento().getText();
102 |
103 |
104 | Usuario usuario = new Usuario(Nome, Email, Cpf, Data_nasc, Senha);
105 |
106 |
107 | try {
108 | Connection conexao = new Conexao().getConnection();
109 | UsuarioDAO usuarioDAO = new UsuarioDAO(conexao);
110 | usuarioDAO.Salvar(usuario);
111 |
112 | JOptionPane.showMessageDialog(null, "Usuario Salvo com Sucesso");
113 |
114 | cadastrar.dispose();
115 | MenuBarbeiro menuBarbeiro = new MenuBarbeiro();
116 | menuBarbeiro.setVisible(true);
117 |
118 | } catch (SQLException ex) {
119 | Logger.getLogger(CadastroCliente.class.getName()).log(Level.SEVERE, null, ex);
120 | }
121 | }
122 |
123 | public void atualizarTableService() throws SQLException{
124 | //Buscar Elementos no Banco
125 | Connection conexao = new Conexao().getConnection();
126 | ServiceDAO serviceDAO = new ServiceDAO(conexao);
127 | ArrayList Buscar = serviceDAO.Buscar();
128 |
129 | //Enviar para View
130 | DefaultTableModel tableModel = (DefaultTableModel) service.getTableServices().getModel();
131 | tableModel.setNumRows(0);
132 |
133 | for (Service services : Buscar) {
134 | tableModel.addRow(new Object[]{
135 | services.getId(),
136 | services.getNome(),
137 | services.getPrice()
138 | });
139 |
140 | }
141 |
142 | }
143 |
144 | public void VincularCampodaTabelaService() throws SQLException{
145 | Connection conexao = new Conexao().getConnection();
146 | ServiceDAO serviceDAO = new ServiceDAO(conexao);
147 | ArrayList Buscar = serviceDAO.Buscar();
148 |
149 | Service services = Buscar.get(service.getTableServices().getSelectedRow());
150 | ImageIcon imagem = new ImageIcon(services.getImagem());
151 | service.getFotodoService().setIcon(new ImageIcon(imagem.getImage().getScaledInstance(service.getFotodoService().getWidth()
152 | , service.getFotodoService().getHeight(), Image.SCALE_DEFAULT)));
153 | }
154 |
155 | public void atualizarTabelaAgendamento() throws SQLException{
156 | //Buscar Elementos no Banco
157 | Connection conexao = new Conexao().getConnection();
158 | AgendamentoDAO agendamentoDAO = new AgendamentoDAO(conexao);
159 | ArrayList Buscar = agendamentoDAO.Buscar();
160 |
161 | //Enviar para View
162 | DefaultTableModel tableModel = (DefaultTableModel) menu.getTableAgendamentos() .getModel();
163 | tableModel.setNumRows(0);
164 |
165 | //Pecorrer o TableMode
166 | SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
167 |
168 | for (Agendamento agendamentos : Buscar) {
169 | try {
170 | Date dataAgendamento = dateFormat.parse(agendamentos.getData());
171 | Date dataAtual = new Date(); // Obter a data atual
172 |
173 | // Verificar se a data do agendamento é maior ou igual à data de hoje
174 | if (dataAgendamento.equals(dataAtual) || dataAgendamento.after(dataAtual)) {
175 | tableModel.addRow(
176 | new Object[]{
177 | agendamentos.getId(),
178 | agendamentos.getNome(),
179 | agendamentos.getTelefone(),
180 | agendamentos.getServico_id(),
181 | agendamentos.getData(),
182 | agendamentos.getHora(),
183 | agendamentos.getPrice_agendamento(),
184 | agendamentos.getObservacao()
185 | }
186 | );
187 | }
188 | } catch (ParseException e) {
189 | e.printStackTrace();
190 | }
191 | }
192 | }
193 |
194 | public void filtrarAgendamentosHoje() throws SQLException {
195 | SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
196 | String hoje = dateFormat.format(new Date());
197 |
198 | Connection conexao = new Conexao().getConnection();
199 | AgendamentoDAO agendamentoDAO = new AgendamentoDAO(conexao);
200 | ArrayList agendamentos = agendamentoDAO.Buscar();
201 |
202 | ArrayList agendamentosHoje = new ArrayList<>();
203 |
204 | for (Agendamento agendamento : agendamentos) {
205 | String dataAgendamento = agendamento.getData(); // Suponhamos que o método de Agendamento que retorna a data seja "getData()"
206 | if (dataAgendamento.equals(hoje)) {
207 | agendamentosHoje.add(agendamento);
208 | }
209 | }
210 | atualizarTabela(agendamentosHoje);
211 |
212 | }
213 |
214 | public void atualizarTabela(ArrayList agendamentos) {
215 | DefaultTableModel model = (DefaultTableModel) menu.getTableAgendamentos().getModel();
216 |
217 | // Limpa o modelo atual da tabela
218 | model.setRowCount(0);
219 |
220 | // Adiciona os novos agendamentos à tabela
221 | for (Agendamento agendamento : agendamentos) {
222 | String[] rowData = {
223 | agendamento.getNome(),
224 | agendamento.getTelefone(),
225 | agendamento.getServico_id(),
226 | agendamento.getData(),
227 | agendamento.getHora(),
228 | agendamento.getPrice_agendamento(),
229 | agendamento.getObservacao()
230 | };
231 | model.addRow(rowData);
232 | }
233 | }
234 |
235 | public void filtrarTodos() throws SQLException{
236 | atualizarTabelaAgendamento();
237 | }
238 |
239 | public boolean dataAnterior(String data1, String data2) {
240 | SimpleDateFormat dateFormat = new SimpleDateFormat("dd/MM/yyyy");
241 |
242 | try {
243 | Date date1 = dateFormat.parse(data1);
244 | Date date2 = dateFormat.parse(data2);
245 |
246 | return date1.before(date2);
247 | } catch (ParseException e) {
248 | e.printStackTrace();
249 | return false;
250 | }
251 | }
252 |
253 | public void atualizarHistoricodaTabela() throws SQLException{
254 | Connection conexao = new Conexao().getConnection();
255 | AgendamentoDAO agendamentoDAO = new AgendamentoDAO(conexao);
256 | ArrayList Buscar = agendamentoDAO.Buscar();
257 |
258 | //Enviar para View
259 | DefaultTableModel tableModel = (DefaultTableModel) menu.getTableAgendamentos() .getModel();
260 | tableModel.setNumRows(0);
261 |
262 | //Pecorrer o TableMode
263 | for (Agendamento agendamentos : Buscar) {
264 | tableModel.addRow(
265 | new Object[]{
266 | agendamentos.getId(),
267 | agendamentos.getNome(),
268 | agendamentos.getTelefone(),
269 | agendamentos.getServico_id(),
270 | agendamentos.getData(),
271 | agendamentos.getHora(),
272 | agendamentos.getPrice_agendamento(),
273 | agendamentos.getObservacao()
274 |
275 | }
276 | );
277 | }
278 | }
279 |
280 |
281 | }
282 |
--------------------------------------------------------------------------------
/src/Views/MenuCliente.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
4 | */
5 | package Views;
6 |
7 | import Controller.ClienteController;
8 | import java.awt.EventQueue;
9 | import java.sql.SQLException;
10 | import javax.swing.JLabel;
11 | import javax.swing.JTable;
12 |
13 | /**
14 | *
15 | * @author Biel
16 | */
17 | public class MenuCliente extends javax.swing.JFrame {
18 |
19 | private ClienteController controller;
20 |
21 | /**
22 | * Creates new form MenuCliente
23 | */
24 | public MenuCliente() {
25 | this.controller = controller;
26 | initComponents();
27 | }
28 |
29 | private void iniciarTable() throws SQLException {
30 | }
31 | /**
32 | * This method is called from within the constructor to initialize the form.
33 | * WARNING: Do NOT modify this code. The content of this method is always
34 | * regenerated by the Form Editor.
35 | */
36 | @SuppressWarnings("unchecked")
37 | // //GEN-BEGIN:initComponents
38 | private void initComponents() {
39 |
40 | ButtonEmDia = new javax.swing.JButton();
41 | ButtonTodos = new javax.swing.JButton();
42 | welcomeCliente = new javax.swing.JLabel();
43 | jLabel3 = new javax.swing.JLabel();
44 | ButtonAgendar = new javax.swing.JButton();
45 | jScrollPane1 = new javax.swing.JScrollPane();
46 | TableAgendamentos = new javax.swing.JTable();
47 | jLabel1 = new javax.swing.JLabel();
48 | jLabel2 = new javax.swing.JLabel();
49 | jMenuBar2 = new javax.swing.JMenuBar();
50 | jMenu2 = new javax.swing.JMenu();
51 | jMenuItem2 = new javax.swing.JMenuItem();
52 |
53 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
54 | getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
55 |
56 | ButtonEmDia.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
57 | ButtonEmDia.setForeground(new java.awt.Color(0, 0, 0));
58 | ButtonEmDia.setText("Em Dia");
59 | ButtonEmDia.addActionListener(new java.awt.event.ActionListener() {
60 | public void actionPerformed(java.awt.event.ActionEvent evt) {
61 | ButtonEmDiaActionPerformed(evt);
62 | }
63 | });
64 | getContentPane().add(ButtonEmDia, new org.netbeans.lib.awtextra.AbsoluteConstraints(520, 70, 80, 30));
65 |
66 | ButtonTodos.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
67 | ButtonTodos.setForeground(new java.awt.Color(0, 0, 0));
68 | ButtonTodos.setText("Todos");
69 | getContentPane().add(ButtonTodos, new org.netbeans.lib.awtextra.AbsoluteConstraints(430, 70, 70, 30));
70 |
71 | welcomeCliente.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
72 | welcomeCliente.setForeground(new java.awt.Color(255, 255, 255));
73 | getContentPane().add(welcomeCliente, new org.netbeans.lib.awtextra.AbsoluteConstraints(150, 20, 220, 30));
74 |
75 | jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 20)); // NOI18N
76 | jLabel3.setForeground(new java.awt.Color(255, 255, 255));
77 | jLabel3.setText("Agendamentos");
78 | getContentPane().add(jLabel3, new org.netbeans.lib.awtextra.AbsoluteConstraints(160, 70, -1, -1));
79 |
80 | ButtonAgendar.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
81 | ButtonAgendar.setForeground(new java.awt.Color(0, 0, 0));
82 | ButtonAgendar.setText("Agendar");
83 | ButtonAgendar.addActionListener(new java.awt.event.ActionListener() {
84 | public void actionPerformed(java.awt.event.ActionEvent evt) {
85 | ButtonAgendarActionPerformed(evt);
86 | }
87 | });
88 | getContentPane().add(ButtonAgendar, new org.netbeans.lib.awtextra.AbsoluteConstraints(330, 70, -1, 30));
89 |
90 | TableAgendamentos.setBackground(new java.awt.Color(204, 204, 204));
91 | TableAgendamentos.setForeground(new java.awt.Color(255, 255, 255));
92 | TableAgendamentos.setModel(new javax.swing.table.DefaultTableModel(
93 | new Object [][] {
94 |
95 | },
96 | new String [] {
97 | "Id", "Email", "Telefone", "Serviço", "Preço", "Dia", "Hora", "Obeservação"
98 | }
99 | ));
100 | jScrollPane1.setViewportView(TableAgendamentos);
101 | if (TableAgendamentos.getColumnModel().getColumnCount() > 0) {
102 | TableAgendamentos.getColumnModel().getColumn(0).setHeaderValue("id");
103 | TableAgendamentos.getColumnModel().getColumn(1).setHeaderValue("Telefone");
104 | TableAgendamentos.getColumnModel().getColumn(2).setHeaderValue("Serviço");
105 | TableAgendamentos.getColumnModel().getColumn(3).setHeaderValue("Preço");
106 | TableAgendamentos.getColumnModel().getColumn(4).setHeaderValue("Dia");
107 | TableAgendamentos.getColumnModel().getColumn(5).setHeaderValue("Hora");
108 | TableAgendamentos.getColumnModel().getColumn(6).setHeaderValue("Observação");
109 | }
110 |
111 | getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(130, 130, 860, 290));
112 | getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(338, 64, -1, -1));
113 |
114 | jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsImagens/BannerPC.jpg"))); // NOI18N
115 | getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1140, 490));
116 |
117 | jMenu2.setText("Ações");
118 |
119 | jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsIcons/usuario-icon.png"))); // NOI18N
120 | jMenuItem2.setText("Voltar");
121 | jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
122 | public void actionPerformed(java.awt.event.ActionEvent evt) {
123 | jMenuItem2ActionPerformed(evt);
124 | }
125 | });
126 | jMenu2.add(jMenuItem2);
127 |
128 | jMenuBar2.add(jMenu2);
129 |
130 | setJMenuBar(jMenuBar2);
131 |
132 | pack();
133 | }// //GEN-END:initComponents
134 |
135 | private void ButtonAgendarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonAgendarActionPerformed
136 | // TODO add your handling code here:
137 | Agendar agendar = new Agendar();
138 | agendar.setVisible(true);
139 | setVisible(false);
140 | }//GEN-LAST:event_ButtonAgendarActionPerformed
141 |
142 | private void ButtonEmDiaActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ButtonEmDiaActionPerformed
143 | // TODO add your handling code here:
144 | }//GEN-LAST:event_ButtonEmDiaActionPerformed
145 |
146 | private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
147 | // TODO add your handling code here:
148 | LoginCliente login = new LoginCliente();
149 | login.setVisible(true);
150 | setVisible(false);
151 | }//GEN-LAST:event_jMenuItem2ActionPerformed
152 |
153 | /**
154 | * @param args the command line arguments
155 | */
156 | public static void main(String args[]) {
157 | EventQueue.invokeLater(() -> {
158 | MenuCliente menu = new MenuCliente();
159 | menu.setVisible(true);
160 |
161 | ClienteController controller = new ClienteController(menu); // Crie o ClienteController passando o MenuCliente
162 |
163 | menu.setController(controller); // Defina o controlador no MenuCliente
164 | });
165 | /* Set the Nimbus look and feel */
166 | //
167 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
168 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
169 | */
170 | try {
171 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
172 | if ("Nimbus".equals(info.getName())) {
173 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
174 | break;
175 | }
176 | }
177 | } catch (ClassNotFoundException ex) {
178 | java.util.logging.Logger.getLogger(MenuCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
179 | } catch (InstantiationException ex) {
180 | java.util.logging.Logger.getLogger(MenuCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
181 | } catch (IllegalAccessException ex) {
182 | java.util.logging.Logger.getLogger(MenuCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
183 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
184 | java.util.logging.Logger.getLogger(MenuCliente.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
185 | }
186 | //
187 |
188 | /* Create and display the form */
189 | java.awt.EventQueue.invokeLater(new Runnable() {
190 | public void run() {
191 | new MenuCliente().setVisible(true);
192 | }
193 | });
194 | }
195 |
196 | public JTable getTableAgendamentos() {
197 | return TableAgendamentos;
198 | }
199 |
200 | public void setTableAgendamentos(JTable TableAgendamentos) {
201 | this.TableAgendamentos = TableAgendamentos;
202 | }
203 |
204 | public JLabel getWelcomeCliente() {
205 | return welcomeCliente;
206 | }
207 |
208 | public void setWelcomeCliente(JLabel welcomeCliente) {
209 | this.welcomeCliente = welcomeCliente;
210 | }
211 |
212 | public ClienteController getController() {
213 | return controller;
214 | }
215 |
216 | public void setController(ClienteController controller) {
217 | this.controller = controller;
218 | }
219 |
220 |
221 | // Variables declaration - do not modify//GEN-BEGIN:variables
222 | private javax.swing.JButton ButtonAgendar;
223 | private javax.swing.JButton ButtonEmDia;
224 | private javax.swing.JButton ButtonTodos;
225 | private javax.swing.JTable TableAgendamentos;
226 | private javax.swing.JLabel jLabel1;
227 | private javax.swing.JLabel jLabel2;
228 | private javax.swing.JLabel jLabel3;
229 | private javax.swing.JMenu jMenu2;
230 | private javax.swing.JMenuBar jMenuBar2;
231 | private javax.swing.JMenuItem jMenuItem2;
232 | private javax.swing.JScrollPane jScrollPane1;
233 | private javax.swing.JLabel welcomeCliente;
234 | // End of variables declaration//GEN-END:variables
235 | }
236 |
--------------------------------------------------------------------------------
/src/Views/TelaService.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
220 |
--------------------------------------------------------------------------------
/src/Views/MenuCliente.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
237 |
--------------------------------------------------------------------------------
/src/Views/TelaService.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
4 | */
5 | package Views;
6 |
7 | import Controller.BarbeiroController;
8 | import Controller.ServicesController;
9 | import Model.Service;
10 | import java.sql.SQLException;
11 | import java.util.ArrayList;
12 | import java.util.logging.Level;
13 | import java.util.logging.Logger;
14 | import javax.swing.JLabel;
15 | import javax.swing.JTable;
16 |
17 | /**
18 | *
19 | * @author Biel
20 | */
21 | public class TelaService extends javax.swing.JFrame {
22 | private final BarbeiroController controller;
23 | private final ServicesController serviceController;
24 | /**
25 | * Creates new form TelaService
26 | */
27 | public TelaService() throws SQLException {
28 | initComponents();
29 | controller = new BarbeiroController(this);
30 | serviceController= new ServicesController(this);
31 | iniciarTable();
32 |
33 | }
34 |
35 | private void iniciarTable() throws SQLException {
36 | controller.atualizarTableService();
37 | }
38 |
39 | /**
40 | * This method is called from within the constructor to initialize the form.
41 | * WARNING: Do NOT modify this code. The content of this method is always
42 | * regenerated by the Form Editor.
43 | */
44 | @SuppressWarnings("unchecked")
45 | // //GEN-BEGIN:initComponents
46 | private void initComponents() {
47 |
48 | jPanel1 = new javax.swing.JPanel();
49 | jScrollPane1 = new javax.swing.JScrollPane();
50 | TableServices = new javax.swing.JTable();
51 | FotodoService = new javax.swing.JLabel();
52 | jButton1 = new javax.swing.JButton();
53 | jButton2 = new javax.swing.JButton();
54 | jButton3 = new javax.swing.JButton();
55 | jMenuBar1 = new javax.swing.JMenuBar();
56 | jMenu1 = new javax.swing.JMenu();
57 | jMenuItem1 = new javax.swing.JMenuItem();
58 |
59 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
60 |
61 | jPanel1.setBackground(new java.awt.Color(0, 0, 0, 140));
62 |
63 | TableServices.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
64 | TableServices.setModel(new javax.swing.table.DefaultTableModel(
65 | new Object [][] {
66 | {null, null, null},
67 | {null, null, null},
68 | {null, null, null},
69 | {null, null, null}
70 | },
71 | new String [] {
72 | "Codigo", "Corte", "Preço"
73 | }
74 | ));
75 | TableServices.addMouseListener(new java.awt.event.MouseAdapter() {
76 | public void mouseClicked(java.awt.event.MouseEvent evt) {
77 | TableServicesMouseClicked(evt);
78 | }
79 | });
80 | jScrollPane1.setViewportView(TableServices);
81 |
82 | FotodoService.setBackground(new java.awt.Color(0, 0, 0));
83 | FotodoService.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
84 | FotodoService.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsImagens/service.jpg"))); // NOI18N
85 |
86 | jButton1.setText("Novo");
87 | jButton1.addActionListener(new java.awt.event.ActionListener() {
88 | public void actionPerformed(java.awt.event.ActionEvent evt) {
89 | jButton1ActionPerformed(evt);
90 | }
91 | });
92 |
93 | jButton2.setText("Delete");
94 | jButton2.addActionListener(new java.awt.event.ActionListener() {
95 | public void actionPerformed(java.awt.event.ActionEvent evt) {
96 | jButton2ActionPerformed(evt);
97 | }
98 | });
99 |
100 | jButton3.setText("Alterar");
101 | jButton3.addActionListener(new java.awt.event.ActionListener() {
102 | public void actionPerformed(java.awt.event.ActionEvent evt) {
103 | jButton3ActionPerformed(evt);
104 | }
105 | });
106 |
107 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
108 | jPanel1.setLayout(jPanel1Layout);
109 | jPanel1Layout.setHorizontalGroup(
110 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
111 | .addGroup(jPanel1Layout.createSequentialGroup()
112 | .addGap(102, 102, 102)
113 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
114 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 600, javax.swing.GroupLayout.PREFERRED_SIZE)
115 | .addGroup(jPanel1Layout.createSequentialGroup()
116 | .addComponent(FotodoService)
117 | .addGap(59, 59, 59)
118 | .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
119 | .addGap(59, 59, 59)
120 | .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)
121 | .addGap(60, 60, 60)
122 | .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 72, javax.swing.GroupLayout.PREFERRED_SIZE)))
123 | .addGap(0, 133, Short.MAX_VALUE))
124 | );
125 | jPanel1Layout.setVerticalGroup(
126 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
127 | .addGroup(jPanel1Layout.createSequentialGroup()
128 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
129 | .addGroup(jPanel1Layout.createSequentialGroup()
130 | .addGap(0, 0, Short.MAX_VALUE)
131 | .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
132 | .addComponent(jButton2, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
133 | .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE)
134 | .addComponent(jButton3, javax.swing.GroupLayout.PREFERRED_SIZE, 36, javax.swing.GroupLayout.PREFERRED_SIZE))
135 | .addGap(54, 54, 54))
136 | .addGroup(jPanel1Layout.createSequentialGroup()
137 | .addGap(22, 22, 22)
138 | .addComponent(FotodoService)
139 | .addGap(30, 30, 30)))
140 | .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, 184, javax.swing.GroupLayout.PREFERRED_SIZE)
141 | .addGap(32, 32, 32))
142 | );
143 |
144 | jMenu1.setForeground(new java.awt.Color(255, 255, 255));
145 | jMenu1.setText("Ações");
146 |
147 | jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsIcons/usuario-icon.png"))); // NOI18N
148 | jMenuItem1.setText("Voltar");
149 | jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
150 | public void actionPerformed(java.awt.event.ActionEvent evt) {
151 | jMenuItem1ActionPerformed(evt);
152 | }
153 | });
154 | jMenu1.add(jMenuItem1);
155 |
156 | jMenuBar1.add(jMenu1);
157 |
158 | setJMenuBar(jMenuBar1);
159 |
160 | javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
161 | getContentPane().setLayout(layout);
162 | layout.setHorizontalGroup(
163 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
164 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
165 | .addContainerGap()
166 | .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
167 | .addContainerGap())
168 | );
169 | layout.setVerticalGroup(
170 | layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
171 | .addGroup(layout.createSequentialGroup()
172 | .addContainerGap()
173 | .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
174 | .addContainerGap(27, Short.MAX_VALUE))
175 | );
176 |
177 | pack();
178 | }// //GEN-END:initComponents
179 |
180 | private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
181 | try {
182 | // TODO add your handling code here:
183 | MenuBarbeiro menu = new MenuBarbeiro();
184 | menu.setVisible(true);
185 | setVisible(false);
186 | } catch (SQLException ex) {
187 | Logger.getLogger(TelaService.class.getName()).log(Level.SEVERE, null, ex);
188 | }
189 | }//GEN-LAST:event_jMenuItem1ActionPerformed
190 |
191 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
192 | // TODO add your handling code here:
193 | AddService service = new AddService();
194 | service.setVisible(true);
195 | setVisible(false);
196 | }//GEN-LAST:event_jButton1ActionPerformed
197 |
198 | private void TableServicesMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_TableServicesMouseClicked
199 | try {
200 | // TODO add your handling code here:
201 | controller.VincularCampodaTabelaService();
202 | } catch (SQLException ex) {
203 | Logger.getLogger(TelaService.class.getName()).log(Level.SEVERE, null, ex);
204 | }
205 | }//GEN-LAST:event_TableServicesMouseClicked
206 |
207 | private void jButton2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton2ActionPerformed
208 | // TODO add your handling code here:
209 | serviceController.Excluir();
210 | }//GEN-LAST:event_jButton2ActionPerformed
211 |
212 | private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
213 | // TODO add your handling code here:
214 | AlterarService alterar = new AlterarService();
215 | alterar.setVisible(true);
216 | setVisible(false);
217 |
218 | }//GEN-LAST:event_jButton3ActionPerformed
219 |
220 | /**
221 | * @param args the command line arguments
222 | */
223 | public static void main(String args[]) {
224 | /* Set the Nimbus look and feel */
225 | //
226 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
227 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
228 | */
229 | try {
230 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
231 | if ("Nimbus".equals(info.getName())) {
232 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
233 | break;
234 | }
235 | }
236 | } catch (ClassNotFoundException ex) {
237 | java.util.logging.Logger.getLogger(TelaService.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
238 | } catch (InstantiationException ex) {
239 | java.util.logging.Logger.getLogger(TelaService.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
240 | } catch (IllegalAccessException ex) {
241 | java.util.logging.Logger.getLogger(TelaService.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
242 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
243 | java.util.logging.Logger.getLogger(TelaService.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
244 | }
245 | //
246 |
247 | /* Create and display the form */
248 | java.awt.EventQueue.invokeLater(new Runnable() {
249 | public void run() {
250 | try {
251 | new TelaService().setVisible(true);
252 | } catch (SQLException ex) {
253 | Logger.getLogger(TelaService.class.getName()).log(Level.SEVERE, null, ex);
254 | }
255 | }
256 | });
257 | }
258 |
259 | // Variables declaration - do not modify//GEN-BEGIN:variables
260 | private javax.swing.JLabel FotodoService;
261 | private javax.swing.JTable TableServices;
262 | private javax.swing.JButton jButton1;
263 | private javax.swing.JButton jButton2;
264 | private javax.swing.JButton jButton3;
265 | private javax.swing.JMenu jMenu1;
266 | private javax.swing.JMenuBar jMenuBar1;
267 | private javax.swing.JMenuItem jMenuItem1;
268 | private javax.swing.JPanel jPanel1;
269 | private javax.swing.JScrollPane jScrollPane1;
270 | // End of variables declaration//GEN-END:variables
271 |
272 | public JTable getTableServices() {
273 | return TableServices;
274 | }
275 |
276 | public void setTableServices(JTable TableServices) {
277 | this.TableServices = TableServices;
278 | }
279 |
280 | public JLabel getFotodoService() {
281 | return FotodoService;
282 | }
283 |
284 | public void setFotodoService(JLabel FotodoService) {
285 | this.FotodoService = FotodoService;
286 | }
287 |
288 |
289 |
290 |
291 | }
292 |
--------------------------------------------------------------------------------
/src/Views/LoginBarbeiro.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
4 | */
5 | package Views;
6 |
7 | import Controller.BarbeiroController;
8 | import DAO.Conexao;
9 | import java.sql.Connection;
10 | import java.sql.PreparedStatement;
11 | import java.sql.SQLException;
12 | import java.util.logging.Level;
13 | import java.util.logging.Logger;
14 | import javax.swing.JPasswordField;
15 | import javax.swing.JTextField;
16 | /**
17 | *
18 | * @author Biel
19 | */
20 | public class LoginBarbeiro extends javax.swing.JFrame {
21 |
22 | private final BarbeiroController controller;
23 | /**
24 | * Creates new form LoginBarbeiro
25 | */
26 | public LoginBarbeiro() {
27 | initComponents();
28 | controller = new BarbeiroController(this);
29 | }
30 |
31 | public LoginBarbeiro(BarbeiroController controller) {
32 | this.controller = controller;
33 | }
34 |
35 | /**
36 | * This method is called from within the constructor to initialize the form.
37 | * WARNING: Do NOT modify this code. The content of this method is always
38 | * regenerated by the Form Editor.
39 | */
40 | @SuppressWarnings("unchecked")
41 | // //GEN-BEGIN:initComponents
42 | private void initComponents() {
43 |
44 | jPanel2 = new javax.swing.JPanel();
45 | jLabel3 = new javax.swing.JLabel();
46 | jLabel4 = new javax.swing.JLabel();
47 | jLabel6 = new javax.swing.JLabel();
48 | jLabel2 = new javax.swing.JLabel();
49 | jButton1 = new javax.swing.JButton();
50 | VarNameBarbeiro = new javax.swing.JTextField();
51 | VarPasswordBarbeiro = new javax.swing.JPasswordField();
52 | jLabel5 = new javax.swing.JLabel();
53 | jPanel1 = new javax.swing.JPanel();
54 | jLabel8 = new javax.swing.JLabel();
55 |
56 | setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
57 | getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
58 |
59 | jPanel2.setBackground(new java.awt.Color(0, 0, 0, 150));
60 | jPanel2.setForeground(new java.awt.Color(244, 244, 244));
61 |
62 | jLabel3.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
63 | jLabel3.setForeground(new java.awt.Color(255, 255, 255));
64 | jLabel3.setText("Nome:");
65 |
66 | jLabel4.setFont(new java.awt.Font("Segoe UI", 1, 14)); // NOI18N
67 | jLabel4.setForeground(new java.awt.Color(255, 255, 255));
68 | jLabel4.setText("Senha:");
69 |
70 | jLabel6.setForeground(new java.awt.Color(255, 255, 255));
71 | jLabel6.setText("Esqueceu a Senha?");
72 |
73 | jLabel2.setFont(new java.awt.Font("Segoe UI", 1, 18)); // NOI18N
74 | jLabel2.setForeground(new java.awt.Color(255, 255, 255));
75 | jLabel2.setText("Entrar como barbeiro");
76 |
77 | jButton1.setBackground(new java.awt.Color(0, 153, 0));
78 | jButton1.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
79 | jButton1.setForeground(new java.awt.Color(255, 255, 255));
80 | jButton1.setText("ENTRAR");
81 | jButton1.setBorder(null);
82 | jButton1.addActionListener(new java.awt.event.ActionListener() {
83 | public void actionPerformed(java.awt.event.ActionEvent evt) {
84 | jButton1ActionPerformed(evt);
85 | }
86 | });
87 |
88 | VarNameBarbeiro.setBorder(null);
89 | VarNameBarbeiro.addActionListener(new java.awt.event.ActionListener() {
90 | public void actionPerformed(java.awt.event.ActionEvent evt) {
91 | VarNameBarbeiroActionPerformed(evt);
92 | }
93 | });
94 |
95 | VarPasswordBarbeiro.setBorder(null);
96 | VarPasswordBarbeiro.addActionListener(new java.awt.event.ActionListener() {
97 | public void actionPerformed(java.awt.event.ActionEvent evt) {
98 | VarPasswordBarbeiroActionPerformed(evt);
99 | }
100 | });
101 |
102 | jLabel5.setForeground(new java.awt.Color(255, 255, 255));
103 | jLabel5.setText("Entrar como Cliente");
104 | jLabel5.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));
105 | jLabel5.addMouseListener(new java.awt.event.MouseAdapter() {
106 | public void mouseClicked(java.awt.event.MouseEvent evt) {
107 | jLabel5MouseClicked(evt);
108 | }
109 | });
110 |
111 | jPanel1.setBackground(new java.awt.Color(153, 153, 153));
112 |
113 | jLabel8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsImagens/Logo_resized.png"))); // NOI18N
114 |
115 | javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
116 | jPanel1.setLayout(jPanel1Layout);
117 | jPanel1Layout.setHorizontalGroup(
118 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
119 | .addGroup(jPanel1Layout.createSequentialGroup()
120 | .addGap(23, 23, 23)
121 | .addComponent(jLabel8)
122 | .addContainerGap(14, Short.MAX_VALUE))
123 | );
124 | jPanel1Layout.setVerticalGroup(
125 | jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
126 | .addGroup(jPanel1Layout.createSequentialGroup()
127 | .addGap(45, 45, 45)
128 | .addComponent(jLabel8)
129 | .addContainerGap(55, Short.MAX_VALUE))
130 | );
131 |
132 | javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
133 | jPanel2.setLayout(jPanel2Layout);
134 | jPanel2Layout.setHorizontalGroup(
135 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
136 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
137 | .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
138 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 63, Short.MAX_VALUE)
139 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
140 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
141 | .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
142 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
143 | .addComponent(jLabel3, javax.swing.GroupLayout.Alignment.LEADING)
144 | .addComponent(jLabel4, javax.swing.GroupLayout.Alignment.LEADING)
145 | .addComponent(VarNameBarbeiro, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 200, Short.MAX_VALUE)
146 | .addComponent(VarPasswordBarbeiro, javax.swing.GroupLayout.Alignment.LEADING)
147 | .addComponent(jButton1, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
148 | .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel2Layout.createSequentialGroup()
149 | .addGap(9, 9, 9)
150 | .addComponent(jLabel2)))
151 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
152 | .addComponent(jLabel6)
153 | .addGap(56, 56, 56)))
154 | .addGap(60, 60, 60))
155 | .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel2Layout.createSequentialGroup()
156 | .addComponent(jLabel5)
157 | .addGap(107, 107, 107))))
158 | );
159 | jPanel2Layout.setVerticalGroup(
160 | jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
161 | .addGroup(jPanel2Layout.createSequentialGroup()
162 | .addGap(52, 52, 52)
163 | .addComponent(jLabel2)
164 | .addGap(26, 26, 26)
165 | .addComponent(jLabel3)
166 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
167 | .addComponent(VarNameBarbeiro, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
168 | .addGap(18, 18, 18)
169 | .addComponent(jLabel4)
170 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
171 | .addComponent(VarPasswordBarbeiro, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
172 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
173 | .addComponent(jLabel6)
174 | .addGap(18, 18, 18)
175 | .addComponent(jButton1, javax.swing.GroupLayout.PREFERRED_SIZE, 40, javax.swing.GroupLayout.PREFERRED_SIZE)
176 | .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
177 | .addComponent(jLabel5)
178 | .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
179 | .addGroup(jPanel2Layout.createSequentialGroup()
180 | .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
181 | .addGap(0, 0, Short.MAX_VALUE))
182 | );
183 |
184 | getContentPane().add(jPanel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 660, 400));
185 |
186 | pack();
187 | }// //GEN-END:initComponents
188 |
189 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
190 | try {
191 | // TODO add your handling code here:
192 | controller.Autenticar();
193 | } catch (SQLException ex) {
194 | Logger.getLogger(LoginBarbeiro.class.getName()).log(Level.SEVERE, null, ex);
195 | }
196 |
197 | }//GEN-LAST:event_jButton1ActionPerformed
198 |
199 | private void VarNameBarbeiroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_VarNameBarbeiroActionPerformed
200 | // TODO add your handling code here:
201 | }//GEN-LAST:event_VarNameBarbeiroActionPerformed
202 |
203 | private void jLabel5MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel5MouseClicked
204 | // TODO add your handling code here:
205 | LoginCliente cliente = new LoginCliente();
206 | cliente.setVisible(true);
207 | setVisible(false);
208 | }//GEN-LAST:event_jLabel5MouseClicked
209 |
210 | private void VarPasswordBarbeiroActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_VarPasswordBarbeiroActionPerformed
211 | // TODO add your handling code here:
212 | }//GEN-LAST:event_VarPasswordBarbeiroActionPerformed
213 |
214 | /**
215 | * @param args the command line arguments
216 | */
217 | public static void main(String args[]) {
218 | /* Set the Nimbus look and feel */
219 | //
220 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
221 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
222 | */
223 | try {
224 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
225 | if ("Nimbus".equals(info.getName())) {
226 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
227 | break;
228 | }
229 | }
230 | } catch (ClassNotFoundException ex) {
231 | java.util.logging.Logger.getLogger(LoginBarbeiro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
232 | } catch (InstantiationException ex) {
233 | java.util.logging.Logger.getLogger(LoginBarbeiro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
234 | } catch (IllegalAccessException ex) {
235 | java.util.logging.Logger.getLogger(LoginBarbeiro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
236 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
237 | java.util.logging.Logger.getLogger(LoginBarbeiro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
238 | }
239 | //
240 |
241 | /* Create and display the form */
242 | java.awt.EventQueue.invokeLater(new Runnable() {
243 | public void run() {
244 | new LoginBarbeiro().setVisible(true);
245 | }
246 | });
247 | }
248 |
249 | public JTextField getVarNameBarbeiro() {
250 | return VarNameBarbeiro;
251 | }
252 |
253 | public void setVarNameBarbeiro(JTextField VarNameBarbeiro) {
254 | this.VarNameBarbeiro = VarNameBarbeiro;
255 | }
256 |
257 | public JPasswordField getVarPasswordBarbeiro() {
258 | return VarPasswordBarbeiro;
259 | }
260 |
261 | public void setVarPasswordBarbeiro(JPasswordField VarPasswordBarbeiro) {
262 | this.VarPasswordBarbeiro = VarPasswordBarbeiro;
263 | }
264 |
265 |
266 |
267 |
268 | // Variables declaration - do not modify//GEN-BEGIN:variables
269 | private javax.swing.JTextField VarNameBarbeiro;
270 | private javax.swing.JPasswordField VarPasswordBarbeiro;
271 | private javax.swing.JButton jButton1;
272 | private javax.swing.JLabel jLabel2;
273 | private javax.swing.JLabel jLabel3;
274 | private javax.swing.JLabel jLabel4;
275 | private javax.swing.JLabel jLabel5;
276 | private javax.swing.JLabel jLabel6;
277 | private javax.swing.JLabel jLabel8;
278 | private javax.swing.JPanel jPanel1;
279 | private javax.swing.JPanel jPanel2;
280 | // End of variables declaration//GEN-END:variables
281 | }
282 |
--------------------------------------------------------------------------------
/src/Views/LoginBarbeiro.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
243 |
--------------------------------------------------------------------------------
/src/Views/MenuBarbeiro.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
263 |
--------------------------------------------------------------------------------
/src/Views/MenuBarbeiro.java:
--------------------------------------------------------------------------------
1 | /*
2 | * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
3 | * Click nbfs://nbhost/SystemFileSystem/Templates/GUIForms/JFrame.java to edit this template
4 | */
5 | package Views;
6 |
7 | import Controller.AgendamentoController;
8 | import Controller.BarbeiroController;
9 | import java.sql.SQLException;
10 | import java.util.logging.Level;
11 | import java.util.logging.Logger;
12 | import javax.swing.JLabel;
13 | import javax.swing.JTable;
14 |
15 | /**
16 | *
17 | * @author Biel
18 | */
19 | public class MenuBarbeiro extends javax.swing.JFrame {
20 |
21 | private BarbeiroController controller;
22 | private AgendamentoController agendamentoController;
23 | private MenuBarbeiro menu;
24 |
25 | public MenuBarbeiro(BarbeiroController controller) {
26 | this.controller = controller;
27 | }
28 |
29 | /**
30 | * Creates new form MenuBarbeiro
31 | */
32 | public MenuBarbeiro() throws SQLException {
33 | initComponents();
34 | controller = new BarbeiroController(this);
35 | agendamentoController = new AgendamentoController(this);
36 | iniciarTable();
37 | }
38 |
39 | private void iniciarTable() throws SQLException {
40 | controller.atualizarTabelaAgendamento();
41 | }
42 |
43 |
44 |
45 |
46 | /**
47 | * This method is called from within the constructor to initialize the form.
48 | * WARNING: Do NOT modify this code. The content of this method is always
49 | * regenerated by the Form Editor.
50 | */
51 | @SuppressWarnings("unchecked")
52 | // //GEN-BEGIN:initComponents
53 | private void initComponents() {
54 |
55 | jScrollPane1 = new javax.swing.JScrollPane();
56 | TableAgendamentos = new javax.swing.JTable();
57 | TodosAgendamentos = new javax.swing.JButton();
58 | jButton1 = new javax.swing.JButton();
59 | AgendamentoHistorico = new javax.swing.JButton();
60 | Welcome = new javax.swing.JLabel();
61 | AgendamentoHoje = new javax.swing.JButton();
62 | jLabel1 = new javax.swing.JLabel();
63 | jLabel2 = new javax.swing.JLabel();
64 | jMenuBar1 = new javax.swing.JMenuBar();
65 | jMenu2 = new javax.swing.JMenu();
66 | jMenuItem2 = new javax.swing.JMenuItem();
67 | jMenuItem3 = new javax.swing.JMenuItem();
68 | jMenuItem1 = new javax.swing.JMenuItem();
69 | jMenuItem4 = new javax.swing.JMenuItem();
70 |
71 | setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
72 | getContentPane().setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
73 |
74 | TableAgendamentos.setBackground(new java.awt.Color(255, 255, 255));
75 | TableAgendamentos.setForeground(new java.awt.Color(0, 0, 0));
76 | TableAgendamentos.setModel(new javax.swing.table.DefaultTableModel(
77 | new Object [][] {
78 | {null, null, null, null, null, null, null, null},
79 | {null, null, null, null, null, null, null, null},
80 | {null, null, null, null, null, null, null, null},
81 | {null, null, null, null, null, null, null, null}
82 | },
83 | new String [] {
84 | "Código", "Nome", "whats", "Serviço", "Data", "Hora", "Preço", "Obser"
85 | }
86 | ));
87 | jScrollPane1.setViewportView(TableAgendamentos);
88 |
89 | getContentPane().add(jScrollPane1, new org.netbeans.lib.awtextra.AbsoluteConstraints(100, 120, 910, 330));
90 |
91 | TodosAgendamentos.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
92 | TodosAgendamentos.setForeground(new java.awt.Color(255, 255, 255));
93 | TodosAgendamentos.setText("Em Dia");
94 | TodosAgendamentos.addActionListener(new java.awt.event.ActionListener() {
95 | public void actionPerformed(java.awt.event.ActionEvent evt) {
96 | TodosAgendamentosActionPerformed(evt);
97 | }
98 | });
99 | getContentPane().add(TodosAgendamentos, new org.netbeans.lib.awtextra.AbsoluteConstraints(320, 70, 70, 30));
100 |
101 | jButton1.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
102 | jButton1.setForeground(new java.awt.Color(255, 255, 255));
103 | jButton1.setText("Delete");
104 | jButton1.addActionListener(new java.awt.event.ActionListener() {
105 | public void actionPerformed(java.awt.event.ActionEvent evt) {
106 | jButton1ActionPerformed(evt);
107 | }
108 | });
109 | getContentPane().add(jButton1, new org.netbeans.lib.awtextra.AbsoluteConstraints(580, 70, -1, 30));
110 |
111 | AgendamentoHistorico.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
112 | AgendamentoHistorico.setForeground(new java.awt.Color(255, 255, 255));
113 | AgendamentoHistorico.setText("Historico");
114 | AgendamentoHistorico.addActionListener(new java.awt.event.ActionListener() {
115 | public void actionPerformed(java.awt.event.ActionEvent evt) {
116 | AgendamentoHistoricoActionPerformed(evt);
117 | }
118 | });
119 | getContentPane().add(AgendamentoHistorico, new org.netbeans.lib.awtextra.AbsoluteConstraints(480, 70, -1, 30));
120 |
121 | Welcome.setFont(new java.awt.Font("Segoe UI", 1, 20)); // NOI18N
122 | Welcome.setForeground(new java.awt.Color(255, 255, 255));
123 | getContentPane().add(Welcome, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 10, 290, 30));
124 |
125 | AgendamentoHoje.setFont(new java.awt.Font("Segoe UI", 1, 12)); // NOI18N
126 | AgendamentoHoje.setForeground(new java.awt.Color(255, 255, 255));
127 | AgendamentoHoje.setText("Hoje");
128 | AgendamentoHoje.addActionListener(new java.awt.event.ActionListener() {
129 | public void actionPerformed(java.awt.event.ActionEvent evt) {
130 | AgendamentoHojeActionPerformed(evt);
131 | }
132 | });
133 | getContentPane().add(AgendamentoHoje, new org.netbeans.lib.awtextra.AbsoluteConstraints(410, 70, -1, 30));
134 |
135 | jLabel1.setFont(new java.awt.Font("Segoe UI", 1, 24)); // NOI18N
136 | jLabel1.setForeground(new java.awt.Color(255, 255, 255));
137 | jLabel1.setText("Agendamentos");
138 | getContentPane().add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(120, 70, -1, -1));
139 |
140 | jLabel2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsImagens/BannerPC.jpg"))); // NOI18N
141 | getContentPane().add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(0, 0, 1130, 490));
142 |
143 | jMenuBar1.setBackground(new java.awt.Color(255, 255, 255));
144 | jMenuBar1.setForeground(new java.awt.Color(0, 0, 0));
145 |
146 | jMenu2.setText("Edit");
147 |
148 | jMenuItem2.setForeground(new java.awt.Color(0, 0, 0));
149 | jMenuItem2.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsIcons/tesoura-icon.png"))); // NOI18N
150 | jMenuItem2.setText("Serviços");
151 | jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
152 | public void actionPerformed(java.awt.event.ActionEvent evt) {
153 | jMenuItem2ActionPerformed(evt);
154 | }
155 | });
156 | jMenu2.add(jMenuItem2);
157 |
158 | jMenuItem3.setForeground(new java.awt.Color(0, 0, 0));
159 | jMenuItem3.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsIcons/usuario-icon.png"))); // NOI18N
160 | jMenuItem3.setText("Sair");
161 | jMenuItem3.addActionListener(new java.awt.event.ActionListener() {
162 | public void actionPerformed(java.awt.event.ActionEvent evt) {
163 | jMenuItem3ActionPerformed(evt);
164 | }
165 | });
166 | jMenu2.add(jMenuItem3);
167 |
168 | jMenuItem1.setForeground(new java.awt.Color(0, 0, 0));
169 | jMenuItem1.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsIcons/cliente-icon.png"))); // NOI18N
170 | jMenuItem1.setText("Novo Acesso");
171 | jMenuItem1.addActionListener(new java.awt.event.ActionListener() {
172 | public void actionPerformed(java.awt.event.ActionEvent evt) {
173 | jMenuItem1ActionPerformed(evt);
174 | }
175 | });
176 | jMenu2.add(jMenuItem1);
177 |
178 | jMenuItem4.setForeground(new java.awt.Color(0, 0, 0));
179 | jMenuItem4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/ViewsIcons/agenda-icon.png"))); // NOI18N
180 | jMenuItem4.setText("Agendar");
181 | jMenuItem4.addActionListener(new java.awt.event.ActionListener() {
182 | public void actionPerformed(java.awt.event.ActionEvent evt) {
183 | jMenuItem4ActionPerformed(evt);
184 | }
185 | });
186 | jMenu2.add(jMenuItem4);
187 |
188 | jMenuBar1.add(jMenu2);
189 |
190 | setJMenuBar(jMenuBar1);
191 |
192 | pack();
193 | }// //GEN-END:initComponents
194 |
195 | private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
196 | try {
197 | // TODO add your handling code here:
198 | TelaService services = new TelaService();
199 | services.setVisible(true);
200 | setVisible(false);
201 | } catch (SQLException ex) {
202 | Logger.getLogger(MenuBarbeiro.class.getName()).log(Level.SEVERE, null, ex);
203 | }
204 |
205 | }//GEN-LAST:event_jMenuItem2ActionPerformed
206 |
207 | private void jMenuItem3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem3ActionPerformed
208 | // TODO add your handling code here:
209 | LoginBarbeiro login = new LoginBarbeiro();
210 | login.setVisible(true);
211 | setVisible(false);
212 | }//GEN-LAST:event_jMenuItem3ActionPerformed
213 |
214 | private void jMenuItem1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem1ActionPerformed
215 | // TODO add your handling code here:
216 | CadastrarBarbeiro cadastrar = new CadastrarBarbeiro();
217 | cadastrar.setVisible(true);
218 | setVisible(false);
219 | }//GEN-LAST:event_jMenuItem1ActionPerformed
220 |
221 | private void TodosAgendamentosActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TodosAgendamentosActionPerformed
222 | try {
223 | // TODO add your handling code here:
224 | controller.filtrarTodos();
225 | } catch (SQLException ex) {
226 | Logger.getLogger(MenuBarbeiro.class.getName()).log(Level.SEVERE, null, ex);
227 | }
228 | }//GEN-LAST:event_TodosAgendamentosActionPerformed
229 |
230 | private void AgendamentoHojeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AgendamentoHojeActionPerformed
231 | try {
232 | // TODO add your handling code here:
233 | controller.filtrarAgendamentosHoje();
234 | } catch (SQLException ex) {
235 | Logger.getLogger(MenuBarbeiro.class.getName()).log(Level.SEVERE, null, ex);
236 | }
237 | }//GEN-LAST:event_AgendamentoHojeActionPerformed
238 |
239 | private void AgendamentoHistoricoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_AgendamentoHistoricoActionPerformed
240 | try {
241 | // TODO add your handling code here:
242 | controller.atualizarHistoricodaTabela();
243 | } catch (SQLException ex) {
244 | Logger.getLogger(MenuBarbeiro.class.getName()).log(Level.SEVERE, null, ex);
245 | }
246 | }//GEN-LAST:event_AgendamentoHistoricoActionPerformed
247 |
248 | private void jButton1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton1ActionPerformed
249 | // TODO add your handling code here:
250 | agendamentoController.ExcluirAgendamento();
251 |
252 | }//GEN-LAST:event_jButton1ActionPerformed
253 |
254 | private void jMenuItem4ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem4ActionPerformed
255 | // TODO add your handling code here:
256 | TelaAgendamentoBarbeiro agendar = new TelaAgendamentoBarbeiro();
257 | agendar.setVisible(true);
258 | setVisible(false);
259 | }//GEN-LAST:event_jMenuItem4ActionPerformed
260 |
261 | /**
262 | * @param args the command line arguments
263 | */
264 | public static void main(String args[]) {
265 | /* Set the Nimbus look and feel */
266 | //
267 | /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
268 | * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
269 | */
270 | try {
271 | for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
272 | if ("Nimbus".equals(info.getName())) {
273 | javax.swing.UIManager.setLookAndFeel(info.getClassName());
274 | break;
275 | }
276 | }
277 | } catch (ClassNotFoundException ex) {
278 | java.util.logging.Logger.getLogger(MenuBarbeiro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
279 | } catch (InstantiationException ex) {
280 | java.util.logging.Logger.getLogger(MenuBarbeiro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
281 | } catch (IllegalAccessException ex) {
282 | java.util.logging.Logger.getLogger(MenuBarbeiro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
283 | } catch (javax.swing.UnsupportedLookAndFeelException ex) {
284 | java.util.logging.Logger.getLogger(MenuBarbeiro.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
285 | }
286 | //
287 |
288 | /* Create and display the form */
289 | java.awt.EventQueue.invokeLater(new Runnable() {
290 | public void run() {
291 | try {
292 | new MenuBarbeiro().setVisible(true);
293 | } catch (SQLException ex) {
294 | Logger.getLogger(MenuBarbeiro.class.getName()).log(Level.SEVERE, null, ex);
295 | }
296 | }
297 | });
298 | }
299 |
300 | public JTable getTableAgendamentos() {
301 | return TableAgendamentos;
302 | }
303 |
304 | public void setTableAgendamentos(JTable TableAgendamentos) {
305 | this.TableAgendamentos = TableAgendamentos;
306 | }
307 | public JLabel getWelcome() {
308 | return Welcome;
309 | }
310 |
311 | public void setWelcome(JLabel Welcome) {
312 | this.Welcome = Welcome;
313 | }
314 |
315 | // Variables declaration - do not modify//GEN-BEGIN:variables
316 | private javax.swing.JButton AgendamentoHistorico;
317 | private javax.swing.JButton AgendamentoHoje;
318 | private javax.swing.JTable TableAgendamentos;
319 | private javax.swing.JButton TodosAgendamentos;
320 | private javax.swing.JLabel Welcome;
321 | private javax.swing.JButton jButton1;
322 | private javax.swing.JLabel jLabel1;
323 | private javax.swing.JLabel jLabel2;
324 | private javax.swing.JMenu jMenu2;
325 | private javax.swing.JMenuBar jMenuBar1;
326 | private javax.swing.JMenuItem jMenuItem1;
327 | private javax.swing.JMenuItem jMenuItem2;
328 | private javax.swing.JMenuItem jMenuItem3;
329 | private javax.swing.JMenuItem jMenuItem4;
330 | private javax.swing.JScrollPane jScrollPane1;
331 | // End of variables declaration//GEN-END:variables
332 | }
333 |
--------------------------------------------------------------------------------
/src/Views/ControleHorario.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
267 |
--------------------------------------------------------------------------------
/src/Views/AddService.form:
--------------------------------------------------------------------------------
1 |
2 |
3 |
273 |
--------------------------------------------------------------------------------