use of sic.modelo.Pais in project sic by belluccifranco.
the class ClientesGUI method buscar.
private void buscar() {
this.cambiarEstadoEnabled(false);
String criteria = "/clientes/busqueda/criteria?";
if (chk_RazonSocialNombreFantasia.isSelected()) {
criteria += "razonSocial=" + txt_RazonSocialNombreFantasia.getText().trim() + "&";
criteria += "nombreFantasia=" + txt_RazonSocialNombreFantasia.getText().trim() + "&";
}
if (chk_Id_Fiscal.isSelected()) {
criteria += "idFiscal=" + txt_Id_Fiscal.getText().trim() + "&";
}
if (chk_Ubicacion.isSelected()) {
if (!((Pais) cmb_Pais.getSelectedItem()).getNombre().equals("Todos")) {
criteria += "idPais=" + String.valueOf(((Pais) cmb_Pais.getSelectedItem()).getId_Pais()) + "&";
}
if (!((Provincia) (cmb_Provincia.getSelectedItem())).getNombre().equals("Todas")) {
criteria += "idProvincia=" + String.valueOf(((Provincia) (cmb_Provincia.getSelectedItem())).getId_Provincia()) + "&";
}
if (!((Localidad) cmb_Localidad.getSelectedItem()).getNombre().equals("Todas")) {
criteria += "idLocalidad=" + String.valueOf((((Localidad) cmb_Localidad.getSelectedItem()).getId_Localidad())) + "&";
}
}
criteria += "idEmpresa=" + String.valueOf(EmpresaActiva.getInstance().getEmpresa().getId_Empresa());
try {
clientes = new ArrayList(Arrays.asList(RestClient.getRestTemplate().getForObject(criteria, Cliente[].class)));
this.cambiarEstadoEnabled(true);
} catch (RestClientResponseException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
this.cambiarEstadoEnabled(true);
} catch (ResourceAccessException ex) {
LOGGER.error(ex.getMessage());
JOptionPane.showMessageDialog(this, ResourceBundle.getBundle("Mensajes").getString("mensaje_error_conexion"), "Error", JOptionPane.ERROR_MESSAGE);
this.cambiarEstadoEnabled(true);
}
this.cargarResultadosAlTable();
}
use of sic.modelo.Pais in project sic by belluccifranco.
the class ClientesGUI method cargarComboBoxProvinciasDelPais.
public void cargarComboBoxProvinciasDelPais(Pais paisSeleccionado) {
cmb_Provincia.removeAllItems();
try {
List<Provincia> provincias = new ArrayList(Arrays.asList(RestClient.getRestTemplate().getForObject("/provincias/paises/" + ((Pais) cmb_Pais.getSelectedItem()).getId_Pais(), Provincia[].class)));
Provincia provinciaTodas = new Provincia();
provinciaTodas.setNombre("Todas");
cmb_Provincia.addItem(provinciaTodas);
provincias.stream().forEach((p) -> {
cmb_Provincia.addItem(p);
});
} catch (RestClientResponseException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
} catch (ResourceAccessException ex) {
LOGGER.error(ex.getMessage());
JOptionPane.showMessageDialog(this, ResourceBundle.getBundle("Mensajes").getString("mensaje_error_conexion"), "Error", JOptionPane.ERROR_MESSAGE);
}
}
use of sic.modelo.Pais in project sic by belluccifranco.
the class TransportistasGUI method buscar.
private void buscar() {
this.cambiarEstadoEnabled(false);
String criteria = "/transportistas/busqueda/criteria?";
if (chk_Nombre.isSelected()) {
criteria += "nombre=" + txt_Nombre.getText().trim() + "&";
}
if (chk_Ubicacion.isSelected()) {
if (!((Pais) cmb_Pais.getSelectedItem()).getNombre().equals("Todos")) {
criteria += "idPais=" + String.valueOf(((Pais) cmb_Pais.getSelectedItem()).getId_Pais()) + "&";
}
if (!((Provincia) (cmb_Provincia.getSelectedItem())).getNombre().equals("Todas")) {
criteria += "idProvincia=" + String.valueOf(((Provincia) (cmb_Provincia.getSelectedItem())).getId_Provincia()) + "&";
}
if (!((Localidad) cmb_Localidad.getSelectedItem()).getNombre().equals("Todas")) {
criteria += "idLocalidad=" + String.valueOf((((Localidad) cmb_Localidad.getSelectedItem()).getId_Localidad())) + "&";
}
}
criteria += "idEmpresa=" + String.valueOf(EmpresaActiva.getInstance().getEmpresa().getId_Empresa());
try {
transportistas = new ArrayList(Arrays.asList(RestClient.getRestTemplate().getForObject(criteria, Transportista[].class)));
this.cargarResultadosAlTable();
} catch (RestClientResponseException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
this.cambiarEstadoEnabled(true);
} catch (ResourceAccessException ex) {
LOGGER.error(ex.getMessage());
JOptionPane.showMessageDialog(this, ResourceBundle.getBundle("Mensajes").getString("mensaje_error_conexion"), "Error", JOptionPane.ERROR_MESSAGE);
this.cambiarEstadoEnabled(true);
}
this.cambiarEstadoEnabled(true);
}
use of sic.modelo.Pais in project sic by belluccifranco.
the class TransportistasGUI method cargarComboBoxPaises.
private void cargarComboBoxPaises() {
cmb_Pais.removeAllItems();
try {
List<Pais> paises = new ArrayList(Arrays.asList(RestClient.getRestTemplate().getForObject("/paises", Pais[].class)));
Pais paisTodos = new Pais();
paisTodos.setNombre("Todos");
cmb_Pais.addItem(paisTodos);
paises.stream().forEach((pais) -> {
cmb_Pais.addItem(pais);
});
} catch (RestClientResponseException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
} catch (ResourceAccessException ex) {
LOGGER.error(ex.getMessage());
JOptionPane.showMessageDialog(this, ResourceBundle.getBundle("Mensajes").getString("mensaje_error_conexion"), "Error", JOptionPane.ERROR_MESSAGE);
}
}
use of sic.modelo.Pais in project sic by belluccifranco.
the class DetallePaisGUI method btn_ActualizarActionPerformed.
//GEN-LAST:event_lst_PaisesValueChanged
private void btn_ActualizarActionPerformed(java.awt.event.ActionEvent evt) {
//GEN-FIRST:event_btn_ActualizarActionPerformed
try {
if (paisSeleccionado == null) {
JOptionPane.showMessageDialog(this, "Seleccione un pais de la lista para poder continuar.", "Error", JOptionPane.ERROR_MESSAGE);
} else {
Pais paisModificado = new Pais();
paisModificado.setId_Pais(paisSeleccionado.getId_Pais());
paisModificado.setNombre(txt_ModicaElimina.getText().trim());
RestClient.getRestTemplate().put("/paises", paisModificado);
txt_ModicaElimina.setText("");
paisSeleccionado = null;
this.cargarPaises();
}
} catch (RestClientResponseException ex) {
JOptionPane.showMessageDialog(this, ex.getMessage(), "Error", JOptionPane.ERROR_MESSAGE);
} catch (ResourceAccessException ex) {
LOGGER.error(ex.getMessage());
JOptionPane.showMessageDialog(this, ResourceBundle.getBundle("Mensajes").getString("mensaje_error_conexion"), "Error", JOptionPane.ERROR_MESSAGE);
}
}
Aggregations