예제 #1
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                mymother.Address = new BE.Address()
                {
                    City = this.cityTextBox.Text, Country = this.countryTextBox.Text, Number = Int32.Parse(this.numberTextBox.Text), Street = this.streetTextBox.Text, ZipCode = this.zipCodeTextBox.Text
                };
                mymother.BankDetails.BankAdress = new BE.Address()
                {
                    City = this.cityTextBox.Text, Country = this.countryTextBox.Text, Number = Int32.Parse(this.numberTextBox.Text), Street = this.streetTextBox.Text, ZipCode = this.zipCodeTextBox.Text
                };
                BL.FactoryBl.getBL().AddMother(mymother);
                MessageBox.Show(mymother.ToString());
                mymother     = new BE.Mother();
                DataContext  = mymother;
                DialogResult = true;
            }


            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
                //this.DialogResult = false;
            }
        }
예제 #2
0
 private void AddMotherButton_Click(object sender, RoutedEventArgs e)
 {
     BL.FactoryBL.getBL().AddMother(mother);
     MessageBox.Show(mother.ToString());
     mother      = new BE.Mother();
     DataContext = mother;
     this.Close();
 }
 /// <summary>
 /// show the details of the selected mother
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void moreDataGridButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (this.MotherDataGrid.SelectedItem is BE.Mother)
         {
             mother = (BE.Mother) this.MotherDataGrid.SelectedItem;
             MessageBox.Show(
                 mother.ToString(),
                 $"{mother.FirstName} {mother.LastName} Details");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
 private void AddMotherButton_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (mother.address.ToString() == "")
         {
             throw new Exception("please enter your address");
         }
         BL.FactoryBL.getBL().AddMother(mother);
         MessageBox.Show(mother.ToString());
         mother      = new BE.Mother();
         DataContext = mother;
         this.Close();
     }
     catch (FormatException)
     {
         MessageBox.Show("Incorrect input");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }