private void comboBoxMomDelete_SelectionChanged(object sender, SelectionChangedEventArgs e) { var idCheck = Convert.ToInt64(comboBoxMomDelete.SelectedValue); comboBoxChild.ItemsSource = bl.getKids(a => a.idMom == idCheck); comboBoxChild.DisplayMemberPath = "fullName"; comboBoxChild.SelectedValuePath = "idChild"; comboBoxChild.SelectedIndex = -1; }
private void comboBoxChooseMom_SelectionChanged(object sender, SelectionChangedEventArgs e) { if (comboBoxChooseMom.SelectedIndex != -1) { try { comboBoxChooseChild.ItemsSource = bl.getKids(a => a.idMom == Convert.ToInt64(comboBoxChooseMom.SelectedValue)); comboBoxChooseChild.DisplayMemberPath = "fullName"; comboBoxChooseChild.SelectedValuePath = "idChild"; comboBoxChooseChild.SelectedIndex = -1; contract = new BE.Contract(); contract.workBegin = DateTime.Today; contract.workEnd = DateTime.Today; addContractTab.DataContext = contract; mom = (BE.Mother)comboBoxChooseMom.SelectedItem; new Thread(() => { try { copNanny = bl.getAllCompatibleNanny(mom).ToList(); Dispatcher.Invoke(new Action(() => { dataGridDetalis.ItemsSource = copNanny; dataGridDetalis.SelectedValuePath = "nannyId"; })); } catch (Exception n) { MessageBox.Show(n.Message); } }).Start(); } catch (Exception n) { MessageBox.Show(n.Message); } } }
private void buttonSearchChild_Click(object sender, RoutedEventArgs e) { try { if (checkBoxChildByMom.IsChecked == true) { childList = bl.getKids(a => a.idMom == (long)comboBoxChildByMom.SelectedValue); } else { childList = bl.getKids(); } if (checkBoxNotNanny.IsChecked == true) { childList = from a in childList let x = a.idChild from b in bl.getAllChildWithoutNanny() where x == b.idChild select a; } if (checkBoxWithSpaiclNeed.IsChecked == true) { childList = from a in childList let x = a.idChild from b in bl.getKids(b => b.isSpecialNeed == true) where x == b.idChild select a; } dataGridDetailsChild.ItemsSource = childList; } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }