Exemplo n.º 1
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);
            }
        }
Exemplo n.º 2
0
        private List <User> GetApproveUsers(string users, WorkflowBaseEntity wfEntity)
        {
            var result = new List <User>();

            result = _userService.GetUsers(users, wfEntity);

            // filter by user's approval limit
            if (wfEntity.GetType().Name.Contains(EntityType.PurchaseOrder))
            {
                result = result.Where(r => r.POApprovalLimit >= wfEntity.AssignmentAmount).ToList();
            }

            return(result);
        }
        public virtual List <User> GetUsers(string users, WorkflowBaseEntity wfEntity)
        {
            var result = new List <User>();

            //If users is a list of emails
            if (users.Contains("@"))
            {
                var emails = users.Split(';');
                foreach (var email in emails)
                {
                    if (!string.IsNullOrEmpty(email))
                    {
                        var user = _userRepository.GetAll().Where(u => u.Email == email).FirstOrDefault();
                        if (user != null)
                        {
                            result.Add(user);
                        }
                        //in case the email is not in BaseEAM, such as SR was created anonymously
                        else
                        {
                            result.Add(new User {
                                Email = email, Phone = ""
                            });
                        }
                    }
                }
            }
            // "." represents a method invocation
            // this case is not a C# method
            else if (!users.Contains("."))
            {
                //if users is an assignment group
                //check if wfEntity has SiteId => this entity is at Site Level
                object value  = wfEntity.GetType().GetProperty("SiteId").GetValue(wfEntity, null);
                long?  siteId = null;
                if (value != null)
                {
                    siteId = (long?)value;
                }

                result = _assignmentGroupService.GetUsers(users, siteId);
            }
            //if users is a C# method
            else
            {
                // already handled in Task Activity
            }

            return(result);
        }
Exemplo n.º 4
0
 private List <User> GetUsers(string users, WorkflowBaseEntity wfEntity)
 {
     return(_userService.GetUsers(users, wfEntity));
 }
Exemplo n.º 5
0
 private void LaunchWorkflow(AutomatedAction ac, WorkflowBaseEntity wfEntity)
 {
 }