private void FormLabCaseEdit_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { return; } if (IsNew) { if (sheet != null) { Sheets.DeleteObject(sheet.SheetNum); } LabCases.Delete(CaseCur.LabCaseNum); } }
private void butDelete_Click(object sender, System.EventArgs e) { //whether new or not if (!MsgBox.Show(this, true, "Delete Lab Case?")) { return; } try{ LabCases.Delete(CaseCur.LabCaseNum); DialogResult = DialogResult.OK; } catch (Exception ex) { MessageBox.Show(ex.Message); } }
private void FormLabCaseEdit_FormClosing(object sender, FormClosingEventArgs e) { if (DialogResult == DialogResult.OK) { return; } if (IsNew) { if (sheet == null) { LabCases.Delete(CaseCur.LabCaseNum); } else //user created and possibly printed a lab slip. We can't let them delete this lab case //lab cases are always created ahead of time, so no need to save here { } } }