private void butOK_Click(object sender, EventArgs e) { //PatNumChild already set //PatNumGuardian already set _guardianCur.IsGuardian = checkIsGuardian.Checked; string relatName = comboRelationship.Items[comboRelationship.SelectedIndex].ToString(); List <string> listRelationshipNamesRaw = new List <string>(Enum.GetNames(typeof(GuardianRelationship))); _guardianCur.Relationship = (GuardianRelationship)listRelationshipNamesRaw.IndexOf(relatName); if (_guardianCur.IsNew) { Guardians.Insert(_guardianCur); } else { Guardians.Update(_guardianCur); } DialogResult = DialogResult.OK; }
private void butOK_Click(object sender, EventArgs e) { if (GuardianCur.PatNumGuardian == 0) { MsgBox.Show(this, "Please set a guardian first."); return; } //PatNumChild already set //PatNumGuardian already set GuardianCur.Relationship = (GuardianRelationship)listRelationship.SelectedIndex; if (GuardianCur.IsNew) { Guardians.Insert(GuardianCur); } else { Guardians.Update(GuardianCur); } DialogResult = DialogResult.OK; }