private void butDelete_Click(object sender, EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; return; } if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Delete?")) { return; } if (RefAttaches.IsReferralAttached(RefCur.ReferralNum)) { MsgBox.Show(this, "Cannot delete Referral because it is attached to patients"); return; } Referrals.Delete(RefCur); DialogResult = DialogResult.OK; }
private void butDelete_Click(object sender, System.EventArgs e) { if (tbRefSelect.SelectedRow == -1) { return; } Referral RefCur = (Referral)AList[tbRefSelect.SelectedRow]; if (RefAttaches.IsReferralAttached(RefCur.ReferralNum)) { MessageBox.Show(Lan.g(this, "Cannot delete Referral because it is attached to patients")); return; } if (!MsgBox.Show(this, true, "Delete Referral?")) { return; } Referrals.Delete(RefCur); tbRefSelect.SelectedRow = -1; FillTable(); }