Example #1
0
        public Product(
                TenantId tenantId,
                ProductId productId,
                ProductOwnerId productOwnerId,
                string name,
                string description,
                DiscussionAvailability discussionAvailability)
        {
            this.TenantId = tenantId; // must precede productOwnerId for compare
            this.Description = description;
            this.Discussion = ProductDiscussion.FromAvailability(discussionAvailability);
            this.DiscussionInitiationId = null;
            this.Name = name;
            this.ProductId = productId;
            this.ProductOwnerId = productOwnerId; // TODO: validation currently missing

            DomainEventPublisher
                .Instance
                .Publish(new ProductCreated(
                        this.TenantId,
                        this.ProductId,
                        this.ProductOwnerId,
                        this.Name,
                        this.Description,
                        this.Discussion.Availability));
        }
        public void ChangeTeamMemberEmailAddress(ChangeTeamMemberEmailAddressCommand command)
        {
            var tenantId = new TenantId(command.TenantId);
            ApplicationServiceLifeCycle.Begin();
            try
            {
                var productOwner = this.productOwnerRepository.Get(tenantId, command.Username);
                if (productOwner != null)
                {
                    productOwner.ChangeEmailAddress(command.EmailAddress, command.OccurredOn);
                    this.productOwnerRepository.Save(productOwner);
                }

                var teamMember = this.teamMemberRepository.Get(tenantId, command.Username);
                if (teamMember != null)
                {
                    teamMember.ChangeEmailAddress(command.EmailAddress, command.OccurredOn);
                    this.teamMemberRepository.Save(teamMember);
                }

                ApplicationServiceLifeCycle.Success();
            }
            catch (Exception ex)
            {
                ApplicationServiceLifeCycle.Fail(ex);
            }
        }
 public ProductDiscussionInitiated(TenantId tenantId, ProductId productId, ProductDiscussion productDiscussion)
 {
     this.EventVersion = 1;
     this.OccurredOn = DateTime.Now;
     this.ProductDiscussion = productDiscussion;
     this.ProductId = productId;
     this.TenantId = tenantId;
 }
Example #4
0
        public Team(TenantId tenantId, string name, ProductOwner productOwner = null)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "The tenantId must be provided.");

            this.tenantId = tenantId;
            this.Name = name;
            if (productOwner != null)
                this.ProductOwner = productOwner;
            this.teamMembers = new HashSet<TeamMember>();
        }
 public ProductOwner(
     TenantId tenantId,
     string username,
     string firstName,
     string lastName,
     string emailAddress,
     DateTime initializedOn)
     : base(tenantId, username, firstName, lastName, emailAddress, initializedOn)
 {
 }
        public void CommitBacklogItemToSprint(CommitBacklogItemToSprintCommand command)
        {
            var tenantId = new TenantId(command.TenantId);
            var sprint = this.sprintRepository.Get(tenantId, new SprintId(command.SprintId));
            var backlogItem = this.backlogItemRepository.Get(tenantId, new BacklogItemId(command.BacklogItemId));

            sprint.Commit(backlogItem);

            this.sprintRepository.Save(sprint);
        }
 public ProductBacklogItem(
     TenantId tenantId,
     ProductId productId,
     BacklogItemId backlogItem,
     int ordering)
 {
     this.BacklogItemId = backlogItem;
     this.Ordering = ordering;
     this.ProductId = productId;
     this.TenantId = tenantId;
 }
        public void RetryProductDiscussionRequest(RetryProductDiscussionRequestCommand command)
        {
            var processId = ProcessId.ExistingProcessId(command.ProcessId);
            var tenantId = new TenantId(command.TenantId);
            var product = this.productRepository.GetByDiscussionInitiationId(tenantId, processId.Id);
            if (product == null)
                throw new InvalidOperationException(
                    string.Format("Unknown product of tenant id: {0} and discussion initiation id: {1}.", command.TenantId, command.ProcessId));

            RequestProductDiscussionFor(product);
        }
Example #9
0
 protected Member(
     TenantId tenantId,
     string username,
     string firstName,
     string lastName,
     string emailAddress,
     DateTime initializedOn)
 {
     this.EmailAddress = emailAddress;
     this.Enabled = true;
     this.FirstName = firstName;
     this.LastName = lastName;
     this.ChangeTracker = new MemberChangeTracker(initializedOn, initializedOn, initializedOn);
 }
Example #10
0
        public Member(
            TenantId tenantId,
            string userName,
            string firstName,
            string lastName,
            string emailAddress,
            DateTime initializedOn)
        {
            AssertionConcern.AssertArgumentNotNull(tenantId, "The tenant id must be provided.");

            this.TenantId = tenantId;
            this.EmailAddress = emailAddress;
            this.Enabled = true;
            this.FirstName = firstName;
            this.LastName = lastName;
            this.changeTracker = new MemberChangeTracker(initializedOn, initializedOn, initializedOn);
        }
 public ProductDiscussionRequested(
     TenantId tenantId,
     ProductId productId,
     ProductOwnerId productOwnerId,
     string name,
     string description,
     bool requestingDiscussion)
 {
     this.Description = description;
     this.EventVersion = 1;
     this.Name = name;
     this.OccurredOn = DateTime.Now;
     this.ProductId = productId;
     this.ProductOwnerId = productOwnerId;
     this.RequestingDiscussion = requestingDiscussion;
     this.TenantId = tenantId;
 }
Example #12
0
 public ProductCreated(
     TenantId tenantId,
     ProductId productId,
     ProductOwnerId productOwnerId,
     string name,
     string description,
     DiscussionAvailability availability)
 {
     this.Availability = availability;
     this.Description = description;
     this.EventVersion = 1;
     this.Name = name;
     this.OccurredOn = DateTime.Now;
     this.ProductId = productId;
     this.ProductOwnerId = productOwnerId;
     this.TenantId = tenantId;
 }
 public ProductSprintScheduled(
     TenantId tenantId,
     ProductId productId,
     SprintId sprintId,
     string name,
     string goals,
     DateTime starts,
     DateTime ends)
 {
     this.Ends = ends;
     this.EventVersion = 1;
     this.Goals = goals;
     this.Name = name;
     this.OccurredOn = DateTime.Now;
     this.ProductId = productId;
     this.SprintId = sprintId;
     this.Starts = starts;
     this.TenantId = tenantId;
 }
 public ProductBacklogItemPlanned(
     TenantId tenantId,
     ProductId productId,
     BacklogItemId backlogItemId,
     string summary,
     string category,
     BacklogItems.BacklogItemType backlogItemType,
     BacklogItems.StoryPoints storyPoints)
 {
     this.BacklogItemId = backlogItemId;
     this.Category = category;
     this.EventVersion = 1;
     this.OccurredOn = DateTime.Now;
     this.ProductId = productId;
     this.StoryPoints = storyPoints;
     this.Summary = summary;
     this.TenantId = tenantId;
     this.Type = backlogItemType;
 }
 public BacklogItem(
     TenantId tenantId,
     ProductId productId,
     BacklogItemId backlogItemId,
     string summary,
     string category,
     BacklogItemType type,
     BacklogItemStatus backlogItemStatus,
     StoryPoints storyPoints)
 {
     this.BacklogItemId = backlogItemId;
     this.Category = category;
     this.ProductId = productId;
     this.Status = backlogItemStatus;
     this.StoryPoints = storyPoints;
     this.Summary = summary;
     this.TenantId = tenantId;
     this.Type = type;
 }
 public ProductReleaseScheduled(
     TenantId tenantId,
     ProductId productId,
     ReleaseId releaseId,
     string name,
     string description,
     DateTime starts,
     DateTime ends)
 {
     this.Description = description;
     this.Ends = ends;
     this.EventVersion = 1;
     this.Name = name;
     this.OccurredOn = DateTime.Now;
     this.ProductId = productId;
     this.ReleaseId = releaseId;
     this.Starts = starts;
     this.TenantId = tenantId;
 }
Example #17
0
 public Task(
     TenantId tenantId, 
     BacklogItemId backlogItemId, 
     TaskId taskId, 
     TeamMember teamMember, 
     string name, 
     string description, 
     int hoursRemaining, 
     TaskStatus status)
 {
     this.TenantId = tenantId;
     this.BacklogItemId = backlogItemId;
     this.TaskId = taskId;
     this.Volunteer = teamMember.TeamMemberId;
     this.Name = name;
     this.Description = description;
     this.HoursRemaining = hoursRemaining;
     this.Status = status;
     this.estimationLog = new List<EstimationLogEntry>();
 }
Example #18
0
        public Release(
            TenantId tenantId,
            ProductId productId,
            ReleaseId releaseId,
            string name,
            string description,
            DateTime begins,
            DateTime ends)
        {
            if (ends.Ticks < begins.Ticks)
                throw new InvalidOperationException("Release must not end before it begins.");

            this.Begins = begins;
            this.Description = description;
            this.Ends = ends;
            this.Name = name;
            this.ProductId = productId;
            this.ReleaseId = releaseId;
            this.TenantId = tenantId;
            this.backlogItems = new HashSet<ScheduledBacklogItem>();
        }
 public void EnableTeamMember(EnableTeamMemberCommand command)
 {
     var tenantId = new TenantId(command.TenantId);
     ApplicationServiceLifeCycle.Begin();
     try
     {
         var teamMember = this.teamMemberRepository.Get(tenantId, command.Username);
         if (teamMember != null)
         {
             teamMember.Enable(command.OccurredOn);
         }
         else
         {
             teamMember = new TeamMember(tenantId, command.Username, command.FirstName, command.LastName, command.EmailAddress, command.OccurredOn);
             this.teamMemberRepository.Save(teamMember);
         }
         ApplicationServiceLifeCycle.Success();
     }
     catch (Exception ex)
     {
         ApplicationServiceLifeCycle.Fail(ex);
     }
 }
Example #20
0
        public Sprint(
            TenantId tenantId,
            ProductId productId,
            SprintId sprintId,
            string name,
            string goals,
            DateTime begins,
            DateTime ends)
        {
            if (ends.Ticks < begins.Ticks)
            {
                throw new InvalidOperationException("Sprint must not end before it begins.");
            }

            this.BacklogItems = new HashSet<CommittedBacklogItem>();
            this.Begins = begins;
            this.Goals = goals;
            this.Ends = ends;
            this.Name = name;
            this.ProductId = productId;
            this.SprintId = sprintId;
            this.TenantId = tenantId;
        }
 public void DisableProductOwner(DisableProductOwnerCommand command)
 {
     var tenantId = new TenantId(command.TenantId);
     ApplicationServiceLifeCycle.Begin();
     try
     {
         var productOwner = this.productOwnerRepository.Get(tenantId, command.Username);
         if (productOwner != null)
         {
             productOwner.Disable(command.OccurredOn);
             this.productOwnerRepository.Save(productOwner);
         }
         ApplicationServiceLifeCycle.Success();
     }
     catch (Exception ex)
     {
         ApplicationServiceLifeCycle.Fail(ex);
     }
 }
Example #22
0
 public ProductOwnerId(TenantId tenantId, string id)
     : base(tenantId + ":" + id)
 {
 }
        public void TimeOutProductDiscussionRequest(TimeOutProductDiscussionRequestCommand command)
        {
            ApplicationServiceLifeCycle.Begin();
            try
            {
                var processId = ProcessId.ExistingProcessId(command.ProcessId);

                var tenantId = new TenantId(command.TenantId);

                var product = this.productRepository.GetByDiscussionInitiationId(tenantId, processId.Id);

                SendEmailForTimedOutProcess(product);

                product.FailDiscussionInitiation();

                this.productRepository.Save(product);

                ApplicationServiceLifeCycle.Success();
            }
            catch (Exception ex)
            {
                ApplicationServiceLifeCycle.Fail(ex);
            }
        }
Example #24
0
 public TeamMember(TenantId tenantId, string userName, string firstName, string lastName, string emailAddress, DateTime initializedOn)
     : base(tenantId, userName, firstName, lastName, emailAddress, initializedOn)
 {
 }
        string NewProductWith(string tenantId, string productOwnerId, string name, string description, DiscussionAvailability discussionAvailability)
        {
            var tid = new TenantId(tenantId);
            var productId = default(ProductId);
            ApplicationServiceLifeCycle.Begin();
            try
            {
                productId = this.productRepository.GetNextIdentity();

                var productOwner = this.productOwnerRepository.Get(tid, productOwnerId);

                var product = new Product(tid, productId, productOwner.ProductOwnerId, name, description, discussionAvailability);

                this.productRepository.Save(product);

                ApplicationServiceLifeCycle.Success();
            }
            catch (Exception ex)
            {
                ApplicationServiceLifeCycle.Fail(ex);
            }
            // TODO: handle null properly
            return productId.Id;
        }