private void BuscarProveedores(string tipo_busqueda, string texto_busqueda) { try { DataTable tableProveedores = NProveedores.BuscarProveedores(tipo_busqueda, texto_busqueda, out string rpta); if (tableProveedores != null) { this.dgvProveedores.Enabled = true; this.dgvProveedores.PageSize = 30; this.dgvProveedores.SetPagedDataSource(tableProveedores, this.bindingNavigator1); string[] columns_header = { "Id proveedor", "Fecha ingreso", "Nombre", "Teléfono", "Correo electrónico" }; bool[] columns_visible = { false, false, true, true, true }; this.dgvProveedores = DatagridString.ChangeHeaderTextAndVisibleCustomDataGrid(this.dgvProveedores, columns_header, columns_visible); this.lblResultados.Text = "Se encontraron " + tableProveedores.Rows.Count + " proveedores"; } else { if (!rpta.Equals("OK")) { throw new Exception(rpta); } this.dgvProveedores.clearDataSource(); this.dgvProveedores.Enabled = false; this.lblResultados.Text = "No se encontraron proveedores"; } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BuscarProveedores", "Hubo un error al buscar un proveedor", ex.Message); } }
private async Task BuscarProveedores(string tipo_busqueda, string texto_busqueda) { try { var(dtProveedores, rpta) = await NProveedores.BuscarProveedores(tipo_busqueda, texto_busqueda); this.panelProveedores.clearDataSource(); if (dtProveedores != null) { List <UserControl> controls = new List <UserControl>(); foreach (DataRow row in dtProveedores.Rows) { Proveedores proveedor = new Proveedores(row); ProveedorSmall proveedorSmall = new ProveedorSmall { Proveedor = proveedor, }; proveedorSmall.OnBtnNext += ProveedorSmall_OnBtnNext; controls.Add(proveedorSmall); } this.panelProveedores.AddArrayControl(controls); } else { if (!rpta.Equals("OK")) { throw new Exception(rpta); } } } catch (Exception ex) { Mensajes.MensajeErrorCompleto(this.Name, "BuscarProveedores(string tipo_busqueda, string texto_busqueda)", "Hubo un error al buscar los proveedores", ex.Message); } }