Пример #1
0
        public ActionResult Create()
        {
            var automatedAction = new AutomatedAction {
                IsNew = true, TriggerType = (int?)ActionTriggerType.Immediately
            };

            _automatedActionRepository.InsertAndCommit(automatedAction);
            return(Json(new { Id = automatedAction.Id }));
        }
        private void ExecuteAutomatedAction(AuditEntity auditEntity, AutomatedAction ac)
        {
            long entityId = this.ValidateACExpression(auditEntity, ac.Expression);

            if (entityId > 0)
            {
                ScheduleExecuteActionJob(entityId, auditEntity, ac);
            }
        }
Пример #3
0
        private void SendMessage(AutomatedAction ac, WorkflowBaseEntity wfEntity)
        {
            var users = _userService.GetUsers(ac.Users, wfEntity);

            //Notify users
            if (!string.IsNullOrEmpty(ac.MessageTemplate))
            {
                _messageService.SendMessage(wfEntity, ac.MessageTemplate, users, null);
            }
        }
        private void ScheduleExecuteActionJob(long entityId, AuditEntity auditEntity, AutomatedAction ac)
        {
            var scheduler = new QuartzScheduler(
                ConfigurationManager.AppSettings["QuartzServer"],
                Convert.ToInt32(ConfigurationManager.AppSettings["QuartzPort"]),
                ConfigurationManager.AppSettings["QuartzScheduler"]);

            IDictionary <string, object> map = new Dictionary <string, object>();

            map.Add("EntityId", entityId.ToString());
            map.Add("EntityType", auditEntity.EntityType.Name);
            map.Add("AutomatedActionId", ac.Id.ToString());

            //get Type of Job
            Type type = Type.GetType("BaseEAM.Services.ExecuteActionJob, BaseEAM.Services");

            if (ac.TriggerType == (int?)ActionTriggerType.Immediately)
            {
                scheduler.ScheduleOneTimeJob(type, map);
            }
            else if (ac.TriggerType == (int?)ActionTriggerType.TimeBased)
            {
                scheduler.ScheduleOneTimeJob(type, map, ac.HoursAfter);
            }
        }
Пример #5
0
 private void LaunchWorkflow(AutomatedAction ac, WorkflowBaseEntity wfEntity)
 {
 }