コード例 #1
0
        public virtual bool Matches(object eventId, IStateMachineContext context)
        {
            if (TriggerEvent != null)
            {
                if (TriggerEvent.Matches(eventId) || (eventId is string && (eventId.ToString().Equals("NA"))))
                {
                    if (this.RolesRequired != null && this.RolesRequired.Count > 0)
                    {
                        foreach (string role in this.RolesRequired)
                        {
                            AFEContext afe = new AFEContext();
                            afe.Assignments = new List <AFEAssignment>();
                            afe.UserID      = 1;
                            afe.Assignments.Add(new AFEAssignment()
                            {
                                AfeRoleCode = "AAPR", Order = 1, UserID = 1
                            });
                            afe.Assignments.Add(new AFEAssignment()
                            {
                                AfeRoleCode = "AAPR", Order = 2, UserID = 2
                            });


                            bool IsLastUserInTheCurrentOrder = afe.IsLastUserInTheCurrentOrder(role);

                            bool IsLastPersonInTheCurrentRole = afe.IsLastPersonInTheCurrentRole(role);

                            if (afe.Assignments.FindAll(t => t.AfeRoleCode == role && t.UserID == afe.UserID).Count > 0)
                            {
                                return(true);
                            }
                            else
                            {
                                return(false);
                            }
                        }
                    }
                    else
                    {
                        return(true);
                    }
                }
            }
            return(false);
        }