public ConditionalActivityBinder(Event @event, StateMachineAsyncCondition <TInstance> condition,
                                  EventActivities <TInstance> thenActivities, EventActivities <TInstance> elseActivities)
 {
     _thenActivities = thenActivities;
     _elseActivities = elseActivities;
     _condition      = condition;
     _event          = @event;
 }
示例#2
0
 public void AddToActivities(Guid eventId, string userRole, string activityStatus)
 {
     EventActivities.Add(new UserEventActivity
     {
         EventId = eventId,
         Role    = userRole,
         Status  = activityStatus
     });
 }
        private Behavior <TInstance> GetBehavior(EventActivities <TInstance> activities)
        {
            var catchBuilder = new CatchBehaviorBuilder <TInstance>();

            foreach (var activity in activities.GetStateActivityBinders())
            {
                activity.Bind(catchBuilder);
            }
            return(catchBuilder.Behavior);
        }
示例#4
0
        public void RemoveActivity(Guid eventId)
        {
            var activity = EventActivities.SingleOrDefault(e => e.EventId == eventId);

            if (activity is null)
            {
                return;
            }
            EventActivities.Remove(activity);
        }
示例#5
0
        public void ChangeActivityStatus(Guid eventId, string activityStatus)
        {
            var activity = EventActivities.SingleOrDefault(e => e.EventId == eventId);

            if (activity is null)
            {
                throw new DomainException(DomainExceptionMessage.Event.UserNotRegisteredForEvent);
            }
            activity.Status = activityStatus;
        }
        static Behavior <TInstance> GetBehavior(EventActivities <TInstance> activities)
        {
            var builder = new ActivityBehaviorBuilder <TInstance>();

            foreach (var activity in activities.GetStateActivityBinders())
            {
                activity.Bind(builder);
            }

            return(builder.Behavior);
        }
示例#7
0
        public bool CanRegisterOnEvent(Guid eventId)
        {
            var eventActivity = EventActivities
                                .SingleOrDefault(x => x.EventId == eventId);

            if (eventActivity is null)
            {
                return(true);
            }
            if (eventActivity.Status == EventActivityStatus.Left)
            {
                return(true);
            }
            return(false);
        }
 public ConditionalActivityBinder(Event @event, StateMachineCondition <TInstance> condition,
                                  EventActivities <TInstance> thenActivities, EventActivities <TInstance> elseActivities)
     : this(@event, context => Task.FromResult(condition(context)), thenActivities, elseActivities)
 {
 }
 public ConditionalActivityBinder(Event @event, StateMachineCondition <TInstance> condition, EventActivities <TInstance> activities)
 {
     _activities = activities;
     _condition  = condition;
     _event      = @event;
 }
示例#10
0
 public bool IsRegisteredOnEvent(Guid eventId)
 {
     return(EventActivities
            .SingleOrDefault(x => x.EventId == eventId) is not null);
 }
示例#11
0
 public CatchActivityBinder(Event @event, EventActivities <TInstance> activities)
 {
     _event      = @event;
     _activities = activities;
 }