예제 #1
0
 public bool CheckEvents(string eventName, Agent pAgent)
 {
     if (this.m_attachments != null)
     {
         for (int i = 0; i < this.m_attachments.Count; i++)
         {
             AttachmentTask  task  = this.m_attachments[i];
             Event.EventTask task2 = task as Event.EventTask;
             if ((task2 != null) && !string.IsNullOrEmpty(eventName))
             {
                 string str = task2.GetEventName();
                 if (!string.IsNullOrEmpty(str) && (str == eventName))
                 {
                     EBTStatus status = task.GetStatus();
                     if ((status == EBTStatus.BT_RUNNING) || (status == EBTStatus.BT_INVALID))
                     {
                         status = task.exec(pAgent);
                     }
                     switch (status)
                     {
                     case EBTStatus.BT_SUCCESS:
                         if (!task2.TriggeredOnce())
                         {
                             break;
                         }
                         return(false);
                     }
                 }
             }
         }
     }
     return(true);
 }
예제 #2
0
 public bool CheckEvents(string eventName, Agent pAgent)
 {
     if (this.m_attachments != null)
     {
         for (int i = 0; i < this.m_attachments.Count; i++)
         {
             AttachmentTask  attachmentTask = this.m_attachments[i];
             Event.EventTask eventTask      = attachmentTask as Event.EventTask;
             if (eventTask != null && !string.IsNullOrEmpty(eventName))
             {
                 string eventName2 = eventTask.GetEventName();
                 if (!string.IsNullOrEmpty(eventName2) && eventName2 == eventName)
                 {
                     EBTStatus eBTStatus = attachmentTask.GetStatus();
                     if (eBTStatus == EBTStatus.BT_RUNNING || eBTStatus == EBTStatus.BT_INVALID)
                     {
                         eBTStatus = attachmentTask.exec(pAgent);
                     }
                     if (eBTStatus == EBTStatus.BT_SUCCESS)
                     {
                         if (eventTask.TriggeredOnce())
                         {
                             return(false);
                         }
                     }
                     else if (eBTStatus == EBTStatus.BT_FAILURE)
                     {
                     }
                 }
             }
         }
     }
     return(true);
 }
예제 #3
0
        /**
         * return false if the event handling needs to be stopped
         *
         * an event can be configured to stop being checked if triggered
         */
        public bool CheckEvents(string eventName, Agent pAgent)
        {
            if (this.m_attachments != null)
            {
                //bool bTriggered = false;
                for (int i = 0; i < this.m_attachments.Count; ++i)
                {
                    AttachmentTask  pA = this.m_attachments[i];
                    Event.EventTask pE = pA as Event.EventTask;

                    //check events only
                    if (pE != null && !string.IsNullOrEmpty(eventName))
                    {
                        string pEventName = pE.GetEventName();

                        if (!string.IsNullOrEmpty(pEventName) && pEventName == eventName)
                        {
                            EBTStatus currentStatus = pA.GetStatus();

                            if (currentStatus == EBTStatus.BT_RUNNING || currentStatus == EBTStatus.BT_INVALID)
                            {
                                currentStatus = pA.exec(pAgent);
                            }

                            if (currentStatus == EBTStatus.BT_SUCCESS)
                            {
                                //bTriggered = true;

                                if (pE.TriggeredOnce())
                                {
                                    return(false);
                                }
                            }
                            else if (currentStatus == EBTStatus.BT_FAILURE)
                            {
                            }
                        }
                    }
                }
            }

            return(true);
        }