Esempio n. 1
0
 public ValidateDependencyRules(IValidateBaseServices <ValidateDependencyRules> services,
                                IShortNameDependencyRule <ValidateDependencyRules> shortNameRule,
                                IFullNameDependencyRule <ValidateDependencyRules> fullNameRule) : base(services)
 {
     RuleManager.AddRule(shortNameRule);
     RuleManager.AddRule(fullNameRule);
 }
        public SharedAsyncRuleObject(IValidateBaseServices <SharedAsyncRuleObject> services) : base(services)
        {
            var fn = services.RegisteredPropertyManager.GetRegisteredProperty <string>(nameof(FirstName));
            var ln = services.RegisteredPropertyManager.GetRegisteredProperty <string>(nameof(LastName));
            var sn = services.RegisteredPropertyManager.GetRegisteredProperty <string>(nameof(ShortName));

            RuleManager.AddRule(new ShortNameRule(sn, fn, ln));
        }
Esempio n. 3
0
        private void addRule_Click(object sender, RoutedEventArgs e)
        {
            var ofd = new OpenFileDialog();

            if (ofd.ShowDialog() == true)
            {
                ruleManager.AddRule(ofd.FileName);
            }
        }
Esempio n. 4
0
 public ValidateObject(IValidateBaseServices <ValidateObject> services) : base(services)
 {
     RuleManager.AddRule(t =>
     {
         t.RuleRunCount++;
         if (t.Name == "Error")
         {
             return(RuleResult.PropertyError(nameof(Name), "Error"));
         }
         return(RuleResult.Empty());
     }, nameof(Name));
 }
 public Task <IActionResult> AddTemplateTextRules([FromBody] Rule[] Rules)
 {
     try
     {
         return(RuleManager.AddRule(Rules));
     }
     catch (Exception e)
     {
         return(false);
     }
     return(Json(true));
 }
Esempio n. 6
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            SetDirty(true);
            Rule r = new Rule();

            r.Id   = Guid.NewGuid();
            r.Name = "New Rule";
            _ruleManager.AddRule(r);
            int index = lbRules.Items.Add(r);

            lbRules.SelectedIndex = index;
        }
Esempio n. 7
0
        public COOPClassParser()
        {
            startSymbol = SyntacticCategories.start;
            RuleManager = new RuleManager <string>();


            RuleManager.AddSet("reserved", ReservedWords.getReservedWords());
            RuleManager.AddToSet("reserved", "int", "double", "float", "char", "long");
            RuleManager.AddSet("reserved_types", "int", "double", "float", "char", "long");

            var classDefCollector = StandardCollectors.CategoryCollectorMulti("symbol", "class_name", "class");

            Rule classNameRule = new RuleOutOfSet(RuleManager["reserved"], classDefCollector);

            RuleManager.AddRule(classNameRule);
        }
Esempio n. 8
0
 public SimpleValidateObject(IValidateBaseServices <SimpleValidateObject> services,
                             IShortNameRule shortNameRule) : base(services)
 {
     RuleManager.AddRule(shortNameRule);
 }