Ejemplo n.º 1
0
        private static List <IValidationMessage> Required(FieldInfoInt aFieldInfo, IRuleDetail aRuleDetail)
        {
            var Messages = new List <IValidationMessage>();

            if (aFieldInfo.FieldValue == null)
            {
                Messages.Add(new ValidationMessage()
                {
                    ErrorMessage = aRuleDetail.Message.Replace("{FieldName}", aFieldInfo.FieldName),
                    FieldName    = aFieldInfo.FieldName
                });
            }
            ;

            return(Messages);
        }
Ejemplo n.º 2
0
        private static List <IValidationMessage> Equal(FieldInfoInt aFieldInfo, int equalValue, IRuleDetail aRuleDetail)
        {
            var Messages = new List <IValidationMessage>();

            if (aFieldInfo.FieldValue == null || aFieldInfo.FieldValue != equalValue)
            {
                Messages.Add(new ValidationMessage()
                {
                    ErrorMessage = aRuleDetail.Message.Replace("{FieldName}", aFieldInfo.FieldName)
                                   .Replace("{FieldCriteria}", equalValue.ToString())
                    ,
                    FieldName = aFieldInfo.FieldName
                });
            }

            return(Messages);
        }
Ejemplo n.º 3
0
        private static List <IValidationMessage> Range(FieldInfoInt aFieldInfo, int rangeFrom, int rangeTo, IRuleDetail aRuleDetail)
        {
            var Messages = new List <IValidationMessage>();



            if (aFieldInfo.FieldValue == null ||
                (aFieldInfo.FieldValue >= rangeFrom && aFieldInfo.FieldValue <= rangeTo) == false
                )
            {
                Messages.Add(new ValidationMessage()
                {
                    ErrorMessage = aRuleDetail.Message.Replace("{FieldName}", aFieldInfo.FieldName)
                                   .Replace("{RangeFrom}", rangeFrom.ToString())
                                   .Replace("{RangeTo}", rangeTo.ToString())
                    ,
                    FieldName = aFieldInfo.FieldName
                });
            }

            return(Messages);
        }