private void FindSurname_Click(object sender, RoutedEventArgs e) { try { string surname = this.txtbxSurname.Text; TitlePersonalEntities dataEntities = new TitlePersonalEntities(); Employee emp = new Employee(); ListEmployee.Clear(); emp.Surname = txtbxSurname.Text; var queryEmployee = from employee in dataEntities.Employees where employee.Surname == surname select employee; foreach (var item in queryEmployee.ToList()) { if (item.Surname.Contains(txtbxSurname.Text) == true) { ListEmployee.Add(item); } } DataGridEmployee.ItemsSource = ListEmployee; Search.IsEnabled = true; SearchBar.IsEnabled = true; } catch { } }
public PageEmployee() { TitlePersonalEntities dataEntities = new TitlePersonalEntities(); InitializeComponent(); Save.IsEnabled = false; //Edit.IsEnabled = true; Undo.IsEnabled = false; Search.IsEnabled = true; Add.IsEnabled = true; Delete.IsEnabled = true; SaveBar.IsEnabled = false; //EditBar.IsEnabled = true; UndoBar.IsEnabled = false; SearchBar.IsEnabled = true; AddBar.IsEnabled = true; DeleteBar.IsEnabled = true; }