Skip to content

Commit

Permalink
Merge pull request #198 from gustavohenriquefs/Feature/VinculoInstitu…
Browse files Browse the repository at this point in the history
…icoes

Feature/vinculo instituicoes
  • Loading branch information
Francisco-Paulino-Arruda-Filho authored Nov 29, 2023
2 parents 5558ac1 + c3f22da commit 2770217
Show file tree
Hide file tree
Showing 10 changed files with 462 additions and 392 deletions.
17 changes: 12 additions & 5 deletions src/main/java/com/casaculturaqxd/sgec/DAO/InstituicaoDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,11 @@ public ArrayList<String> listarInstituicoes() throws SQLException {
while (resultSet.next()) {
nomeStrings.add(resultSet.getString("nome_instituicao"));
}

} catch (Exception e) {
logException(e);
throw new SQLException(e);

} finally {
statement.close();
}
Expand Down Expand Up @@ -147,7 +147,14 @@ public boolean atualizarInstituicao(Instituicao instituicao) throws SQLException
try {
Integer idServiceFile = null;
if (instituicao.getImagemCapa() != null) {
instituicao.getImagemCapa().getServiceFileId();
ServiceFileDAO serviceFileDAO = new ServiceFileDAO(conn);
Optional<ServiceFile> optionalFile = serviceFileDAO.getArquivo(instituicao.getImagemCapa().getFileKey());
if (optionalFile.isPresent()) {
instituicao.setImagemCapa(optionalFile.get());
} else {
serviceFileDAO.inserirArquivo(instituicao.getImagemCapa());
}
idServiceFile = instituicao.getImagemCapa().getServiceFileId();
}
statement.setString(1, instituicao.getNome());
statement.setObject(2, idServiceFile, Types.INTEGER);
Expand Down Expand Up @@ -340,7 +347,7 @@ public boolean atualizarOrganizadorEvento(Instituicao instituicao, Integer idEve
+ " WHERE id_instituicao = ? AND id_evento = ?";
PreparedStatement stmt = conn.prepareStatement(sql);
try {

atualizarInstituicao(instituicao);
stmt.setString(1, instituicao.getDescricaoContribuicao());
stmt.setString(2, instituicao.getValorContribuicao());
stmt.setInt(3, instituicao.getIdInstituicao());
Expand All @@ -361,7 +368,7 @@ public boolean atualizarColaboradorEvento(Instituicao instituicao, Integer idEve
+ " WHERE id_instituicao = ? AND id_evento = ?";
PreparedStatement stmt = conn.prepareStatement(sql);
try {

atualizarInstituicao(instituicao);
stmt.setString(1, instituicao.getDescricaoContribuicao());
stmt.setString(2, instituicao.getValorContribuicao());
stmt.setInt(3, instituicao.getIdInstituicao());
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ public class LoginController {

private User usuario;
private UserDAO userDAO;
private final DatabasePostgres userConnection = DatabasePostgres.getInstance("URL", "USER_NAME", "PASSWORD");
private final DatabasePostgres userConnection = DatabasePostgres.getInstance("URL_TEST", "USER_NAME_TEST",
"PASSWORD_TEST");

/**
* Carrega a página com o botão de login desabilitado
Expand All @@ -40,8 +41,8 @@ public void initialize() {
}

/**
* verifica no banco de dados se as credenciais estão corretas,
* se sim transita para a proxima tela.
* verifica no banco de dados se as credenciais estão corretas, se sim transita
* para a proxima tela.
*
* @throws IOException
* @throws NoSuchAlgorithmException
Expand All @@ -50,7 +51,7 @@ public void initialize() {
public void authUsuario() throws IOException, SQLException {
usuario = new User(fieldEmail.getText(), fieldSenha.getText());
try {
if(!userDAO.usuarioExists(usuario.getEmail())){
if (!userDAO.usuarioExists(usuario.getEmail())) {
alerta.setAlertType(AlertType.ERROR);
alerta.setContentText("Usuário não existe");
alerta.show();
Expand Down

This file was deleted.

Loading

0 comments on commit 2770217

Please sign in to comment.