Ejemplo n.º 1
0
 private void DoUpdate(FormProxy sourceProxy, FormProxy updateProxy)
 {
     if (rule.Update != null)
     {
         // Copy of the source form will be chnaged
         var targetForm = sourceProxy.Form.CopyForm(false);
         updateProxy.WithForm(targetForm);
         if (rule.Update.Method(sourceProxy, updateProxy))
         {
             engine.ActivePlugin.AddForm(targetForm);
             Updated++;
         }
     }
 }
Ejemplo n.º 2
0
        private void DoInserts(FormProxy sourceProxy)
        {
            if (rule.Inserts != null)
            {
                foreach (var insert in rule.Inserts)
                {
                    Form targetForm;
                    if (insert.Copy && sourceProxy != null && sourceProxy.Form.FormKind == insert.InsertedFormKind)
                    {
                        // Copy form data if  source is the same as target (and source is not null)
                        targetForm = sourceProxy.Form.CopyForm(true);
                    }
                    else
                    {
                        // Create new otherwise
                        targetForm = engine.Context.CreateForm(insert.InsertedFormKind);
                    }

                    var targetProxy = engine.ProxyProvider.CreateFormProxy(targetForm, ProxyMode.Target);
                    if (insert.Method(sourceProxy, targetProxy))
                    {
                        if (insert.InsertedFormId != 0)
                        {
                            // Set explicit Form ID
                            targetForm.FormId = insert.InsertedFormId;
                        }

                        engine.ActivePlugin.AddForm(targetForm);
                        Created++;

                        // Tag the new form now that it has a Form ID
                        // if it has been tagged during its creation
                        foreach (var text in targetProxy.DelayedTags)
                        {
                            engine.Tags.Tag(text, targetForm.FormId);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
 private void DoSelect(FormProxy sourceProxy)
 {
     if (rule.Select != null)
     {
         // Select makes no changes to the form
         rule.Select.Method(sourceProxy);
     }
 }
Ejemplo n.º 4
0
 private void DoActions(FormProxy sourceProxy, FormProxy updateProxy)
 {
     DoSelect(sourceProxy);
     DoUpdate(sourceProxy, updateProxy);
     DoInserts(sourceProxy);
 }