//поиск по имени или референсу private void txtSearch_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (!string.IsNullOrEmpty(txtSearch.Text)) { var source = (IEnumerable <Component>)componentBindingSource.DataSource; SharedMethods.Search(componentBindingSource, source, (list) => (c) => { return(c.Name.ToUpper().Contains(txtSearch.Text.ToUpper()) || c.Reference.ToUpper().Contains(txtSearch.Text.ToUpper())); }); } else { componentBindingSource.DataSource = db.GetComponents(); } } }
//Поиск по наименованию заказчика или номеру заказа private void txtSearch_KeyDown(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { if (!string.IsNullOrEmpty(txtSearch.Text)) { var source = (IEnumerable <Order>)orderBindingSource.DataSource; SharedMethods.Search(orderBindingSource, source, (list) => (o) => { return(o.Customer.ToUpper().Contains(txtSearch.Text.ToUpper()) || o.Number.ToUpper().Contains(txtSearch.Text.ToUpper())); }); } else { ResetBindingSource(); } } }