private void butOK_Click(object sender, EventArgs e) { if (listRelationship.SelectedIndex < 0) { MsgBox.Show(this, "Relationship required."); return; } if (textName.Text.Trim() == "") { MsgBox.Show(this, "Name required."); return; } if (DisDefCur == null) { MsgBox.Show(this, "Problem required."); return; } FamilyHealthCur.DiseaseDefNum = DisDefCur.DiseaseDefNum; FamilyHealthCur.Relationship = (FamilyRelationship)listRelationship.SelectedIndex; FamilyHealthCur.PersonName = textName.Text; if (FamilyHealthCur.IsNew) { SecurityLogs.MakeLogEntry(Permissions.PatFamilyHealthEdit, FamilyHealthCur.PatNum, FamilyHealthCur.PersonName + " " + FamilyHealthCur.Relationship + " added"); FamilyHealths.Insert(FamilyHealthCur); } else { FamilyHealths.Update(FamilyHealthCur); SecurityLogs.MakeLogEntry(Permissions.PatFamilyHealthEdit, FamilyHealthCur.PatNum, FamilyHealthCur.PersonName + " " + FamilyHealthCur.Relationship + " edited"); } DialogResult = DialogResult.OK; }
private void butDelete_Click(object sender, EventArgs e) { if (FamilyHealthCur.IsNew) { DialogResult = DialogResult.Cancel; return; } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?")) { return; } FamilyHealths.Delete(FamilyHealthCur.FamilyHealthNum); SecurityLogs.MakeLogEntry(Permissions.PatFamilyHealthEdit, FamilyHealthCur.PatNum, FamilyHealthCur.PersonName + " " + FamilyHealthCur.Relationship + " deleted"); DialogResult = DialogResult.OK; }