Esempio n. 1
0
        public static SimpleRuleDef AddSimpleRule(this RuleElementDefCollection ruleDefContainer, string name,
                                                  string condition)
        {
            var simpleRule = new SimpleRuleDef(name, condition);

            ruleDefContainer.Add(simpleRule);
            return(simpleRule);
        }
Esempio n. 2
0
        internal void IgnoreExistingDef(RuleRepositoryDefBase child, string cat, RuleApplicationDef dest)
        {
            //does this def exist in the destination, keep going deep
            if ((this.FindDefDeep(dest, child.Guid.ToString()) != null))
            {
                if (child.HasChildCollectionChildren == false)
                {
                    Debug.WriteLine("The child exists in the ruleapp and has no children -- Do nothing.");
                }
                else
                {
                    //traverse the children and add only those that don't exist
                    var collquery = from childcollections in child.GetAllChildCollections()
                                    select childcollections;
                    foreach (RuleRepositoryDefCollection defcollection in collquery)
                    {
                        var defquery = from RuleRepositoryDefBase items in defcollection select items;
                        foreach (var def in defquery.ToList <RuleRepositoryDefBase>())
                        {
                            IgnoreExistingDef(def, cat, dest);
                        }
                    }
                }
            }
            else
            {
                if (child.AssignedCategories.Contains(cat))
                {
                    RuleRepositoryDefBase destParent = this.FindDefDeep(dest, child.Parent.Guid.ToString());
                    RuleRepositoryDefBase copy       = child.CopyWithSameGuids();
                    child.SetParent(null);
                    if (destParent.AuthoringElementTypeName != "Rule Set")
                    {
                        SimpleRuleDef simpleParent = (SimpleRuleDef)destParent;
                        simpleParent.SubRules.Add(child);
                    }
                    else
                    {
                        destParent.ThisRuleSet.Rules.Add(child);
                    }

                    //Debug.WriteLine("----Just add it --- " + child.Name + " Parent in dest: " + destParent.Name);
                }
            }
        }
Esempio n. 3
0
 public static AddCollectionMemberActionDef AddAddCollectionMemberAction(this SimpleRuleDef simpleRuleDef,
                                                                         string name, string collectionName, params NameExpressionPairDef[] memberValues)
 {
     return(simpleRuleDef.SubRules.AddAddCollectionMemberAction(name, collectionName, memberValues));
 }