Esempio n. 1
0
 internal BrokenRule(string source, BrokenRule rule)
 {
     _ruleName    = string.Format("rule://{0}.{1}", source, rule.RuleName.Replace("rule://", string.Empty));
     _description = rule.Description;
     _property    = rule.Property;
     _severity    = rule.Severity;
 }
Esempio n. 2
0
 /// <summary>
 ///     Validation d'une chaîne de caractère sous forme de code postal Canadien .
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleAlphanumericCharacters(string codeMessage, string description, RuleSeverity severite,
                                   bool allowNull)
     : base(
         codeMessage, description, severite, RuleType.AlphanumericCharacters, RegexValidation, null, null,
         allowNull)
 {
 }
Esempio n. 3
0
 public BrokenRule(RuleSeverity severity, string description, string technical, string key)
 {
     Severity    = severity;
     Description = description;
     Technical   = technical;
     Key         = key;
 }
Esempio n. 4
0
 /// <summary>
 ///     Validation d'une chaîne de caractère à l'aide d'une expression régulière.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="regularExpression"> Expression régulière. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleRegularExpression(string codeMessage, string description, RuleSeverity severite,
                              string regularExpression, bool allowNull)
     : base(
         codeMessage, description, severite, RuleType.RegularExpression, regularExpression, null, null,
         allowNull)
 {
 }
Esempio n. 5
0
 /// <summary>
 ///     Validation d'un numéro de téléphone du Canada.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RulePhoneNumberWithExtention(string codeMessage, string description, RuleSeverity severite,
                                     bool allowNull)
     : base(
         codeMessage, description, severite, RuleType.RulePhoneNumberWithExtention, RegexValidation, null, null,
         allowNull)
 {
 }
Esempio n. 6
0
 internal BrokenRule(IRuleMethod rule)
 {
     _ruleName    = rule.RuleName;
     _description = rule.RuleArgs.Description;
     _property    = rule.RuleArgs.PropertyName;
     _severity    = rule.RuleArgs.Severity;
 }
Esempio n. 7
0
 /// <summary>
 ///     Validation d'une date devant être inférieure ou égale à celle passée en paramètre.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="comparisonDate"> Date avec laquelle on effectue la comparaison. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleDateLessOrEqualThan(string codeMessage, string description, RuleSeverity severite,
                                DateTime comparisonDate, bool allowNull)
     : base(
         codeMessage, description, severite, RuleType.DateLessOrEqualThan, comparisonDate, null, null,
         allowNull)
 {
 }
Esempio n. 8
0
 internal BrokenRule(IRuleMethod rule)
 {
   _ruleName = rule.RuleName;
   _description = rule.RuleArgs.Description;
   _property = rule.RuleArgs.PropertyName;
   _severity = rule.RuleArgs.Severity;
 }
        private IEnumerable <string> GetBrokenRuleMessages(RuleSeverity severity)
        {
            IList <string> messages = new List <string>();
            ICheckRules    objectUnderTest;

            // Attempt to gain access to the underlying CSLA object
            objectUnderTest = _fieldIdentifier.Model as ICheckRules;
            if (objectUnderTest == null)
            {
                throw new ArgumentException(nameof(_fieldIdentifier.Model));
            }

            // Iterate through the broken rules to find the subset we want
            foreach (BrokenRule rule in objectUnderTest.GetBrokenRules())
            {
                // Exclude any broken rules that are not for the property we are interested in
                if (rule.Property.Equals(_fieldIdentifier.FieldName, StringComparison.InvariantCultureIgnoreCase))
                {
                    // Exclude any of a severity other than that we want
                    if (rule.Severity == severity)
                    {
                        // Rule meets our criteria, so add its text to the list we are to return
                        messages.Add(rule.Description);
                    }
                }
            }

            // Return the list of messages that matched the criteria
            return(messages);
        }
Esempio n. 10
0
        public void AddBrokenRule(RuleSeverity severity, string description, string technical, string key)
        {
            BrokenRule _BrokenRule = new BrokenRule(severity, description, technical, key);

            _BrokenRules.Add(_BrokenRule);

            switch (severity)
            {
            case RuleSeverity.Error:
                _ErrorCount = _ErrorCount + 1;
                break;

            case RuleSeverity.Warning:
                _WarningCount = _WarningCount + 1;
                break;

            case RuleSeverity.Information:
                _InfoCount = _InfoCount + 1;
                break;

            case RuleSeverity.Success:
                _SuccessCount = _SuccessCount + 1;
                break;

            default:
                break;
            }
        }
Esempio n. 11
0
        public void Clear(RuleSeverity ruleSeverity)
        {
            switch (ruleSeverity)
            {
            case RuleSeverity.Error:
                _BrokenRules.RemoveAll(rule => rule.Severity == RuleSeverity.Error);
                _ErrorCount = 0;
                break;

            case RuleSeverity.Warning:
                _BrokenRules.RemoveAll(rule => rule.Severity == RuleSeverity.Warning);
                _WarningCount = 0;
                break;

            case RuleSeverity.Information:
                _BrokenRules.RemoveAll(rule => rule.Severity == RuleSeverity.Information);
                _InfoCount = 0;
                break;

            case RuleSeverity.Success:
                _BrokenRules.RemoveAll(rule => rule.Severity == RuleSeverity.Success);
                _SuccessCount = 0;
                break;

            default:
                break;
            }
        }
Esempio n. 12
0
 public Rule(string id, SyntaxQuery query, RuleSeverity severity, string message)
 {
     Id       = id;
     Query    = query;
     Severity = severity;
     Message  = message;
 }
Esempio n. 13
0
 internal BrokenRule(IAsyncRuleMethod asyncRule, AsyncRuleResult result)
 {
     _ruleName    = asyncRule.RuleName;
     _description = result.Description;
     _severity    = result.Severity;
     _property    = asyncRule.AsyncRuleArgs.Properties[0].Name;
 }
Esempio n. 14
0
 /// <summary>
 /// Returns the matches found with the specified rule severity.
 /// </summary>
 /// <param name="severity">Defines a rules severity.</param>
 /// <returns></returns>
 public List <IMatch> MatchesBySeverity(RuleSeverity severity)
 {
     lock (_lockInternalMatches)
     {
         return((from match in InternalMatches where match.Severity == severity select match.Clone() as IMatch).ToList());
     }
 }
Esempio n. 15
0
        private void UpdateState()
        {
            Popup popup = (Popup)FindName("popup");

            if (popup != null)
            {
                popup.IsOpen = false;
            }

            BusinessBase businessObject = Source as BusinessBase;

            if (businessObject != null)
            {
                // for some reason Linq does not work against BrokenRulesCollection...
                List <BrokenRule> allRules = new List <BrokenRule>();
                foreach (var r in businessObject.BrokenRulesCollection)
                {
                    if (r.Property == Property)
                    {
                        allRules.Add(r);
                    }
                }

                var removeRules = (from r in BrokenRules
                                   where !allRules.Contains(r)
                                   select r).ToArray();

                var addRules = (from r in allRules
                                where !BrokenRules.Contains(r)
                                select r).ToArray();

                foreach (var rule in removeRules)
                {
                    BrokenRules.Remove(rule);
                }
                foreach (var rule in addRules)
                {
                    BrokenRules.Add(rule);
                }

                BrokenRule worst = (from r in BrokenRules
                                    orderby r.Severity
                                    select r).FirstOrDefault();

                if (worst != null)
                {
                    _worst = worst.Severity;
                }

                _isValid = BrokenRules.Count == 0;
                GoToState(true);
            }
            else
            {
                BrokenRules.Clear();
                _isValid = true;
                GoToState(true);
            }
        }
        public void AddRule(AsyncRuleHandler handler, RuleSeverity severity, AsyncRuleArgs args)
        {
            // get the list of rules for the primary property
            List <IRuleMethod> list = GetRulesForProperty(args.Properties[0].Name, true).GetList(false);

            // we have the list, add our new rule
            list.Add(new AsyncRuleMethod(handler, args, severity));
        }
Esempio n. 17
0
 internal ExtendedBrokenRule(BrokenRule rule, object link)
 {
     _ruleName    = rule.RuleName;
     _description = rule.Description;
     _property    = rule.Property;
     _severity    = rule.Severity;
     _link        = link;
 }
Esempio n. 18
0
 /// <summary>
 /// Constructor for a RuleInfo.
 /// </summary>
 /// <param name="name">Name of the rule.</param>
 /// <param name="commonName">Common Name of the rule.</param>
 /// <param name="description">Description of the rule.</param>
 /// <param name="sourceType">Source type of the rule.</param>
 /// <param name="sourceName">Source name of the rule.</param>
 public RuleInfo(string name, string commonName, string description, SourceType sourceType, string sourceName, RuleSeverity severity)
 {
     RuleName        = name;
     CommonName  = commonName;
     Description = description;
     SourceType  = sourceType;
     SourceName  = sourceName;
     Severity = severity;
 }
Esempio n. 19
0
 /// <summary>
 /// Constructor for a RuleInfo.
 /// </summary>
 /// <param name="name">Name of the rule.</param>
 /// <param name="commonName">Common Name of the rule.</param>
 /// <param name="description">Description of the rule.</param>
 /// <param name="sourceType">Source type of the rule.</param>
 /// <param name="sourceName">Source name of the rule.</param>
 public RuleInfo(string name, string commonName, string description, SourceType sourceType, string sourceName, RuleSeverity severity)
 {
     RuleName    = name;
     CommonName  = commonName;
     Description = description;
     SourceType  = sourceType;
     SourceName  = sourceName;
     Severity    = severity;
 }
            public CommentRegularExpressionRule(string diagnosticId, string regularExpression, string message)
            {
                DiagnosticId      = diagnosticId;
                RegularExpression = regularExpression;
                Message           = message;

                descriptor = new DiagnosticDescriptor(DiagnosticId, Title, Message, Category,
                                                      RuleSeverity.ToDiagnosticSeverity(), IsActivatedByDefault);
            }
Esempio n. 21
0
 public Rule(string id, string title, string message, RuleSeverity severity, string description, string helpLinkUri)
 {
     Id          = id;
     Title       = title;
     Message     = message;
     Severity    = severity;
     Description = description;
     HelpLinkUri = helpLinkUri;
 }
Esempio n. 22
0
        /// <summary>
        /// Override this method to retrieve your field values
        /// from the MobileFormatter serialzation stream.
        /// </summary>
        /// <param name="info">
        /// Object containing the data to serialize.
        /// </param>
        /// <param name="mode">
        /// The StateMode indicating why this method was invoked.
        /// </param>
        protected override void OnSetState(SerializationInfo info, StateMode mode)
        {
            _ruleName    = info.GetValue <string>("_ruleName");
            _description = info.GetValue <string>("_description");
            _property    = info.GetValue <string>("_property");
            _severity    = info.GetValue <RuleSeverity>("_severity");

            base.OnSetState(info, mode);
        }
Esempio n. 23
0
 /// <summary>
 /// Copy constructor
 /// </summary>
 protected BrokenRule(BrokenRule copy)
 {
     Check.Require(() => Demand.The.Param(() => copy).IsNotNull());
     _message      = copy._message;
     _propertyName = copy._propertyName;
     _severity     = copy._severity;
     Source        = copy.Source;
     ValidatorInfo = copy.ValidatorInfo;
 }
Esempio n. 24
0
 /// <summary>
 /// Creates and initializes the rule.
 /// </summary>
 /// <param name="handler">The address of the method implementing the rule.</param>
 /// <param name="args">A RuleArgs object.</param>
 /// <param name="severity">Severity of the rule.</param>
 public AsyncRuleMethod(AsyncRuleHandler handler, AsyncRuleArgs args, RuleSeverity severity)
 {
     _handler  = handler;
     _args     = args;
     _severity = severity;
     _ruleName = string.Format(@"rule://{0}/{1}/{2}",
                               Uri.EscapeDataString(_handler.Method.DeclaringType.FullName),
                               _handler.Method.Name,
                               _args.Properties[0].Name);
 }
 /// <summary>
 /// Returns the first <see cref="BrokenRule"/> object
 /// corresponding to the specified property
 /// and severity.
 /// </summary>
 /// <param name="property">The name of the property affected by the rule.</param>
 /// <param name="severity">The severity of broken rule to return.</param>
 /// <returns>
 /// The first BrokenRule object corresponding to the specified property, or Nothing
 /// (null in C#) if there are no rules defined for the property.
 /// </returns>
 public BrokenRule GetFirstMessage(string property, RuleSeverity severity)
 {
     foreach (BrokenRule item in this)
     {
         if (item.Property == property && item.Severity == severity)
         {
             return(item);
         }
     }
     return(null);
 }
        private static __VSERRORCATEGORY GetErrorCategory(bool isFatal, RuleSeverity severity)
        {
            if (isFatal)
            {
                return(__VSERRORCATEGORY.EC_ERROR);
            }

            return(RuleSeverity.Error == severity
                ? __VSERRORCATEGORY.EC_ERROR
                : __VSERRORCATEGORY.EC_WARNING);
        }
Esempio n. 27
0
        /// <summary>
        /// Converts broken rule severities into an
        /// appropriate image for display.
        /// </summary>
        /// <param name="value">Severity value</param>
        /// <param name="targetType">Target type</param>
        /// <param name="parameter">Parameter</param>
        /// <param name="culture">Culture</param>
        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            RuleSeverity       severity = (RuleSeverity)value;
            string             uri      = string.Format("/Csla;component/Resources/{0}.png", severity);
            StreamResourceInfo sr       = Application.GetResourceStream(new Uri(uri, UriKind.Relative));
            BitmapImage        bmp      = new BitmapImage();

            bmp.SetSource(sr.Stream);

            return(bmp);
        }
Esempio n. 28
0
 public static CounterIds Severity2CounterId(RuleSeverity severity)
 {
     switch (severity)
       {
     case RuleSeverity.Info:     return CounterIds.InfoMatches;
     case RuleSeverity.Warning:  return CounterIds.WarningMatches;
     case RuleSeverity.Critical: return CounterIds.CriticalMatches;
     case RuleSeverity.Fatal:    return CounterIds.FatalMatches;
     default:
       throw new ArgumentException("severity");
       }
 }
Esempio n. 29
0
 public static string GetSeverityString(RuleSeverity severity)
 {
     if (severity == RuleSeverity.High)
     {
         return("High");
     }
     else if (severity == RuleSeverity.Low)
     {
         return("Low");
     }
     return("N/A");
 }
Esempio n. 30
0
 /// <summary>
 ///     Constructeur d'une règle de validation
 /// </summary>
 /// <param name="codeMessage"> Identifiant de la règle ou code de règle </param>
 /// <param name="description"> Informations de la règle </param>
 /// <param name="severite"> Identification de la sévérité </param>
 /// <param name="ruleType"> Type de règle de validation. </param>
 /// <param name="parameter"> Paramètre utilisé pour la règle de validation. </param>
 /// <param name="objectType"> Type d'objet à valider. </param>
 /// <param name="validationObject"> Type de la classe de validation qui validera l'objet. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 protected Rule(string codeMessage, string description, RuleSeverity severite, RuleType ruleType,
     object parameter, Type objectType, Type validationObject, bool allowNull)
 {
     CodeMessage = codeMessage;
     Description = description;
     Severity = severite;
     Type = ruleType;
     Parameter = parameter;
     AllowNull = allowNull;
     ValidationObject = validationObject;
     ObjectType = objectType;
 }
Esempio n. 31
0
 /// <summary>
 ///     Constructeur d'une règle de validation
 /// </summary>
 /// <param name="codeMessage"> Identifiant de la règle ou code de règle </param>
 /// <param name="description"> Informations de la règle </param>
 /// <param name="severite"> Identification de la sévérité </param>
 /// <param name="ruleType"> Type de règle de validation. </param>
 /// <param name="parameter"> Paramètre utilisé pour la règle de validation. </param>
 /// <param name="objectType"> Type d'objet à valider. </param>
 /// <param name="validationObject"> Type de la classe de validation qui validera l'objet. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 protected Rule(string codeMessage, string description, RuleSeverity severite, RuleType ruleType,
                object parameter, Type objectType, Type validationObject, bool allowNull)
 {
     CodeMessage      = codeMessage;
     Description      = description;
     Severity         = severite;
     Type             = ruleType;
     Parameter        = parameter;
     AllowNull        = allowNull;
     ValidationObject = validationObject;
     ObjectType       = objectType;
 }
Esempio n. 32
0
        /// <summary>
        /// Returns the number of matches found with the specified rule severity.
        /// </summary>
        /// <param name="severity">Defines a rules severity.</param>
        /// <returns></returns>
        public int MatchesFoundBySeverity(RuleSeverity severity)
        {
            lock (_lockInternalMatches)
            {
                if (InternalMatches.Count <= 0)
                {
                    return(0);
                }

                return(InternalMatches.Count(match => match.Severity == severity));
            }
        }
        /// <summary>
        /// Returns a string array containing all broken
        /// rule descriptions.
        /// </summary>
        /// <param name="severity">The severity of rules
        /// to include in the result.</param>
        /// <returns>The text of all broken rule descriptions
        /// matching the specified severtiy.</returns>
        public string[] ToArray(RuleSeverity severity)
        {
            List <string> result = new List <string>();

            foreach (BrokenRule item in this)
            {
                if (item.Severity == severity)
                {
                    result.Add(item.Description);
                }
            }
            return(result.ToArray());
        }
Esempio n. 34
0
        private int GetNumberOfBrokenRules(RuleSeverity severity)
        {
            int count = 0;

            foreach (var item in this)
            {
                if (item.Severity == severity)
                {
                    count++;
                }
            }

            return(count);
        }
Esempio n. 35
0
 /// <summary>
 ///     Validation d'une chaîne avec la formule de Luhn
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleLuhn(string codeMessage, string description, RuleSeverity severite, bool allowNull)
     : base(codeMessage, description, severite, RuleType.Luhn, null, null, null, allowNull)
 {
 }
Esempio n. 36
0
 /// <summary>
 /// Creates an instance of RuleArgs.
 /// </summary>
 /// <param name="propertyName">The name of the property to be validated.</param>
 /// <param name="friendlyName">A friendly name for the property, which
 /// will be used in place of the property name when
 /// creating the broken rule description string.</param>
 /// <param name="severity">The default severity for the rule.</param>
 /// <param name="stopProcessing">
 /// Initial default value for the StopProcessing property.
 /// </param>
 /// <remarks>
 /// <para>
 /// The <b>severity</b> and <b>stopProcessing</b> parameters 
 /// define only the initial default values. If the rule 
 /// changes these values by setting e.Severity or
 /// e.StopProcessing, then the new values will become 
 /// the default for all subsequent rule invocations.
 /// </para><para>
 /// To avoid confusion, It is recommended that the 
 /// <b>severity</b> and <b>stopProcessing</b> constructor 
 /// parameters only be used for rule methods that do 
 /// not explicitly set e.Severity or e.StopProcessing.
 /// </para>
 /// </remarks>
 public RuleArgs(string propertyName, string friendlyName, RuleSeverity severity, bool stopProcessing)
   : this(propertyName, friendlyName, severity)
 {
   _stopProcessing = stopProcessing;
 }
Esempio n. 37
0
 /// <summary>
 ///     Cette règle n'est pas gérée par le Systeme. Elle doit l'être par une classe utilisateur implémentant
 ///     l'interface iCustomValidation.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 public RuleCustom(string codeMessage, string description, RuleSeverity severite)
     : base(codeMessage, description, severite, RuleType.CustomRules, null, null, null, false)
 {
 }
Esempio n. 38
0
 /// <summary>
 ///     Validation d'une chaîne de caractère sous forme de code postal Canadien .
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleStrongPassword(string codeMessage, string description, RuleSeverity severite, bool allowNull)
     : base(codeMessage, description, severite, RuleType.StrongPassword, RegexValidation, null, null, allowNull)
 {
 }
Esempio n. 39
0
 /// <summary>
 ///     Validation d'une adresse de courriel.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleEmailAddress(string codeMessage, string description, RuleSeverity severite, bool allowNull)
     : base(codeMessage, description, severite, RuleType.EmailAddress, RegexValidation, null, null, allowNull)
 {
 }
Esempio n. 40
0
 /// <summary>
 /// Returns the matches found with the specified rule severity.
 /// </summary>
 /// <param name="severity">Defines a rules severity.</param>
 /// <returns></returns>
 public List<IMatch> MatchesBySeverity(RuleSeverity severity)
 {
     lock (_lockInternalMatches)
       {
     return (from match in InternalMatches where match.Severity == severity select match.Clone() as IMatch).ToList();
       }
 }
Esempio n. 41
0
 /// <summary>
 ///     Cette règle n'est pas gérée par le Systeme. Elle doit l'être par une classe utilisateur implémentant
 ///     l'interface iCustomValidation.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 public RuleContain(string codeMessage, string description, RuleSeverity severite, bool allowNull, string valuetocheck)
     : base(codeMessage, description, severite, RuleType.ContainString, valuetocheck, null, null, allowNull)
 {
 }
Esempio n. 42
0
 /// <summary>
 ///     Validation d'un nombre entier sur sa valeur minimale.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="minValue"> Valeur minimale de l'entier. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleIntegerMinValue(string codeMessage, string description, RuleSeverity severite, int minValue,
     bool allowNull)
     : base(codeMessage, description, severite, RuleType.IntergerMinValue, minValue, null, null, allowNull)
 {
 }
Esempio n. 43
0
 /// <summary>
 ///     Validation d'une chaîne de caractère sous forme de code postal Canadien .
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleFloatingNumber(string codeMessage, string description, RuleSeverity severite, bool allowNull)
     : base(codeMessage, description, severite, RuleType.FloatingNumber, RegexValidation, null, null, allowNull)
 {
 }
Esempio n. 44
0
 /// <summary>
 /// Creates an instance of RuleArgs.
 /// </summary>
 /// <param name="propertyInfo">The PropertyInfo for the property to be validated.</param>
 /// <param name="severity">Initial default severity for the rule.</param>
 /// <remarks>
 /// <para>
 /// The <b>severity</b> parameter defines only the initial default 
 /// severity value. If the rule changes this value by setting
 /// e.Severity, then that new value will become the default for all
 /// subsequent rule invocations.
 /// </para><para>
 /// To avoid confusion, it is recommended that the 
 /// <b>severity</b> constructor parameter 
 /// only be used for rule methods that do not explicitly set
 /// e.Severity.
 /// </para>
 /// </remarks>
 public DecoratedRuleArgs(Core.IPropertyInfo propertyInfo, RuleSeverity severity)
   : base(propertyInfo, severity)
 {
   _decorations = new Dictionary<string, object>();
 }
Esempio n. 45
0
 /// <summary>
 ///     Validation d'un nombre double sur sa valeur minimale.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="minValue"> Valeur minimale du double. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleDoubleMinValue(string codeMessage, string description, RuleSeverity severite, double minValue,
     bool allowNull)
     : base(codeMessage, description, severite, RuleType.DoubleMinValue, minValue, null, null, allowNull)
 {
 }
Esempio n. 46
0
 /// <summary>
 /// Creates an instance of RuleArgs.
 /// </summary>
 /// <param name="propertyInfo">The PropertyInfo for the property to be validated.</param>
 /// <param name="severity">The default severity for the rule.</param>
 /// <param name="stopProcessing">
 /// Initial default value for the StopProcessing property.
 /// </param>
 /// <param name="args">Reference to a Dictionary containing 
 /// name/value arguments for use by the rule method.</param>
 /// <remarks>
 /// <para>
 /// The <b>severity</b> and <b>stopProcessing</b> parameters 
 /// define only the initial default values. If the rule 
 /// changes these values by setting e.Severity or
 /// e.StopProcessing, then the new values will become 
 /// the default for all subsequent rule invocations.
 /// </para><para>
 /// To avoid confusion, It is recommended that the 
 /// <b>severity</b> and <b>stopProcessing</b> constructor 
 /// parameters only be used for rule methods that do 
 /// not explicitly set e.Severity or e.StopProcessing.
 /// </para>
 /// </remarks>
 public DecoratedRuleArgs(Core.IPropertyInfo propertyInfo, RuleSeverity severity, bool stopProcessing, Dictionary<string, object> args)
   : base(propertyInfo, severity, stopProcessing)
 {
   _decorations = args;
 }
Esempio n. 47
0
 /// <summary>
 ///     Validation d'une chaîne de caractères non vide.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 public RuleStringRequired(string codeMessage, string description, RuleSeverity severite)
     : base(codeMessage, description, severite, RuleType.StringRequired, null, null, null, false)
 {
 }
Esempio n. 48
0
 /// <summary>
 /// Creates an instance of RuleArgs.
 /// </summary>
 /// <param name="propertyInfo">The PropertyInfo for the property.</param>
 /// <param name="severity">The default severity for the rule.</param>
 /// <param name="stopProcessing">
 /// Initial default value for the StopProcessing property.
 /// </param>
 /// <remarks>
 /// <para>
 /// The <b>severity</b> and <b>stopProcessing</b> parameters 
 /// define only the initial default values. If the rule 
 /// changes these values by setting e.Severity or
 /// e.StopProcessing, then the new values will become 
 /// the default for all subsequent rule invocations.
 /// </para><para>
 /// To avoid confusion, It is recommended that the 
 /// <b>severity</b> and <b>stopProcessing</b> constructor 
 /// parameters only be used for rule methods that do 
 /// not explicitly set e.Severity or e.StopProcessing.
 /// </para>
 /// </remarks>
 public RuleArgs(Core.IPropertyInfo propertyInfo, RuleSeverity severity, bool stopProcessing)
   : this(propertyInfo, severity)
 {
   _stopProcessing = stopProcessing;
 }
Esempio n. 49
0
        /// <summary>
        /// Returns the number of matches found with the specified rule severity.
        /// </summary>
        /// <param name="severity">Defines a rules severity.</param>
        /// <returns></returns>
        public int MatchesFoundBySeverity(RuleSeverity severity)
        {
            lock (_lockInternalMatches)
              {
            if (InternalMatches.Count <= 0)
              return 0;

            return InternalMatches.Count(match => match.Severity == severity);
              }
        }
Esempio n. 50
0
 /// <summary>
 ///     Cette méthode permet de vérifier qu'un objet a au moins une de ses propriétés qui n'est pas null ou à sa valeur par
 ///     défaut.
 ///     Exemple : Pour qu'un objet passe la vérification, il doit avoir au moins une string n'étant pas à null ou vide, une
 ///     propriété
 ///     numérique doit être plus grande que 0, une propriété Nullable ne doit pas être null ou encore une de ses propriétés
 ///     est d'un type
 ///     Non Nullable.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="listProperty"> Liste des propriétés à vérifier. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleObjectContainsOneValidProperty(string codeMessage, string description, RuleSeverity severite,
     List<string> listProperty, bool allowNull)
     : base(codeMessage, description, severite, RuleType.ObjectContainsOneValidProperty, listProperty, null, null,
         allowNull)
 {
 }
Esempio n. 51
0
 /// <summary>
 ///     Validation d'une chaîne de caractère à l'aide d'une expression régulière.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="regularExpression"> Expression régulière. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleRegularExpression(string codeMessage, string description, RuleSeverity severite,
     string regularExpression, bool allowNull)
     : base(codeMessage, description, severite, RuleType.RegularExpression, regularExpression, null, null,
         allowNull)
 {
 }
Esempio n. 52
0
 /// <summary>
 /// Creates an instance of RuleArgs.
 /// </summary>
 /// <param name="propertyName">The name of the property to be validated.</param>
 /// <param name="severity">Initial default severity for the rule.</param>
 /// <remarks>
 /// <para>
 /// The <b>severity</b> parameter defines only the initial default 
 /// severity value. If the rule changes this value by setting
 /// e.Severity, then that new value will become the default for all
 /// subsequent rule invocations.
 /// </para><para>
 /// To avoid confusion, it is recommended that the 
 /// <b>severity</b> constructor parameter 
 /// only be used for rule methods that do not explicitly set
 /// e.Severity.
 /// </para>
 /// </remarks>
 public DecoratedRuleArgs(string propertyName, RuleSeverity severity)
   : base(propertyName, severity)
 {
   _decorations = new Dictionary<string, object>();
 }
Esempio n. 53
0
 /// <summary>
 /// Creates an instance of RuleArgs.
 /// </summary>
 /// <param name="propertyName">The name of the property to be validated.</param>
 /// <param name="severity">The default severity for the rule.</param>
 /// <param name="stopProcessing">
 /// Initial default value for the StopProcessing property.
 /// </param>
 /// <remarks>
 /// <para>
 /// The <b>severity</b> and <b>stopProcessing</b> parameters 
 /// define only the initial default values. If the rule 
 /// changes these values by setting e.Severity or
 /// e.StopProcessing, then the new values will become 
 /// the default for all subsequent rule invocations.
 /// </para><para>
 /// To avoid confusion, It is recommended that the 
 /// <b>severity</b> and <b>stopProcessing</b> constructor 
 /// parameters only be used for rule methods that do 
 /// not explicitly set e.Severity or e.StopProcessing.
 /// </para>
 /// </remarks>
 public DecoratedRuleArgs(string propertyName, RuleSeverity severity, bool stopProcessing)
   : base(propertyName, severity, stopProcessing)
 {
   _decorations = new Dictionary<string, object>();
 }
Esempio n. 54
0
 /// <summary>
 ///     Validation d'une chaîne de caractère sous forme de code postal US.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RulePostalCodeUS(string codeMessage, string description, RuleSeverity severite, bool allowNull)
     : base(codeMessage, description, severite, RuleType.RulePostalCodeUS, RegexValidation, null, null, allowNull)
 {
 }
Esempio n. 55
0
 /// <summary>
 /// Creates an instance of RuleArgs.
 /// </summary>
 /// <param name="propertyName">The name of the property to be validated.</param>
 /// <param name="friendlyName">A friendly name for the property, which
 /// will be used in place of the property name when
 /// creating the broken rule description string.</param>
 /// <param name="severity">The default severity for the rule.</param>
 /// <param name="stopProcessing">
 /// Initial default value for the StopProcessing property.
 /// </param>
 /// <param name="args">Reference to a Dictionary containing 
 /// name/value arguments for use by the rule method.</param>
 /// <remarks>
 /// <para>
 /// The <b>severity</b> and <b>stopProcessing</b> parameters 
 /// define only the initial default values. If the rule 
 /// changes these values by setting e.Severity or
 /// e.StopProcessing, then the new values will become 
 /// the default for all subsequent rule invocations.
 /// </para><para>
 /// To avoid confusion, It is recommended that the 
 /// <b>severity</b> and <b>stopProcessing</b> constructor 
 /// parameters only be used for rule methods that do 
 /// not explicitly set e.Severity or e.StopProcessing.
 /// </para>
 /// </remarks>
 public DecoratedRuleArgs(string propertyName, string friendlyName, RuleSeverity severity, bool stopProcessing, Dictionary<string, object> args)
   : base(propertyName, friendlyName, severity, stopProcessing)
 {
   _decorations = args;
 }
Esempio n. 56
0
 /// <summary>
 ///     Validation d'une chaîne de caractères sur sa longueur minimale.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="minLength"> Taille minimale de la chaine. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RuleStringMinLength(string codeMessage, string description, RuleSeverity severite, int minLength,
     bool allowNull)
     : base(codeMessage, description, severite, RuleType.StringMinLength, minLength, null, null, allowNull)
 {
 }
Esempio n. 57
0
 /// <summary>
 /// Creates an instance of RuleArgs.
 /// </summary>
 /// <param name="propertyInfo">The PropertyInfo for the property.</param>
 /// <param name="severity">Initial default severity for the rule.</param>
 /// <remarks>
 /// <para>
 /// The <b>severity</b> parameter defines only the initial default 
 /// severity value. If the rule changes this value by setting
 /// e.Severity, then that new value will become the default for all
 /// subsequent rule invocations.
 /// </para><para>
 /// To avoid confusion, it is recommended that the 
 /// <b>severity</b> constructor parameter 
 /// only be used for rule methods that do not explicitly set
 /// e.Severity.
 /// </para>
 /// </remarks>
 public RuleArgs(Core.IPropertyInfo propertyInfo, RuleSeverity severity)
   : this(propertyInfo)
 {
   _severity = severity;
 }
Esempio n. 58
0
 /// <summary>
 /// Creates an instance of RuleArgs.
 /// </summary>
 /// <param name="propertyName">The name of the property to be validated.</param>
 /// <param name="friendlyName">A friendly name for the property, which
 /// will be used in place of the property name when
 /// creating the broken rule description string.</param>
 /// <param name="severity">Initial default severity for the rule.</param>
 /// <remarks>
 /// <para>
 /// The <b>severity</b> parameter defines only the initial default 
 /// severity value. If the rule changes this value by setting
 /// e.Severity, then that new value will become the default for all
 /// subsequent rule invocations.
 /// </para><para>
 /// To avoid confusion, it is recommended that the 
 /// <b>severity</b> constructor parameter 
 /// only be used for rule methods that do not explicitly set
 /// e.Severity.
 /// </para>
 /// </remarks>
 public RuleArgs(string propertyName, string friendlyName, RuleSeverity severity)
   : this(propertyName, friendlyName)
 {
   _severity = severity;
 }
Esempio n. 59
0
        /// <summary>
        /// Override this method to retrieve your field values
        /// from the MobileFormatter serialzation stream.
        /// </summary>
        /// <param name="info">
        /// Object containing the data to serialize.
        /// </param>
        /// <param name="mode">
        /// The StateMode indicating why this method was invoked.
        /// </param>
        protected override void OnSetState(SerializationInfo info, StateMode mode)
        {
            _ruleName = info.GetValue<string>("_ruleName");
              _description = info.GetValue<string>("_description");
              _property = info.GetValue<string>("_property");
              _severity = info.GetValue<RuleSeverity>("_severity");
              _originProperty = info.GetValue<string>("_originProperty");

              base.OnSetState(info, mode);
        }
Esempio n. 60
0
 /// <summary>
 ///     Validation d'un numéro de téléphone du Canada.
 /// </summary>
 /// <param name="codeMessage"> Code du message pouvant se trouver dans un fichier ressource. </param>
 /// <param name="description"> Message de la règle de validation. </param>
 /// <param name="severite"> Spécifie la sévérité de l'erreur de validation. </param>
 /// <param name="allowNull"> Est-ce que la validation passera si le champ est Null. </param>
 public RulePhoneNumberWithExtention(string codeMessage, string description, RuleSeverity severite,
     bool allowNull)
     : base(codeMessage, description, severite, RuleType.RulePhoneNumberWithExtention, RegexValidation, null, null,
         allowNull)
 {
 }