private Boolean CheckDataCategoryToAdd() { Category dto = busCT.FindCategory(txtCategoryID.Text); if (dto != null) { error1.SetError(txtCategoryID, "ID is duplicate !"); txtCategoryID.Focus(); return(false); } else if (string.IsNullOrEmpty(txtCategoryID.Text)) { error1.SetError(txtCategoryID, "ID can't be blank !"); txtCategoryID.Focus(); return(false); } else if (txtCategoryID.Text.Length > 50) { error1.SetError(txtCategoryID, "ID max length is 50!"); txtCategoryID.Focus(); return(false); } else { error1.SetError(txtCategoryID, ""); } if (string.IsNullOrEmpty(txtCategoryName.Text)) { error1.SetError(txtCategoryName, "Name can't be blank !"); txtCategoryName.Focus(); return(false); } else if (txtCategoryName.Text.Length >= 50) { error1.SetError(txtCategoryName, "Name max length is 50!"); txtCategoryName.Focus(); return(false); } else { error1.SetError(txtCategoryName, ""); } return(true); }