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; }
/// <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) { }
public BrokenRule(RuleSeverity severity, string description, string technical, string key) { Severity = severity; Description = description; Technical = technical; Key = key; }
/// <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) { }
/// <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) { }
internal BrokenRule(IRuleMethod rule) { _ruleName = rule.RuleName; _description = rule.RuleArgs.Description; _property = rule.RuleArgs.PropertyName; _severity = rule.RuleArgs.Severity; }
/// <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) { }
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); }
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; } }
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; } }
public Rule(string id, SyntaxQuery query, RuleSeverity severity, string message) { Id = id; Query = query; Severity = severity; Message = message; }
internal BrokenRule(IAsyncRuleMethod asyncRule, AsyncRuleResult result) { _ruleName = asyncRule.RuleName; _description = result.Description; _severity = result.Severity; _property = asyncRule.AsyncRuleArgs.Properties[0].Name; }
/// <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()); } }
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)); }
internal ExtendedBrokenRule(BrokenRule rule, object link) { _ruleName = rule.RuleName; _description = rule.Description; _property = rule.Property; _severity = rule.Severity; _link = link; }
/// <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); }
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; }
/// <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); }
/// <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; }
/// <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); }
/// <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); }
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"); } }
public static string GetSeverityString(RuleSeverity severity) { if (severity == RuleSeverity.High) { return("High"); } else if (severity == RuleSeverity.Low) { return("Low"); } return("N/A"); }
/// <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; }
/// <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()); }
private int GetNumberOfBrokenRules(RuleSeverity severity) { int count = 0; foreach (var item in this) { if (item.Severity == severity) { count++; } } return(count); }
/// <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) { }
/// <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; }
/// <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) { }
/// <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) { }
/// <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) { }
/// <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(); } }
/// <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) { }
/// <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) { }
/// <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) { }
/// <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>(); }
/// <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) { }
/// <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; }
/// <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) { }
/// <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; }
/// <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> /// 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) { }
/// <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) { }
/// <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>(); }
/// <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>(); }
/// <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) { }
/// <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; }
/// <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) { }
/// <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; }
/// <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; }
/// <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); }
/// <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) { }