public BusquedaFacturaRespuesta BuscarxNumero(string numero) { BusquedaFacturaRespuesta respuesta = new BusquedaFacturaRespuesta(); try { conexion.Open(); respuesta.Factura = repositorio.BuscarPorNumero(numero); conexion.Close(); respuesta.Mensaje = (respuesta.Factura != null) ? "Se encontró El Producto buscado" : "El producto buscado no existe"; respuesta.Error = false; return(respuesta); } catch (Exception e) { respuesta.Mensaje = $"Error de la Aplicacion: {e.Message}"; respuesta.Error = true; return(respuesta); } finally { conexion.Close(); } }
public void CosultaPorNumeroDeFactura() { BusquedaFacturaRespuesta respuesta = new BusquedaFacturaRespuesta(); string NFactura = txtFiltro.Text; if (NFactura != "") { respuesta = facturaService.BuscarxNumero(NFactura); if (respuesta.Factura != null) { MessageBox.Show("Factura Encontrada"); MostrarDetalles(respuesta.Factura); } else { MessageBox.Show("No Existe La Factura..."); } } else { MessageBox.Show("No se ha Ingresado Ningun Numero de Factura"); } }