Esempio n. 1
0
        private void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            // check all registered permissions...
            DateTime?temp;

            foreach (SQLTriggerEvent trigger in triggerList)
            {
                if ((temp = getSQLTriggerTime(trigger.name)) != trigger.timestamp)
                {
                    trigger.timestamp = temp;

                    SQLTriggerEvent evnt = new SQLTriggerEvent();
                    evnt.name      = trigger.name;
                    evnt.timestamp = temp;

                    context.Post(new SendOrPostCallback(delegate(object state)
                    {
                        SQLTriggerHandler handler = sqlTriggerEvent;

                        if (handler != null)
                        {
                            handler(this, evnt);
                        }
                    }), null);
                }
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Register an event to watch for
        /// </summary>
        /// <param name="name">Event Name</param>
        public void registerSQLTrigger(string name)
        {
            if (!UpdateSession.IsConnected)
            {
                UpdateSession.OptimisticLockingReadBehavior = OptimisticLockingReadBehavior.Ignore;
                UpdateSession.LockingOption = LockingOption.None;
                UpdateSession.Connect();
            }
            XpoSQLTriggerInfo trigger;

            trigger = UpdateSession.FindObject <XpoSQLTriggerInfo>(CriteriaOperator.Parse("[triggerName] = '" + name + "'"));

            if (trigger != null)
            {
                SQLTriggerEvent obj = new SQLTriggerEvent();
                obj.name      = trigger.triggerName;
                obj.timestamp = trigger.timestamp;
                triggerList.Add(obj);
            }
        }
        private void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            // check all registered permissions...
            DateTime? temp;

            foreach (SQLTriggerEvent trigger in triggerList)
            {
                if ((temp = getSQLTriggerTime(trigger.name)) != trigger.timestamp)
                {
                    trigger.timestamp = temp;

                    SQLTriggerEvent evnt = new SQLTriggerEvent();
                    evnt.name = trigger.name;
                    evnt.timestamp = temp;

                    context.Post(new SendOrPostCallback(delegate(object state)
                    {
                        SQLTriggerHandler handler = sqlTriggerEvent;

                        if (handler != null)
                        {
                            handler(this, evnt);
                        }
                    }), null);
                }
            }
        }
        /// <summary>
        /// Register an event to watch for
        /// </summary>
        /// <param name="name">Event Name</param>
        public void registerSQLTrigger(string name)
        {
            if (!UpdateSession.IsConnected)
            {
                UpdateSession.OptimisticLockingReadBehavior = OptimisticLockingReadBehavior.Ignore;
                UpdateSession.LockingOption = LockingOption.None;
                UpdateSession.Connect();
            }
            XpoSQLTriggerInfo trigger;

                trigger = UpdateSession.FindObject<XpoSQLTriggerInfo>(CriteriaOperator.Parse("[triggerName] = '" + name + "'"));

            if (trigger != null)
            {
                SQLTriggerEvent obj = new SQLTriggerEvent();
                obj.name = trigger.triggerName;
                obj.timestamp = trigger.timestamp;
                triggerList.Add(obj);
            }
        }