private bool IsValid() { bool result = true; #region Nature Code 唔可以吉 errorProvider.SetError(txtNatureCode, string.Empty); if (txtNatureCode.Text.Length == 0) { errorProvider.SetError(txtNatureCode, "Cannot be blank!"); return(false); } #endregion #region 新增,要 check Nature Code 係咪 in use errorProvider.SetError(txtNatureCode, string.Empty); if (_NatureId == System.Guid.Empty && ProductNatureEx.IsNatureCodeInUse(txtNatureCode.Text.Trim())) { errorProvider.SetError(txtNatureCode, "Nature Code in use"); return(false); } #endregion return(result); }