public ConditionalActivityBinder(Event @event, StateMachineAsyncCondition <TInstance> condition, EventActivities <TInstance> thenActivities, EventActivities <TInstance> elseActivities) { _thenActivities = thenActivities; _elseActivities = elseActivities; _condition = condition; _event = @event; }
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); }
public void RemoveActivity(Guid eventId) { var activity = EventActivities.SingleOrDefault(e => e.EventId == eventId); if (activity is null) { return; } EventActivities.Remove(activity); }
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); }
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; }
public bool IsRegisteredOnEvent(Guid eventId) { return(EventActivities .SingleOrDefault(x => x.EventId == eventId) is not null); }
public CatchActivityBinder(Event @event, EventActivities <TInstance> activities) { _event = @event; _activities = activities; }