示例#1
0
文件: Triggers.cs 项目: SanSay157/IT8
        private XTriggersController()
        {
            XTriggersConfiguration config      = new XTriggersConfiguration();
            ArrayList aTriggersForObjects      = new ArrayList();
            ArrayList aTriggersForGroups       = new ArrayList();
            ArrayList aTriggersForWholeDataSet = new ArrayList();

            foreach (XTriggerConfiguration triggerConfig in config.TriggersDescr)
            {
                XTriggerDescription tr_descr = new XTriggerDescription(triggerConfig);
                switch (tr_descr.FireType)
                {
                case XTriggerFireTypes.ForEachObject:
                    aTriggersForObjects.Add(tr_descr);
                    break;

                case XTriggerFireTypes.ForEachObjectGroup:
                    aTriggersForGroups.Add(tr_descr);
                    break;

                case XTriggerFireTypes.ForWholeDataSet:
                    aTriggersForWholeDataSet.Add(tr_descr);
                    break;
                }
            }

            m_triggersForObjects = new XTriggerDescription[aTriggersForObjects.Count];
            aTriggersForObjects.CopyTo(m_triggersForObjects);

            m_triggersForGroups = new XTriggerDescription[aTriggersForGroups.Count];
            aTriggersForGroups.CopyTo(m_triggersForGroups);

            m_triggersForWholeDataSet = new XTriggerDescription[aTriggersForWholeDataSet.Count];
            aTriggersForWholeDataSet.CopyTo(m_triggersForWholeDataSet);
        }
示例#2
0
文件: Triggers.cs 项目: SanSay157/IT8
 private bool isTriggerMatchForObject(XTriggerDescription trigger, DomainObjectData xobj, XTriggerFireTimes fireTime)
 {
     if ((trigger.ObjectType == "*" || trigger.ObjectType == xobj.ObjectType) && trigger.FireTime == fireTime)
     {
         if (xobj.IsNew && (trigger.Action & XTriggerActions.Insert) > 0)
         {
             return(true);
         }
         else if (xobj.ToDelete && (trigger.Action & XTriggerActions.Delete) > 0)
         {
             return(true);
         }
         else if (!xobj.ToDelete && !xobj.IsNew && (trigger.Action & XTriggerActions.Update) > 0)
         {
             return(true);
         }
     }
     return(false);
 }