private void button_Click(object sender, RoutedEventArgs e) { try { if (checkBoxBranchnumber.IsChecked == true) { List <BE.Branch> l = new List <BE.Branch>(); l.Add(bl.BranchByNumber(int.Parse(Branchnumber.Text))); dataGrid.ItemsSource = l; } else if (checkBoxBranchName.IsChecked == true) { //BE.Branch = Branchnumber.Text; bl.BranchByName(Branchname.Text); dataGrid.ItemsSource = bl.BranchByName(Branchname.Text); } else if (checkBoxBranchcity.IsChecked == true) { if ((BE.city)Branchcity.SelectedItem == BE.city.BeitShemesh) { dataGrid.ItemsSource = bl.branchUnderCondition(bl.ConBranchCityBeitShemesh); } else if ((BE.city)Branchcity.SelectedItem == BE.city.BneiBrak) { dataGrid.ItemsSource = bl.branchUnderCondition(bl.ConBranchCityBneiBrak); } else if ((BE.city)Branchcity.SelectedItem == BE.city.jerusalem) { dataGrid.ItemsSource = bl.branchUnderCondition(bl.ConBranchCityJerysalem); } else if ((BE.city)Branchcity.SelectedItem == BE.city.KiryatSefer) { dataGrid.ItemsSource = bl.branchUnderCondition(bl.ConBranchCityKiryatSefer); } else if ((BE.city)Branchcity.SelectedItem == BE.city.RamatGan) { dataGrid.ItemsSource = bl.branchUnderCondition(bl.ConBranchCityJRamatGan); } else if ((BE.city)Branchcity.SelectedItem == BE.city.TelAviv) { dataGrid.ItemsSource = bl.branchUnderCondition(bl.ConBranchCityTelAviv); } } else if (checkBoxBranchHechsher.IsChecked == true) { if ((BE.hechsher)hechshercombobox.SelectedItem == BE.hechsher.best) { dataGrid.ItemsSource = bl.branchUnderCondition(bl.ConBranchHechsherBest); } else if ((BE.hechsher)hechshercombobox.SelectedItem == BE.hechsher.medium) { dataGrid.ItemsSource = bl.branchUnderCondition(bl.ConBranchHechsherMedium); } if ((BE.hechsher)hechshercombobox.SelectedItem == BE.hechsher.regular) { dataGrid.ItemsSource = bl.branchUnderCondition(bl.ConBranchHechsherRegular); } } } catch (Exception msg) { MessageBox.Show(msg.Message); } }