Пример #1
0
 /// <summary>
 /// when item is selected, items information will
 /// be listed in textboxes allowing it to be updated or deleted.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void cmbJMember_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     m = (JuniorMember)cmbJMember.SelectedItem;
     txtJSHRNumber.Text   = m.SHRNumber.ToString();
     txtJName.Text        = m.Name.ToString();
     txtJYearOfBirth.Text = m.YearofBirth.ToString();
     txtJGender.Text      = m.Gender.ToString();
     txtJPhoneNumber.Text = m.PhoneNumber.ToString();
     txtJEmail.Text       = m.Email.ToString();
     txtJAddress.Text     = m.Address.ToString();
     txtJPostcode.Text    = m.Postcode.ToString();
     txtJDoctor.Text      = m.Doctor.ToString();
     txtJDoctorTel.Text   = m.DoctorTel.ToString();
     txtGuardian.Text     = m.Guardian.ToString();
     txtRelationship.Text = m.Relationship.ToString();
 }
Пример #2
0
        /// <summary>
        /// Messagebox prompts the user if they are sure they want to delete the member
        /// if they click ok the selected member from the combo box will be removed
        /// from the members list. A messagebox will display whether or not
        /// this has been successful
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnDelete_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                if (MessageBox.Show("do you wish to delete the selected member?", "Confirm Delete", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
                {
                    m = (JuniorMember)cmbJMember.SelectedItem;
                    db.deleteMember(m);
                    MessageBox.Show("Junior Member successfully deleted!");


                    this.Close();
                    Owner.Show();
                }
            }

            catch
            {
                MessageBox.Show("Member cannot be deleted!");
            }
        }