// Metodo para guardar la informacion // public void guardarDatos() throws Exception { try { // log.info("ejecutando metodo guardarDatos()"); if (validarForm()) { FormularioUtil.setUpperCase(groupboxEditar); // Cargamos los componentes // Maestro_manual maestro_manual = new Maestro_manual(); maestro_manual.setId_manual( (lgxId_manual.getValue() != null ? lgxId_manual.getValue() : 0L)); maestro_manual.setCodigo_empresa(codigo_empresa); maestro_manual.setCodigo_sucursal(codigo_sucursal); maestro_manual.setManual(tbxManual.getValue()); maestro_manual.setTipo_manual(lbxTipo_manual.getSelectedItem().getValue().toString()); maestro_manual.setTipo_moneda(lbxTipo_moneda.getSelectedItem().getValue().toString()); maestro_manual.setCreacion_date(new Timestamp(new GregorianCalendar().getTimeInMillis())); maestro_manual.setCreacion_user(usuarios.getCodigo().toString()); Map<String, Object> mapa_datos = new HashMap<String, Object>(); mapa_datos.put("maestro_manual", maestro_manual); mapa_datos.put("accion", tbxAccion.getValue()); mapa_datos.put("mapa_datos_procedimientos", mapa_datos_procedimientos); maestro_manualService.guardarDatos(mapa_datos); tbxAccion.setValue("modificar"); mostrarDatos(maestro_manual); MensajesUtil.mensajeInformacion( "Informacion ..", "Los datos se guardaron satisfactoriamente"); } } catch (Exception e) { MensajesUtil.mensajeError(e, "", this); } }
// Metodo para buscar // public void buscarDatos() throws Exception { try { Map<String, Object> parameters = new HashMap<String, Object>(); String value = tbxValue.getValue().trim().toUpperCase(); parameters.put("codigo_empresa", codigo_empresa); parameters.put("codigo_sucursal", codigo_sucursal); String parameter = lbxParameter.getSelectedItem().getValue().toString(); parameters.put("parameter", parameter); parameters.put("value", "%" + value + "%"); parameters.put("limite_paginado", "limit 25 offset 0"); List<Maestro_manual> lista_datos = maestro_manualService.listar(parameters); listboxResultado.getItems().clear(); divPopups.getChildren().clear(); for (Maestro_manual maestro_manual : lista_datos) { listboxResultado.appendChild(crearFilas(maestro_manual, this)); } listboxResultado.applyProperties(); listboxResultado.invalidate(); } catch (Exception e) { MensajesUtil.mensajeError(e, "", this); } }
public void eliminarDatos(Object obj) throws Exception { Maestro_manual maestro_manual = (Maestro_manual) obj; try { int result = maestro_manualService.eliminar(maestro_manual); if (result == 0) { throw new Exception( "Lo sentimos pero los datos a eliminar no se encuentran en base de datos"); } Messagebox.show( "Informacion se elimino satisfactoriamente !!", "Information", Messagebox.OK, Messagebox.INFORMATION); } catch (HealthmanagerException e) { MensajesUtil.mensajeError( e, "Este objeto no se puede eliminar por que esta relacionado con otra tabla en la base de datos", this); } catch (RuntimeException r) { MensajesUtil.mensajeError(r, "", this); } }