Navegación implementada entre las páginas de listado, visualizacización
y edición de visitas.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package managedbean.visit;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Time;
|
||||
import java.util.Date;
|
||||
@@ -9,6 +10,7 @@ import javax.annotation.PostConstruct;
|
||||
import javax.enterprise.context.RequestScoped;
|
||||
import javax.faces.application.FacesMessage;
|
||||
import javax.faces.context.FacesContext;
|
||||
import javax.faces.view.ViewScoped;
|
||||
import javax.inject.Named;
|
||||
|
||||
import TO.FamilyDoctorTO;
|
||||
@@ -17,7 +19,7 @@ import TO.VisitTO;
|
||||
import managedbean.common.ManagedBeanBase;
|
||||
|
||||
@Named("VisitView")
|
||||
@RequestScoped
|
||||
@ViewScoped
|
||||
public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -29,6 +31,7 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
private String result;
|
||||
private PatientTO patient;
|
||||
private FamilyDoctorTO familyDoctor;
|
||||
private String fromPage;
|
||||
|
||||
public VisitMBean() {
|
||||
}
|
||||
@@ -43,15 +46,18 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
VisitTO vi = null;
|
||||
|
||||
try {
|
||||
// Parámetro con el "name" de la especialidad a editar.
|
||||
int id = Integer.valueOf(requestParams.get("id").toString());
|
||||
this.fromPage = requestParams.get("fromPage");
|
||||
|
||||
vi = this.getRemoteManagerVisit().getVisit(id);
|
||||
// Parámetro con el "id" de la visita.
|
||||
int parId = Integer.valueOf(requestParams.get("id"));
|
||||
|
||||
vi = this.getRemoteManagerVisit().getVisit(parId);
|
||||
} catch (Exception e) {
|
||||
this.manageException(e);
|
||||
}
|
||||
|
||||
if (vi != null) {
|
||||
this.id = vi.getId();
|
||||
this.date = vi.getDate();
|
||||
this.time = vi.getTime();
|
||||
this.observations = vi.getObservations();
|
||||
@@ -63,8 +69,9 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
}
|
||||
}
|
||||
|
||||
public void saveData() {
|
||||
|
||||
public void editVisit(Integer visitId) throws IOException {
|
||||
FacesContext ctx = FacesContext.getCurrentInstance();
|
||||
ctx.getExternalContext().redirect(String.format("UpdateVisit.xhtml?id=%d&fromPage=%s", visitId, this.fromPage));
|
||||
}
|
||||
|
||||
public Date getDate() {
|
||||
@@ -123,4 +130,12 @@ public class VisitMBean extends ManagedBeanBase implements Serializable {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFromPage() {
|
||||
return fromPage;
|
||||
}
|
||||
|
||||
public void setFromPage(String fromPage) {
|
||||
this.fromPage = fromPage;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user