示例#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 cmbSMember_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     m = (SeniorMember)cmbSMember.SelectedItem;
     txtSSHRNumber.Text   = m.SHRNumber.ToString();
     txtSName.Text        = m.Name.ToString();
     txtSYearOfBirth.Text = m.YearofBirth.ToString();
     txtSGender.Text      = m.Gender.ToString();
     txtSPhoneNumber.Text = m.PhoneNumber.ToString();
     txtSEmail.Text       = m.Email.ToString();
     txtSAddress.Text     = m.Address.ToString();
     txtSPostcode.Text    = m.Postcode.ToString();
     txtSDoctor.Text      = m.Doctor.ToString();
     txtSDoctorTel.Text   = m.DoctorTel.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 = (SeniorMember)cmbSMember.SelectedItem;
                    db.deleteMember(m);
                    MessageBox.Show("Senior Member successfully deleted!");


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

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