Beispiel #1
0
        /// <summary>
        ///   Permet de générer une erreur de validation
        /// </summary>
        /// <param name="ruleResults"> </param>
        public static void CheckResultOfValidation(RuleResults ruleResults)
        {
            if (ruleResults != null && ruleResults.Count > 0)
            {
                var _exceptions = new ProcessResults();

                foreach (var objRuleResultTemp in ruleResults)
                {
                    var r = new ReturnMessage(TypeError.ValidationObjet,
                                              Utilities.TranslateSeverity(objRuleResultTemp.RuleInformation.Severity),
                                              objRuleResultTemp.RuleInformation.CodeMessage,
                                              objRuleResultTemp.RuleInformation.Description,
                                              false,
                                              objRuleResultTemp.Property
                                              )
                    {
                        ObjectName         = objRuleResultTemp.ObjectName,
                        ObjectPropertyName = objRuleResultTemp.Property,
                        RuleType           = objRuleResultTemp.RuleInformation.Type,
                        RuleReference      = objRuleResultTemp.RuleInformation
                    };
                    _exceptions.AddException(r);
                }

                if (ruleResults.Count > 0)
                {
                    throw new ExceptionProcess <ProcessResults> (_exceptions);
                }
            }
        }
Beispiel #2
0
        /// <summary>
        ///   Converti un objet de type RulesResults en objet de type ProcessResults
        /// </summary>
        /// <param name="results"> Objet de type RuleResults à convertir. </param>
        /// <returns> Retourne l'objet de type ProcessResults converti. </returns>
        public static ProcessResults ConvertRuleResultsToProcessResults(RuleResults results)
        {
            var processresults = new ProcessResults();

            foreach (var objRuleResultTemp in results)
            {
                var r = new ReturnMessage(TypeError.ValidationObjet,
                                          TranslateSeverity(objRuleResultTemp.RuleInformation.Severity),
                                          objRuleResultTemp.RuleInformation.CodeMessage,
                                          objRuleResultTemp.RuleInformation.Description,
                                          false,
                                          objRuleResultTemp.Property)
                {
                    ObjectName = objRuleResultTemp.ObjectName, ObjectPropertyName = objRuleResultTemp.Property
                };
                processresults.AddException(r);
            }
            return(processresults);
        }