Ejemplo n.º 1
0
        /// <summary>
        /// Event: when clicking on the button - enter to user interface.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MotherEnter_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                // if Nanny in list
                int    id   = Convert.ToInt32(idTextBox.Text);
                string name = nameTextBox.Text;
                if (!myBL.isNannyInList(id))
                {
                    throw new Exception("You are not in the system.");
                }

                Nanny thisNanny = myBL.GetNannyByID(id);

                if (thisNanny.firstName != name)
                {
                    throw new Exception("You are not in the system.");
                }
                Window nannyInfo = new NannyInterface(thisNanny);
                Close();
                nannyInfo.ShowDialog();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 2
0
 /// <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!");
     }
 }