Beispiel #1
0
        /// <summary>
        /// 修改执行计划状态
        /// </summary>
        /// <param name="triggers">计划信息</param>
        public static void ModifyTriggerState(IEnumerable <Trigger> triggers)
        {
            if (triggers.IsNullOrEmpty())
            {
                return;
            }
            var triggerIds  = triggers.Select(c => c.Id).Distinct();
            var nowTriggers = triggerRepository.GetList(QueryFactory.Create <TriggerQuery>(c => triggerIds.Contains(c.Id)));

            if (nowTriggers.IsNullOrEmpty())
            {
                return;
            }
            foreach (var trigger in nowTriggers)
            {
                var newTrigger = triggers.FirstOrDefault(c => c.Id == trigger.Id);
                if (newTrigger == null)
                {
                    continue;
                }
                trigger.Status = newTrigger.Status;
                trigger.Save();
            }
        }