Skip to content

Commit

Permalink
Corrigido: Alterar dados de todos os módulos
Browse files Browse the repository at this point in the history
  • Loading branch information
mateus committed Feb 28, 2013
1 parent 079bfd9 commit d857588
Show file tree
Hide file tree
Showing 35 changed files with 381 additions and 56 deletions.
2 changes: 1 addition & 1 deletion build/web/WEB-INF/classes/META-INF/persistence.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="SAECPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>dbexames</jta-data-source>
<jta-data-source>dbExames</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
Expand Down
5 changes: 5 additions & 0 deletions build/web/WEB-INF/faces-config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
<managed-bean-class>com.control.AgendaBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>
<managed-bean>
<managed-bean-name>Relatorio</managed-bean-name>
<managed-bean-class>com.control.RelatorioBean</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
</managed-bean>

<navigation-rule>
<from-view-id>/login.xhtml</from-view-id>
Expand Down
1 change: 0 additions & 1 deletion build/web/agendar.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@

<label><span style="color: red;">*</span> Campos obrigatórios</label>
<center>
<h:commandButton style="margin-top: 15px; margin-right: 10px;" action="#{Agenda.limpar()}" class="btn btn-info" value="Limpar"/>
<h:commandButton style="margin-top: 15px" action="#{Agenda.cadastrar()}" class="btn btn-primary" value="Agendar"/>
<h:messages for="agendar-form" styleClass="alert alert-info pull-right" style="margin-top: 15px; list-style: none; margin-right: 58px; padding-right: 15px;"/>
</center>
Expand Down
4 changes: 2 additions & 2 deletions build/web/altera_exa.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
<h:form id="cad-exa-form">
<fieldset>
<legend>Exame</legend>
<h:inputHidden value="#{Exame.exame.idExame}" id="id" />
<label for="cad-exa-form:nome"><span style="color: red;">*</span> Nome</label>
<h:inputText value="#{Exame.exame.nome}" id="nome" style="width:400px" />
<label for="cad-exa-form:valor"><span style="color: red;">*</span> Valor</label>
Expand All @@ -36,8 +37,7 @@
</fieldset>
<label><span style="color: red;">*</span> Campos obrigatórios</label>
<center>
<h:commandButton style="margin-top: 15px; margin-right: 10px;" class="btn btn-info" type="reset" value="Limpar"/>
<h:commandButton style="margin-top: 15px" class="btn btn-primary" action="#{Exame.cadastrar()}" value="Cadastrar"/>
<h:commandButton style="margin-top: 15px" class="btn btn-primary" action="#{Exame.alterarDados()}" value="Alterar"/>
<h:messages for="cad-exa-form" styleClass="alert alert-info pull-right" style="margin-top: 15px; list-style: none; margin-right: 58px; padding-right: 15px;"/>
</center>
</h:form>
Expand Down
4 changes: 2 additions & 2 deletions build/web/altera_med.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@
<h:form id="cad-med-form">
<fieldset>
<legend>Médico</legend>
<h:inputHidden value="#{Medico.medico.idMedico}" id="id" />
<label for="cad-med-form:nome"><span style="color: red;">*</span> Nome</label>
<h:inputText value="#{Medico.medico.nome}" id="nome" style="width:400px" />
<label for="cad-med-form:crm"><span style="color: red;">*</span> CRM</label>
<h:inputText value="#{Medico.medico.crm}" id="crm" style="width:150px" />
</fieldset>
<label><span style="color: red;">*</span> Campos obrigatórios</label>
<center>
<h:commandButton style="margin-top: 15px; margin-right: 10px;" class="btn btn-info" type="reset" value="Limpar"/>
<h:commandButton style="margin-top: 15px" class="btn btn-primary" action="#{Medico.cadastrar()}" value="Alterar"/>
<h:commandButton style="margin-top: 15px" class="btn btn-primary" action="#{Medico.alterarDados()}" value="Alterar"/>
<h:messages for="cad-med-form" styleClass="alert alert-info pull-right" style="margin-top: 15px; list-style: none; margin-right: 58px; padding-right: 15px;"/>
</center>
</h:form>
Expand Down
4 changes: 2 additions & 2 deletions build/web/altera_pac.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
<h:form id="cad-pac-form">
<fieldset>
<legend>Paciente</legend>
<h:inputHidden value="#{Paciente.paciente.idPaciente}" id="id" />
<label for="cad-pac-form:nome"><span style="color: red;">*</span> Nome</label>
<h:inputText value="#{Paciente.paciente.nome}" id="nome" style="width:400px" />
<label for="cad-pac-form:dataNasc"><span style="color: red;">*</span> Data de Nascimento</label>
Expand Down Expand Up @@ -74,8 +75,7 @@
</fieldset>
<label><span style="color: red;">*</span> Campos obrigatórios</label>
<center>
<h:commandButton style="margin-top: 15px; margin-right: 10px;" class="btn btn-info" type="reset" value="Limpar"/>
<h:commandButton style="margin-top: 15px" class="btn btn-primary" action="#{Paciente.cadastrar()}" value="Alterar"/>
<h:commandButton style="margin-top: 15px" class="btn btn-primary" action="#{Paciente.alterarDados()}" value="Alterar"/>
<h:messages for="cad-pac-form" styleClass="alert alert-info pull-right" style="margin-top: 15px; list-style: none; margin-right: 58px; padding-right: 15px;"/>
</center>
</h:form>
Expand Down
1 change: 0 additions & 1 deletion build/web/cad_exa.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
</fieldset>
<label><span style="color: red;">*</span> Campos obrigatórios</label>
<center>
<h:commandButton style="margin-top: 15px; margin-right: 10px;" class="btn btn-info" type="reset" value="Limpar"/>
<h:commandButton style="margin-top: 15px;" class="btn btn-primary" action="#{Exame.cadastrar()}" value="Cadastrar"/>
<h:messages for="cad-exa-form" styleClass="alert alert-info pull-right" style="margin-top: 15px; list-style: none; margin-right: 58px; padding-right: 15px;"/>
</center>
Expand Down
1 change: 0 additions & 1 deletion build/web/cad_med.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
</fieldset>
<label><span style="color: red;">*</span> Campos obrigatórios</label>
<center>
<h:commandButton style="margin-top: 15px; margin-right: 10px;" class="btn btn-info" type="reset" value="Limpar"/>
<h:commandButton style="margin-top: 15px" class="btn btn-primary" action="#{Medico.cadastrar()}" value="Cadastrar"/>
<h:messages for="cad-med-form" styleClass="alert alert-info pull-right" style="margin-top: 15px; list-style: none; margin-right: 58px; padding-right: 15px;"/>
</center>
Expand Down
1 change: 0 additions & 1 deletion build/web/cad_pac.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
</fieldset>
<label><span style="color: red;">*</span> Campos obrigatórios</label>
<center>
<h:commandButton style="margin-top: 15px; margin-right: 10px;" class="btn btn-info" type="reset" value="Limpar"/>
<h:commandButton style="margin-top: 15px" class="btn btn-primary" action="#{Paciente.cadastrar()}" value="Cadastrar"/>
<h:messages for="cad-pac-form" styleClass="alert alert-info pull-right" style="margin-top: 15px; list-style: none; margin-right: 58px; padding-right: 15px;"/>
</center>
Expand Down
4 changes: 0 additions & 4 deletions build/web/login.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
<meta name="description" content="Sistema para Agendamento de Exames Clínicos" />
<meta name="author" content="Mateus Ferreira Silva" />

<!-- <h:outputScript name="jquery.min.js" library="js" />
<h:outputScript name="login.js" library="js" />-->

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
<script type="text/javascript">
function add_atributo_form(formulario, elemento, atributo, valor){
Expand All @@ -39,7 +36,6 @@
});
});
</script>
<!--<script type="text/javascript" src="resourses/js/placeholder.js"></script>-->
</h:head>
<h:body>
<div id="wrapper">
Expand Down
10 changes: 1 addition & 9 deletions build/web/navbar.xhtml
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,7 @@
<li><h:link value="Consultar" outcome="lista_pac" /></li>
</ul>
</li>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
Relatórios <b class="caret"></b>
</a>
<ul class="dropdown-menu">
<li><h:link value="Exames realizados" /></li>
<li><h:link value="Faturamento" /></li>
</ul>
</li>
<li><h:link value="Relatórios" outcome="relatorios" /></li>
<ul class="nav nav-pills pull-right">
<li><a href="#">Sair</a></li>
</ul>
Expand Down
71 changes: 71 additions & 0 deletions build/web/relatorios.xhtml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core">
<h:head>
<meta charset="utf-8" />
<title>SAEC</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="author" content="Mateus Ferreira Silva" />

<h:outputStylesheet name="bootstrap.css" library="css" />
<h:outputStylesheet name="bootstrap-responsive.css" library="css" />
<h:outputStylesheet name="my-style.css" library="css" />
<link href="resources/img/favicon.gif" type="image/png" rel="icon" />
</h:head>
<body>
<ui:include src="navbar.xhtml" />

<div class="container">
<div class="row-fluid">
<div class="span8 offset2">
<div class="hero-unit">
<h2>Relatórios</h2>
</div>
<div class="span6 offset3">
<h:form id="relatorio-form">
<fieldset>
<legend>Período</legend>
<label for="relatorio-form:data-inicial"><span style="color: red;">*</span> Data inicial</label>
<h:inputText value="#{Relatorio.dataInicial}" id="data-inicial" style="width:150px" >
<f:convertDateTime pattern="yyyy-MM-dd" />
</h:inputText>
<label for="relatorio-form:data-final"><span style="color: red;">*</span> Data final</label>
<h:inputText value="#{Relatorio.dataFinal}" id="data-final" style="width:150px" >
<f:convertDateTime pattern="yyyy-MM-dd" />
</h:inputText>

<label></label>
<h:selectBooleanCheckbox value="#{Relatorio.faturamento}" style="margin-bottom: 5px;" id="relatorio-valorTotal"/> Valor total dos exames

</fieldset>
<label style="padding-top: 10px;"><span style="color: red;">*</span> Campos obrigatórios</label>
<center>
<h:commandButton style="margin-top: 15px;" class="btn btn-primary" action="#{Relatorio.pesquisar()}" value="Pesquisar"/>
<h:messages for="relatorio-form" styleClass="alert alert-info pull-right" style="margin-top: 15px; list-style: none; margin-right: 58px; padding-right: 15px;"/>
</center>
</h:form>
</div>
</div>
</div>
</div>

<ui:include src="footer.xhtml" />

<script src="resources/js/jquery.js"></script>
<script src="resources/js/bootstrap-transition.js"></script>
<script src="resources/js/bootstrap-alert.js"></script>
<script src="resources/js/bootstrap-modal.js"></script>
<script src="resources/js/bootstrap-dropdown.js"></script>
<script src="resources/js/bootstrap-scrollspy.js"></script>
<script src="resources/js/bootstrap-tab.js"></script>
<script src="resources/js/bootstrap-tooltip.js"></script>
<script src="resources/js/bootstrap-popover.js"></script>
<script src="resources/js/bootstrap-button.js"></script>
<script src="resources/js/bootstrap-collapse.js"></script>
<script src="resources/js/bootstrap-carousel.js"></script>
<script src="resources/js/bootstrap-typeahead.js"></script>

</body>
</html>
2 changes: 1 addition & 1 deletion especificacao/.~lock.Trabalho Final Java.docx#
Original file line number Diff line number Diff line change
@@ -1 +1 @@
,mateus,mateus-pc,24.02.2013 14:00,file:///home/mateus/.config/libreoffice/3;
,mateus,mateus-pc,27.02.2013 19:34,file:///home/mateus/.config/libreoffice/3;
12 changes: 6 additions & 6 deletions nbproject/private/private.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
deploy.ant.properties.file=/home/administrador/.netbeans/7.2.1/gfv31160793558.properties
deploy.ant.properties.file=/home/mateus/.netbeans/7.2.1/gfv3-483267606.properties
j2ee.platform.is.jsr109=true
j2ee.server.domain=/home/administrador/glassfish-3.1.2.2/glassfish/domains/domain1
j2ee.server.home=/home/administrador/glassfish-3.1.2.2/glassfish
j2ee.server.instance=[/home/administrador/glassfish-3.1.2.2/glassfish:/home/administrador/glassfish-3.1.2.2/glassfish/domains/domain1]deployer:gfv3ee6wc:localhost:4848
j2ee.server.middleware=/home/administrador/glassfish-3.1.2.2
j2ee.server.domain=/home/mateus/glassfish-3.1.2.2/glassfish/domains/domain1
j2ee.server.home=/home/mateus/glassfish-3.1.2.2/glassfish
j2ee.server.instance=[/home/mateus/glassfish-3.1.2.2/glassfish:/home/mateus/glassfish-3.1.2.2/glassfish/domains/domain1]deployer:gfv3ee6wc:localhost:4848
j2ee.server.middleware=/home/mateus/glassfish-3.1.2.2
javac.debug=true
javadoc.preview=true
user.properties.file=/home/administrador/.netbeans/7.2.1/build.properties
user.properties.file=/home/mateus/.netbeans/7.2.1/build.properties
2 changes: 1 addition & 1 deletion nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ j2ee.compile.on.save=true
j2ee.copy.static.files.on.save=true
j2ee.deploy.on.save=true
j2ee.platform=1.6-web
j2ee.platform.classpath=${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.management.j2ee.jar:${j2ee.server.home}/modules/javax.enterprise.deploy.jar:${j2ee.server.home}/modules/jersey-core.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/javax.security.jacc.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.transaction.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.security.auth.message.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.ejb.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.el-api.jar:${j2ee.server.home}/modules/javax.jms.jar:${j2ee.server.home}/modules/javax.resource.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.home}/modules/endorsed/javax.annotation.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.classpath=${j2ee.server.home}/modules/javax.jms.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl.jar:${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/javax.servlet-api.jar:${j2ee.server.home}/modules/javax.management.j2ee.jar:${j2ee.server.home}/modules/endorsed/javax.annotation.jar:${j2ee.server.middleware}/mq/lib/jaxm-api.jar:${j2ee.server.home}/modules/weld-osgi-bundle.jar:${j2ee.server.home}/modules/javax.servlet.jsp-api.jar:${j2ee.server.home}/modules/javax.enterprise.deploy.jar:${j2ee.server.home}/modules/javax.el-api.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/javax.persistence.jar:${j2ee.server.home}/modules/javax.servlet.jsp.jstl-api.jar:${j2ee.server.home}/modules/javax.faces.jar:${j2ee.server.home}/modules/javax.security.auth.message.jar:${j2ee.server.home}/modules/javax.resource.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/javax.ejb.jar:${j2ee.server.home}/modules/bean-validator.jar:${j2ee.server.home}/modules/javax.security.jacc.jar:${j2ee.server.home}/modules/javax.transaction.jar:${j2ee.server.home}/modules/javax.mail.jar:${j2ee.server.home}/modules/jersey-core.jar
j2ee.platform.embeddableejb.classpath=${j2ee.server.home}/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wscompile.classpath=${j2ee.server.home}/modules/webservices-osgi.jar
j2ee.platform.wsgen.classpath=${j2ee.server.home}/modules/webservices-osgi.jar:${j2ee.server.home}/modules/endorsed/webservices-api-osgi.jar:${j2ee.server.home}/modules/jaxb-osgi.jar:${j2ee.server.home}/modules/endorsed/jaxb-api-osgi.jar:${j2ee.server.home}/modules/javax.ejb.jar
Expand Down
2 changes: 1 addition & 1 deletion src/conf/persistence.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<persistence version="2.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
<persistence-unit name="SAECPU" transaction-type="RESOURCE_LOCAL">
<provider>org.hibernate.ejb.HibernatePersistence</provider>
<jta-data-source>dbexames</jta-data-source>
<jta-data-source>dbExames</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
Expand Down
20 changes: 20 additions & 0 deletions src/java/com/DAO/ExameDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,26 @@ public boolean cadastrar(Exame exame){
}
}

public boolean alterar(Exame exame){
EntityManager em = Conexao.getEntityManager();
EntityTransaction et = em.getTransaction();
try {
Exame exa = em.find(Exame.class, exame.getIdExame());
exa.setNome(exame.getNome());
exa.setValor(exame.getValor());

et.begin();
em.persist(exa);
et.commit();
return true;
} catch (Exception e) {
if (et.isActive()) {
et.rollback();
}
return false;
}
}

public boolean deletar(Exame exame){
EntityManager em = Conexao.getEntityManager();
EntityTransaction et = em.getTransaction();
Expand Down
20 changes: 20 additions & 0 deletions src/java/com/DAO/MedicoDAO.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,26 @@ public boolean cadastrar(Medico medico){
}
}

public boolean alterar(Medico medico){
EntityManager em = Conexao.getEntityManager();
EntityTransaction et = em.getTransaction();
try {
Medico med = em.find(Medico.class, medico.getIdMedico());
med.setNome(medico.getNome());
med.setCrm(medico.getCrm());

et.begin();
em.persist(med);
et.commit();
return true;
} catch (Exception e) {
if (et.isActive()) {
et.rollback();
}
return false;
}
}

public boolean deletar(Medico medico){
EntityManager em = Conexao.getEntityManager();
EntityTransaction et = em.getTransaction();
Expand Down
Loading

0 comments on commit d857588

Please sign in to comment.