private void butOK_Click(object sender, EventArgs e) { if (!Security.IsAuthorized(Permissions.SecurityAdmin)) { return; } if (textDate.errorProvider1.GetError(textDate) != "") { MsgBox.Show(this, "Invalid date"); return; } DateTime date = PIn.Date(textDate.Text); if (date < DateTime.Today.AddDays(-7)) { if (!MsgBox.Show(this, MsgBoxButtons.OKCancel, "Date is from more than one week ago. Continue anyway?")) { return; } } if (MessageBox.Show("Delete all " + labelCount.Text + " commlog entries?", "", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } Commlogs.RecallUndo(date); SecurityLogs.MakeLogEntry(Permissions.CommlogEdit, 0, "Recall list undo tool ran"); MsgBox.Show(this, "Done"); DialogResult = DialogResult.OK; }