P2 - Status Checkin (bug #5303)

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Web/trunk/ventaboletos@36192 d1611594-4594-4d17-8e1d-87c2c4800839
master
julio 2014-06-23 15:50:07 +00:00
parent 2111195ed2
commit 13f1e29ac3
1 changed files with 127 additions and 126 deletions

View File

@ -25,162 +25,163 @@ import org.zkoss.zul.Messagebox;
import org.zkoss.zul.Textbox; import org.zkoss.zul.Textbox;
/** /**
* *
* @author Rafius * @author Rafius
*/ */
@Controller("editarMotivoCancelacionController") @Controller("editarMotivoCancelacionController")
@Scope("prototype") @Scope("prototype")
public class EditarMotivoCancelacionController extends MyGenericForwardComposer { public class EditarMotivoCancelacionController extends MyGenericForwardComposer {
@Autowired private static final long serialVersionUID = 1L;
private MotivoCancelacionService motivoCancelacionService;
private MotivoCancelacion motivoCancelacion;
private MyListbox motivoCancelacionList;
private static Logger log = Logger.getLogger(EditarMotivoCancelacionController.class);
private Textbox txtNome;
private Button btnApagar;
private Button btnSalvar;
private Combobox cmbTipoMotivo;
public Button getBtnApagar() { @Autowired
return btnApagar; private MotivoCancelacionService motivoCancelacionService;
} private MotivoCancelacion motivoCancelacion;
private MyListbox motivoCancelacionList;
private static Logger log = Logger.getLogger(EditarMotivoCancelacionController.class);
private Textbox txtNome;
private Button btnApagar;
private Combobox cmbTipoMotivo;
public void setBtnApagar(Button btnApagar) { public Button getBtnApagar() {
this.btnApagar = btnApagar; return btnApagar;
} }
public Textbox getTxtNome() { public void setBtnApagar(Button btnApagar) {
return txtNome; this.btnApagar = btnApagar;
} }
public void setTxtNome(Textbox txtNome) { public Textbox getTxtNome() {
this.txtNome = txtNome; return txtNome;
} }
@Override public void setTxtNome(Textbox txtNome) {
public void doAfterCompose(Component comp) throws Exception { this.txtNome = txtNome;
super.doAfterCompose(comp); }
motivoCancelacion = (MotivoCancelacion) Executions.getCurrent().getArg().get("motivoCancelacion"); @Override
motivoCancelacionList = (MyListbox) Executions.getCurrent().getArg().get("motivoCancelacionList"); public void doAfterCompose(Component comp) throws Exception {
super.doAfterCompose(comp);
if (motivoCancelacion.getMotivocancelacionId() == null) { motivoCancelacion = (MotivoCancelacion) Executions.getCurrent().getArg().get("motivoCancelacion");
btnApagar.setVisible(Boolean.FALSE); motivoCancelacionList = (MyListbox) Executions.getCurrent().getArg().get("motivoCancelacionList");
} else {
if (motivoCancelacion.getMotivocancelacionId() <= 35) {
btnApagar.setVisible(false);
txtNome.setDisabled(true);
Messagebox.show( if (motivoCancelacion.getMotivocancelacionId() == null) {
Labels.getLabel("MSG.noEditabled"), btnApagar.setVisible(Boolean.FALSE);
Labels.getLabel("editarMotivoCancelacionController.window.title"), } else {
Messagebox.OK, Messagebox.INFORMATION); if (motivoCancelacionService.validaMotivoCancelacionConstante(motivoCancelacion)) {
} btnApagar.setVisible(false);
} txtNome.setDisabled(true);
txtNome.focus(); Messagebox.show(
} Labels.getLabel("MSG.noEditabled"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
}
}
public void onClick$btnSalvar(Event ev) throws InterruptedException { txtNome.focus();
txtNome.getValue(); }
cmbTipoMotivo.getValue();
try {
motivoCancelacion.setActivo(true);
motivoCancelacion.setFecmodif(Calendar.getInstance().getTime());
motivoCancelacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
if (motivoCancelacion.getTipomotivo() == null) {
Messagebox.show(
Labels.getLabel("editarMotivoCancelacionController.MSG.tipo"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);
} else {
if (motivoCancelacion.getMotivocancelacionId() == null) {
List<MotivoCancelacion> lsMotivoCancelacion =
motivoCancelacionService.buscar(motivoCancelacion.getDescmotivo(),
motivoCancelacion.getTipomotivo());
if (lsMotivoCancelacion.isEmpty()) { public void onClick$btnSalvar(Event ev) throws InterruptedException {
motivoCancelacionService.suscribir(motivoCancelacion); txtNome.getValue();
motivoCancelacionList.addItem(motivoCancelacion); cmbTipoMotivo.getValue();
try {
motivoCancelacion.setActivo(true);
motivoCancelacion.setFecmodif(Calendar.getInstance().getTime());
motivoCancelacion.setUsuarioId(UsuarioLogado.getUsuarioLogado().getUsuarioId());
if (motivoCancelacion.getTipomotivo() == null) {
Messagebox.show(
Labels.getLabel("editarMotivoCancelacionController.MSG.tipo"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);
} else {
if (motivoCancelacion.getMotivocancelacionId() == null) {
List<MotivoCancelacion> lsMotivoCancelacion =
motivoCancelacionService.buscar(motivoCancelacion.getDescmotivo(),
motivoCancelacion.getTipomotivo());
Messagebox.show( if (lsMotivoCancelacion.isEmpty()) {
Labels.getLabel("editarMotivoCancelacionController.MSG.suscribirOK"), motivoCancelacionService.suscribir(motivoCancelacion);
Labels.getLabel("editarMotivoCancelacionController.window.title"), motivoCancelacionList.addItem(motivoCancelacion);
Messagebox.OK, Messagebox.INFORMATION);
} else {
Messagebox.show(
Labels.getLabel("MSG.Registro.Existe"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);
}
} else {
motivoCancelacionService.actualizacion(motivoCancelacion);
motivoCancelacionList.updateItem(motivoCancelacion);
Messagebox.show( Messagebox.show(
Labels.getLabel("editarMotivoCancelacionController.MSG.suscribirOK"), Labels.getLabel("editarMotivoCancelacionController.MSG.suscribirOK"),
Labels.getLabel("editarMotivoCancelacionController.window.title"), Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.INFORMATION); Messagebox.OK, Messagebox.INFORMATION);
} } else {
Messagebox.show(
Labels.getLabel("MSG.Registro.Existe"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.EXCLAMATION);
}
} else {
motivoCancelacionService.actualizacion(motivoCancelacion);
motivoCancelacionList.updateItem(motivoCancelacion);
closeWindow(); Messagebox.show(
} Labels.getLabel("editarMotivoCancelacionController.MSG.suscribirOK"),
} catch (Exception ex) { Labels.getLabel("editarMotivoCancelacionController.window.title"),
log.error("editarMotivoCancelacionController: " + ex); Messagebox.OK, Messagebox.INFORMATION);
Messagebox.show( }
Labels.getLabel("MSG.Error"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.ERROR);
}
}
public void onClick$btnApagar(Event ev) { closeWindow();
try { }
int resp = Messagebox.show( } catch (Exception ex) {
Labels.getLabel("editarMotivoCancelacionController.MSG.borrarPergunta"), log.error("editarMotivoCancelacionController: " + ex);
Labels.getLabel("editarMotivoCancelacionController.window.title"), Messagebox.show(
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION); Labels.getLabel("MSG.Error"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.ERROR);
}
}
if (resp == Messagebox.YES) { public void onClick$btnApagar(Event ev) {
try {
int resp = Messagebox.show(
Labels.getLabel("editarMotivoCancelacionController.MSG.borrarPergunta"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.YES | Messagebox.NO, Messagebox.QUESTION);
motivoCancelacionService.borrar(motivoCancelacion); if (resp == Messagebox.YES) {
Messagebox.show( motivoCancelacionService.borrar(motivoCancelacion);
Labels.getLabel("editarMotivoCancelacionController.MSG.borrarOK"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
motivoCancelacionList.removeItem(motivoCancelacion); Messagebox.show(
Labels.getLabel("editarMotivoCancelacionController.MSG.borrarOK"),
Labels.getLabel("editarMotivoCancelacionController.window.title"),
Messagebox.OK, Messagebox.INFORMATION);
closeWindow(); motivoCancelacionList.removeItem(motivoCancelacion);
}
} catch (Exception ex) {
log.error(ex);
}
}
public MotivoCancelacion getMotivoCancelacion() { closeWindow();
return motivoCancelacion; }
} } catch (Exception ex) {
log.error(ex);
}
}
public void setMotivoCancelacion(MotivoCancelacion motivoCancelacion) { public MotivoCancelacion getMotivoCancelacion() {
this.motivoCancelacion = motivoCancelacion; return motivoCancelacion;
} }
public MyListbox getMotivoCancelacionList() { public void setMotivoCancelacion(MotivoCancelacion motivoCancelacion) {
return motivoCancelacionList; this.motivoCancelacion = motivoCancelacion;
} }
public void setMotivoCancelacionList(MyListbox motivoCancelacionList) { public MyListbox getMotivoCancelacionList() {
this.motivoCancelacionList = motivoCancelacionList; return motivoCancelacionList;
} }
public MotivoCancelacionService getMotivoCancelacionService() { public void setMotivoCancelacionList(MyListbox motivoCancelacionList) {
return motivoCancelacionService; this.motivoCancelacionList = motivoCancelacionList;
} }
public void setMotivoCancelacionService(MotivoCancelacionService motivoCancelacionService) { public MotivoCancelacionService getMotivoCancelacionService() {
this.motivoCancelacionService = motivoCancelacionService; return motivoCancelacionService;
} }
public void setMotivoCancelacionService(MotivoCancelacionService motivoCancelacionService) {
this.motivoCancelacionService = motivoCancelacionService;
}
} }