/// <summary> /// receive data from window and enter to user interface /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void MotherEnter_Click(object sender, RoutedEventArgs e) { try { // if mother in list int id = Convert.ToInt32(idTextBox.Text); string name = nameTextBox.Text; if (!myBL.isMotherInList(id)) { throw new Exception("You are not in the system."); } Mother thisMother = myBL.getMotherByID(id); if (thisMother.firstName != name) { throw new Exception("You are not in the system."); } Window motherInfo = new MoterInterface(thisMother); Close(); motherInfo.ShowDialog(); } catch (Exception ex) { MessageBox.Show(ex.Message); } }
/// <summary> /// Enter a Nanny/Mother interface from the Admin window. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Interface_Click(object sender, RoutedEventArgs e) { try { if (Nannylist.IsChecked.Value) { if (dataGrid.SelectedItem != null) { Nanny selectedNanny = (Nanny)dataGrid.SelectedItem; Window nanny_interface = new NannyInterface(selectedNanny); nanny_interface.ShowDialog(); } else { MessageBox.Show("No nanny was selected!", "Error"); return; } } if (Motherlist.IsChecked.Value) { if (dataGrid.SelectedItem != null) { Mother selectedMother = (Mother)dataGrid.SelectedItem; Window mother_interface = new MoterInterface(selectedMother); mother_interface.ShowDialog(); } else { MessageBox.Show("No mother was selected!", "Error"); return; } } } catch { MessageBox.Show("No object was selected", "Error!"); } }