Example #1
0
        public void Invoke(object value, IValidationReport report, ValidationReportDepth depth)
        {
            //If validating an Expression that has already failed a rule, then skip.
            if (depth == ValidationReportDepth.FieldShortCircuit && report.HasError(value, _originatingExpression))
            {
                return;
            }

            var originatingValue = (T)value;
            R   valueToValidate;

            if (!_valueToValidate.TryGetValue(originatingValue, out valueToValidate))
            {
                return;
            }
            var result = _rule.Validate(valueToValidate);

            if (!result.IsValid)
            {
                var culpritResults = _culpritResolver.Resolve(originatingValue);
                foreach (var culpritResult in culpritResults)
                {
                    report.AddError(new ValidationError(_rule, culpritResult.Expression, result.Arguments, culpritResult.Value, originatingValue, _originatingExpression));
                }
            }
        }
 public XmlValidationContext(PropertyInfo field,
                             IAttributeDataProvider attributeProvider, IXmlValidatorDataProvider <string> dataProvider,
                             IValidationReport report)
 {
     Field             = field;
     AttributeProvider = attributeProvider;
     DataProvider      = dataProvider;
     Report            = report;
 }
 public void Invoke(object value, IValidationReport report, ValidationReportDepth depth)
 {
     if (_condition.Invoke((T)value))
     {
         _innerTrue.Validate(value, report, depth);
     }
     else
     {
         _innerFalse.Validate(value, report, depth);
     }
 }
Example #4
0
 public void Validate(object value, IValidationReport report, ValidationReportDepth depth)
 {
     if (value == null) return;
     foreach (var invoker in _invokerRegistry.GetInvokers(value.GetType()))
     {
         invoker.Invoke(value, report, depth);
         if (report.HasErrors && depth == ValidationReportDepth.ShortCircuit)
         {
             return;
         }
     }
 }
Example #5
0
        public void Invoke(object value, IValidationReport report, ValidationReportDepth depth)
        {
            if (depth == ValidationReportDepth.FieldShortCircuit && report.HasError(value, _expression))
            {
                return;
            }

            R objToValidate = _compiledExpression.Invoke((T)value);

            if (objToValidate != null)
            {
                _rulesEngine.Validate(objToValidate, report, depth);
            }
        }
Example #6
0
 public void Validate(object value, IValidationReport report, ValidationReportDepth depth)
 {
     if (value == null)
     {
         return;
     }
     foreach (var invoker in _registry.GetInvokers(value.GetType()))
     {
         invoker.Invoke(value, report, depth);
         if (report.HasErrors && depth == ValidationReportDepth.ShortCircuit)
         {
             return;
         }
     }
 }
Example #7
0
        public void Invoke(object value, IValidationReport report, ValidationReportDepth depth)
        {
            //If validating an Expression that has already failed a rule, then skip.
            if (depth == ValidationReportDepth.FieldShortCircuit && report.HasError(_expressionToBlame, value))
            {
                return;
            }

            var result = _rule.Validate(_compiledExpression.Invoke((T)value));

            if (!result.IsValid)
            {
                report.AddError(new ValidationError(_rule, _expressionToBlame, result.Arguments, value));
            }
        }
        public void Invoke(object value, IValidationReport report, ValidationReportDepth depth)
        {
            if (depth == ValidationReportDepth.FieldShortCircuit && report.HasError(_enumerableCompositionExpression, value))
            {
                return;
            }

            IEnumerable enumerableToValidate = _compiledExpression.Invoke((T)value);

            if (enumerableToValidate != null)
            {
                foreach (object objToValidate in enumerableToValidate)
                {
                    this.rulesRulesEngine.Validate(objToValidate, report, depth);
                    if (report.HasErrors && (depth == ValidationReportDepth.ShortCircuit))
                    {
                        return;
                    }
                }
            }
        }
Example #9
0
        protected void b_Click(object sender, EventArgs e)
        {
            WSDLValidator     valid  = new WSDLValidator();
            IValidationReport ivr    = valid.validate(wsdl_name.Text);
            String            errMsg = " ";
            HashSet <string>  se     = new HashSet <string>();

            if (!ivr.isWSDLValid())
            {
                foreach (IValidationMessage msg in ivr.getValidationMessages())
                {
                    se.Add(msg.getMessage());
                }
                foreach (String str in se)
                {
                    errMsg += str + "</br>";
                }
                Label24.Text    = errMsg;
                Label24.Visible = true;

                Label4.Visible  = false;
                Label5.Visible  = false;
                Label6.Visible  = false;
                Label7.Visible  = false;
                Label8.Visible  = false;
                Label9.Visible  = false;
                Label10.Visible = false;
                Label11.Visible = false;
                Label12.Visible = false;
                Label13.Visible = false;
                Label14.Visible = false;
                Label15.Visible = false;

                Button1.Visible = false;
                Button2.Visible = false;
                Button3.Visible = false;
                Button4.Visible = false;

                Label16.Visible = false;
                Label20.Visible = false;
                Label17.Visible = false;
                Label21.Visible = false;
                Label18.Visible = false;
                Label22.Visible = false;
                Label19.Visible = false;
                Label23.Visible = false;
            }
            else
            {
                Label24.Visible = false;
                url             = wsdl_name.Text;
                String[] myDictionary = sc.getServiceDetails(url);
                //myDictionary = sc.getServiceDetails(url);
                count           = myDictionary.Length;
                Label16.Visible = false;
                Label20.Visible = false;
                Label17.Visible = false;
                Label21.Visible = false;
                Label18.Visible = false;
                Label22.Visible = false;
                Label19.Visible = false;
                Label23.Visible = false;

                if (count >= 1)
                {
                    Label4.Visible  = true;
                    Label5.Visible  = true;
                    Label6.Visible  = true;
                    Button1.Visible = true;
                }
                else
                {
                    Label4.Visible  = false;
                    Label5.Visible  = false;
                    Label6.Visible  = false;
                    Button1.Visible = false;
                    Label7.Visible  = false;
                    Label8.Visible  = false;
                    Label9.Visible  = false;
                    Button2.Visible = false;
                    Label10.Visible = false;
                    Label11.Visible = false;
                    Label12.Visible = false;
                    Button3.Visible = false;
                    Label13.Visible = false;
                    Label14.Visible = false;
                    Label15.Visible = false;
                    Button4.Visible = false;
                }
                if (count >= 2)
                {
                    Label7.Visible  = true;
                    Label8.Visible  = true;
                    Label9.Visible  = true;
                    Button2.Visible = true;
                }
                else
                {
                    Label7.Visible  = false;
                    Label8.Visible  = false;
                    Label9.Visible  = false;
                    Button2.Visible = false;
                    Label10.Visible = false;
                    Label11.Visible = false;
                    Label12.Visible = false;
                    Button3.Visible = false;
                    Label13.Visible = false;
                    Label14.Visible = false;
                    Label15.Visible = false;
                    Button4.Visible = false;
                }
                if (count >= 3)
                {
                    Label10.Visible = true;
                    Label11.Visible = true;
                    Label12.Visible = true;
                    Button3.Visible = true;
                }
                else
                {
                    Label10.Visible = false;
                    Label11.Visible = false;
                    Label12.Visible = false;
                    Button3.Visible = false;
                    Label13.Visible = false;
                    Label14.Visible = false;
                    Label15.Visible = false;
                    Button4.Visible = false;
                }
                if (count >= 4)
                {
                    Label13.Visible = true;
                    Label14.Visible = true;
                    Label15.Visible = true;
                    Button4.Visible = true;
                }
                else
                {
                    Label13.Visible = false;
                    Label14.Visible = false;
                    Label15.Visible = false;
                    Button4.Visible = false;
                }
                foreach (String entry in myDictionary)
                {
                    // Label MyLabel = new Label();
                    //Assigning the textbox ID name
                    // MyLabel.ID = f + i.ToString();
                    // MyLabel.Width = 800;
                    // MyLabel.Height = 60;

                    //MyLabel.TextMode = TextBoxMode.MultiLine;

                    String[] p = entry.Split('!');
                    System.Diagnostics.Debug.Write("****************" + p.Length + p);
                    if (i == 0)
                    {
                        Label4.Text = p[0];
                        Label5.Text = p[2];
                        Label6.Text = p[1];
                    }
                    if (i == 1)
                    {
                        Label7.Text = p[0];
                        Label8.Text = p[2];
                        Label9.Text = p[1];
                    }
                    if (i == 2)
                    {
                        Label10.Text = p[0];
                        Label11.Text = p[2];
                        Label12.Text = p[1];
                    }
                    ///    Result.Text += "<b>" + "Function" + i.ToString() + "  " + "</b>" + p[0];
                    //string io = entry.Value;
                    //string[] parameters = io.Split('#');

                    //Output.Text += "<b>" + "Output parameters for Fucntion" + i.ToString() + "  " + "</b>" + p[1];
                    // Input.Text += "<b>" + "Input parameters for Fucntion" + i.ToString() + "  " + "</b>" + p[2];
                    i++;
                    // this.Controls.Add(MyLabel);

                    //Form.Controls.Add(MyTextBox);

                    //  func_name1.Text = entry.Key;
                    //string io = entry.Value;
                    //  string[] parameters = io.Split('#');
                    //  input_name1.Text = parameters[0];
                    // output_name1.Text = parameters[1];
                }
            }
        }
 public void Validate(object value, IValidationReport report)
 {
     Validate(value, report, ValidationReportDepth.ShortCircuit);
 }
Example #11
0
 public void Validate(object value, IValidationReport report)
 {
     Validate(value, report, ValidationReportDepth.ShortCircuit);
 }