示例#1
0
        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Name == nameof(ExecutionStart) || pi.Name == nameof(ExecutionEnd))
            {
                if (this.ExecutionEnd < this.ExecutionStart)
                {
                    return(ProcessMessage.ProcessStartIsGreaterThanProcessEnd.NiceToString());
                }

                if (this.ExecutionStart == null && this.ExecutionEnd != null)
                {
                    return(ProcessMessage.ProcessStartIsNullButProcessEndIsNot.NiceToString());
                }
            }

            return(stateValidator.Validate(this, pi) ?? base.PropertyValidation(pi));
        }
示例#2
0
        protected override string?PropertyValidation(PropertyInfo pi)
        {
            if (this.Type == ToolbarElementType.Item || this.Type == ToolbarElementType.Header)
            {
                if (pi.Name == nameof(this.Label))
                {
                    if (string.IsNullOrEmpty(this.Label) && this.Content == null)
                    {
                        return(ValidationMessage._0IsMandatoryWhen1IsNotSet.NiceToString(pi.NiceName(), ReflectionTools.GetPropertyInfo(() => Content).NiceName()));
                    }
                }

                if (pi.Name == nameof(this.Url))
                {
                    if (string.IsNullOrEmpty(this.Url) && this.Content == null && this.Type == ToolbarElementType.Item)
                    {
                        return(ValidationMessage._0IsMandatoryWhen1IsNotSet.NiceToString(pi.NiceName(), ReflectionTools.GetPropertyInfo(() => Content).NiceName()));
                    }
                }
            }

            return(stateValidator.Validate(this, pi) ?? base.PropertyValidation(pi));
        }
示例#3
0
        protected override string PropertyValidation(PropertyInfo pi)
        {
            if (pi.Name == nameof(this.Content) && this.Content != null)
            {
                if (this.Type == ToolbarElementType.Link)
                {
                    if (this.Content.EntityType == typeof(ToolbarMenuEntity))
                    {
                        return(ValidationMessage._0ShouldNotBeOfType1.NiceToString(pi.NiceName(), typeof(ToolbarMenuEntity)));
                    }

                    if (this.Content == null && string.IsNullOrEmpty(this.Url))
                    {
                        return(ValidationMessage._0IsMandatoryWhen1IsNotSet.NiceToString(pi.NiceName(), ReflectionTools.GetPropertyInfo(() => Url).NiceName()));
                    }
                }


                if (Type == ToolbarElementType.Menu)
                {
                    if (this.Content.EntityType != typeof(ToolbarMenuEntity))
                    {
                        return(ValidationMessage._0ShouldBeOfType1.NiceToString(pi.NiceName(), typeof(ToolbarMenuEntity)));
                    }
                }
            }

            if (pi.Name == nameof(this.Label) && (this.Type == ToolbarElementType.Menu || this.Type == ToolbarElementType.Link))
            {
                if (string.IsNullOrEmpty(this.Label) && this.Content == null)
                {
                    return(ValidationMessage._0IsMandatoryWhen1IsNotSet.NiceToString(pi.NiceName(), ReflectionTools.GetPropertyInfo(() => Content).NiceName()));
                }
            }

            return(stateValidator.Validate(this, pi) ?? base.PropertyValidation(pi));
        }
示例#4
0
 protected override string?PropertyValidation(PropertyInfo pi)
 {
     return(stateValidator.Validate(this, pi) ?? base.PropertyValidation(pi));
 }
示例#5
0
 protected override string?PropertyValidation(PropertyInfo pi)
 {
     return(validator.Validate(this, pi));
 }