private void buttonAddContract_Click(object sender, RoutedEventArgs e) { try { contract.nameChild = (bl.getChild(contract.idChild)).fullName; contract.nameNanny = nanny.fullName; contract.isContract = true; if (contract.isHour) { contract.salaryAgreed = contract.salaryPerHour; } else { contract.salaryAgreed = contract.salaryPerMonth; } bl.addContract(contract); MessageBox.Show("חוזה נחתם בהצלחה"); dataGridDetalis.ItemsSource = null; comboBoxChooseChild.SelectedIndex = -1; comboBoxChooseMom.SelectedIndex = -1; contract = new BE.Contract(); addContractTab.DataContext = contract; } catch (Exception Ex) { MessageBox.Show(Ex.Message); } }