private void btnSave_Click(object sender, EventArgs e) { if (EmptyChecker.TryTextFieldsEmpty(Controls)) { MessageBox.Show("Please make sure you enter a value for all text fields", "Value empty error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } TextBoxParser.TextBoxChecker(Controls); if (institutionComboBox.Text == "") { MessageBox.Show("Please pick an institution before trying to save", "Institution empty error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!_memberRepo.AddMember(nameTextBox.Text, surnameTextBox.Text, dateOfBirthPicker.Value, isProfessorCheckBox.Checked, _institutionRepo.GetInstitutionByName(institutionComboBox.Text))) { MessageBox.Show("This person is already an member.", "Member exists error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } NewForm(); }
private void AddMember_Click(object sender, RoutedEventArgs e) { Member member = new Member(); member.Name = Name.Text; member.Phone = Phone.Text; int id = repo.AddMember(member); Refresh(); AllMembers(); }