// BUSCAR public async Task SearchTratamientoAsync(string campo) { List <TClientes> query; int inicio = (_num_pagina - 1) * _reg_por_pagina; if (campo.Equals("")) { query = await TClientes.ToListAsync(); } else { query = await TClientes.Where(c => c.CI.StartsWith(campo) || c.Nombre.StartsWith(campo) || c.Apellido.StartsWith(campo)).ToListAsync(); } _datagridView.DataSource = query.Skip(inicio).Take(_reg_por_pagina).ToList(); _datagridView.Columns[0].Visible = false; _datagridView.Columns[4].Visible = false; _datagridView.Columns[5].Visible = false; _datagridView.Columns[6].Visible = false; _datagridView.Columns[7].Visible = false; _datagridView.Columns[8].Visible = false; _datagridView.Columns[10].Visible = false; _datagridView.Columns[11].Visible = false; _datagridView.Columns[12].Visible = false;//OBSERVACIONES _datagridView.Columns[13].Visible = false; _datagridView.Columns[14].Visible = false; _datagridView.Columns[1].DefaultCellStyle.BackColor = Color.WhiteSmoke; _datagridView.Columns[2].DefaultCellStyle.BackColor = Color.WhiteSmoke; _datagridView.Columns[3].DefaultCellStyle.BackColor = Color.WhiteSmoke; _datagridView.Columns[9].DefaultCellStyle.BackColor = Color.WhiteSmoke; //_datagridView.Columns[12].DefaultCellStyle.BackColor = Color.WhiteSmoke; }
public async Task SearchClienteAsync(string campo) { List <TClientes> query; int inicio = (_num_pagina - 1) * _reg_por_pagina; if (campo.Equals("")) { query = await TClientes.ToListAsync(); } else { query = await TClientes.Where(c => c.Nid.StartsWith(campo) || c.Nombre.StartsWith(campo) || c.Apellido.StartsWith(campo)).ToListAsync(); } _dataGridView1.DataSource = query.Skip(inicio).Take(_reg_por_pagina).ToList(); _dataGridView1.Columns[0].Visible = false; _dataGridView1.Columns[7].Visible = false; _dataGridView1.Columns[8].Visible = false; _dataGridView1.Columns[1].DefaultCellStyle.BackColor = Color.WhiteSmoke; _dataGridView1.Columns[3].DefaultCellStyle.BackColor = Color.WhiteSmoke; _dataGridView1.Columns[5].DefaultCellStyle.BackColor = Color.WhiteSmoke; _dataGridView1.Columns[7].DefaultCellStyle.BackColor = Color.WhiteSmoke; }