private void btnSubmit_Click(object sender, EventArgs e) { bool result = false; AuthorDTO auth = new AuthorDTO { AuthorID = txtAuthorID.Text, AuthorName = txtAuthorName.Text }; if (auth.AuthorID == String.Empty) { MessageBox.Show(this, "The New Author is added fail. AuthorID can't empty!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (AddOrEdit == 0) { result = bus.AddNewAuthor(auth); if (result) { MessageBox.Show(this, "The New Author is added successful", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); dr = DialogResult.OK; this.Close(); } else { MessageBox.Show(this, "The New Author is added fail. AuthorID is existed!!!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { result = bus.UpdateAuthor(auth); if (result) { MessageBox.Show(this, "The Author is updated successful.", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information); dr = DialogResult.OK; this.Close(); } else { MessageBox.Show(this, "The Author is updated fail. Please try again later.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }