예제 #1
0
 private Activity(ActivityStatus status, Description description, EntityId id,
                  EntityId projectId)
 {
     Status      = status;
     Description = description;
     Id          = id;
     ProjectId   = projectId;
 }
예제 #2
0
        public static ActivityStatus From(int status)
        {
            var activity  = new ActivityStatus((Status)status);
            var validator = new ActivityStatusValidator();

            activity.SetValidationResult(validator.Validate(activity));

            return(activity);
        }
        public void ChangeTaskStatus(ActivityStatus newStatus)
        {
            var change = Activity.CombineWithStatus(_entityRoot, newStatus);

            if (change.ValidationResults.IsValid)
            {
                Change(change);
                Raise(ActivityStatusChangedEvent.For(change));
            }
            ValidationResults = change.ValidationResults;
        }
예제 #4
0
        public int CompareTo(ActivityStatus other)
        {
            if (ReferenceEquals(this, other))
            {
                return(0);
            }

            if (ReferenceEquals(null, other))
            {
                return(1);
            }

            return(_status.CompareTo(other._status));
        }
예제 #5
0
 /// <summary>
 ///     used to restore the aggregation
 /// </summary>
 /// <param name="state"></param>
 /// <returns></returns>
 /// <exception cref="ArgumentException"></exception>
 public static Activity FromState(ActivityState state)
 {
     return(Activity.From(Description.From(state.Description), EntityId.From(state.ActivityId),
                          EntityId.From(state.ProjectId), ActivityStatus.From(state.Status)));
 }
예제 #6
0
        public static Activity From(Description description, EntityId entityId, EntityId projectId, ActivityStatus status)
        {
            var activity  = new Activity(status, description, entityId, projectId);
            var validator = new ActivityValidator();

            activity.SetValidationResult(validator.Validate(activity));
            return(activity);
        }
예제 #7
0
 public static Activity CombineWithStatus(Activity current, ActivityStatus status)
 {
     return(From(current.Description, current.Id, current.ProjectId, status));
 }
 /// <summary>
 ///     to register new aggregate as change
 /// </summary>
 /// <param name="descr"></param>
 /// <param name="entityId"></param>
 /// <param name="project"></param>
 /// <param name="status"></param>
 private ActivityAggregationRoot(Description descr, EntityId entityId, Project project, ActivityStatus status)
     : this(Activity.From(descr, entityId, project.Id, status))
 {
 }
 /// <summary>
 ///     creating new aggregation as design by business based on business concepts
 /// </summary>
 /// <param name="descr"></param>
 /// <param name="project"></param>
 /// <param name="entityId"></param>
 /// <returns></returns>
 public static ActivityAggregationRoot CreateFrom(Description descr, EntityId entityId, Project project)
 {
     return(new ActivityAggregationRoot(descr, entityId, project, ActivityStatus.From(1)));
 }