private void butDelete_Click(object sender, EventArgs e) { if (IsNew) { DialogResult = DialogResult.Cancel; } if (!Security.IsAuthorized(Permissions.EquipmentDelete, Equip.DateEntry)) { return; } if (!MsgBox.Show(this, true, "Delete?")) { return; } try{ Equipments.Delete(Equip); } catch (ApplicationException ex) { MessageBox.Show(ex.Message); return; } DialogResult = DialogResult.OK; }