private bool ValidData(bool isInsert) { if (string.IsNullOrWhiteSpace(txtName.Text)) { MessageBox.Show("Category name must be required!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtName.Focus(); return(false); } if (isInsert) { if (categoryBUS.IsExistsCategory(txtName.Text)) { MessageBox.Show("Category name was exists!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Warning); txtName.Focus(); return(false); } } return(true); }