예제 #1
0
        private bool CustomValidation()
        {
            bool hasError = true;

            errorProvider.Clear();

            if (string.IsNullOrEmpty(textName.Text))
            {
                errorProvider.SetError(textName, Constants.Messages.RequireMessage);
                hasError = false;

                textName.Focus();
            }
            else
            {
                var biz    = new RoleBiz();
                var result = biz.SearchByName(textName.Text.Trim(), itemId);

                if (result)
                {
                    errorProvider.SetError(textName, Constants.Messages.CityExist);
                    hasError = false;

                    textName.Focus();
                }
            }

            return(hasError);
        }