Ejemplo n.º 1
0
        public RuleConstraintValue AddRuleConstraint(string left, string operation, string right)
        {
            var result = new RuleConstraintValue {
                Name = Utility.RandomString(10), Left = left, Operation = operation, Right = right
            };

            RuleConstraintValues.Add(result);
            UpdateRuleConstraints();
            return(result);
        }
Ejemplo n.º 2
0
        public void UpdateRuleConstraint(string name, string left, string operation, string right)
        {
            if (RuleConstraintValues.All(x => x.Name != name))
            {
                RuleConstraintValues.Add(new RuleConstraintValue {
                    Name = name
                });
            }
            var rc = RuleConstraintValues.First(x => x.Name == name);

            rc.Left      = left;
            rc.Operation = operation;
            rc.Right     = right;
            UpdateRuleConstraints();
        }
Ejemplo n.º 3
0
 public void DeleteRuleConstraint(string name)
 {
     RuleConstraintValues.Where(x => x.Name == name).ToList().ForEach(x => RuleConstraintValues.Remove(x));
     UpdateRuleConstraints();
 }
Ejemplo n.º 4
0
 public void RemoveInvalidConstraints()
 {
     RuleConstraintValues.Where(x => string.IsNullOrEmpty(x.Left) || string.IsNullOrEmpty(x.Operation)).ToList().ForEach(x => RuleConstraintValues.Remove(x));
     UpdateRuleConstraints();
 }