Exemplo n.º 1
0
        private BacklogItem PrepareDefaultItem(Project project, string name, string groupName, int sprintNumber, DefaultItemGroups defaultGroup, ItemOccurrenceContraints constraint)
        {
            // create the new item
            BacklogItem item = new BacklogItem {
                BacklogItemUId       = Guid.NewGuid().ToString(),
                ProjectUId           = project.ProjectUId,
                Name                 = name,
                Description          = null,
                Status               = (short)BacklogItemStatus.ITEM_REQUIRED,
                BusinessPriority     = 1,
                OccurrenceConstraint = (short)constraint,
                SizeFactor           = 0,
                CreateDate           = DateTime.Now
            };

            item.Project = project;
            item.SyncPlannedHoursAndRoles(sprintNumber);

            // assign group
            ICollection <BacklogItemGroup> groups = GetBacklogItemGroups(project.ProjectUId);
            var group = groups.FirstOrDefault(g => g.DefaultGroup == (short)defaultGroup);

            if (group == null)
            {
                group = CreateDefaultGroup(project.ProjectUId, defaultGroup, groupName);
            }
            item.Group    = group;
            item.GroupUId = group.GroupUId;


            // assign size
            ItemSize size = backlogRepository.GetItemSizeByConstraint((short)constraint);

            if (size != null)
            {
                item.ItemSizeUId = size.ItemSizeUId;
                item.SizeFactor  = 1;
                item.Size        = size.Size * item.SizeFactor;

                // tries to set the ideal hour values
                foreach (var h in size.SizeIdealHours)
                {
                    var ph = item.PlannedHours.SingleOrDefault(p => p.Role.RoleShortName.ToLower() == h.RoleShortName.ToLower());
                    if (ph != null)
                    {
                        ph.Hours = h.Hours;
                    }
                }
            }

            return(item);
        }
Exemplo n.º 2
0
        private BacklogItem PrepareDefaultItem(Project project, string name, string groupName, int sprintNumber, DefaultItemGroups defaultGroup, ItemOccurrenceContraints constraint)
        {
            // create the new item
            BacklogItem item = new BacklogItem {
                BacklogItemUId = Guid.NewGuid().ToString(),
                ProjectUId = project.ProjectUId,
                Name = name,
                Description = null,
                Status = (short)BacklogItemStatus.ITEM_REQUIRED,
                BusinessPriority = 1,
                OccurrenceConstraint = (short)constraint,
                SizeFactor = 0,
                CreateDate = DateTime.Now
            };
            item.Project = project;
            item.SyncPlannedHoursAndRoles(sprintNumber);

            // assign group
            ICollection<BacklogItemGroup> groups = GetBacklogItemGroups(project.ProjectUId);
            var group = groups.FirstOrDefault(g => g.DefaultGroup == (short)defaultGroup);
            if (group == null)
                group = CreateDefaultGroup(project.ProjectUId, defaultGroup, groupName);
            item.Group = group;
            item.GroupUId = group.GroupUId;

            // assign size
            ItemSize size = backlogRepository.GetItemSizeByConstraint((short)constraint);
            if (size != null) {
                item.ItemSizeUId = size.ItemSizeUId;
                item.SizeFactor = 1;
                item.Size = size.Size * item.SizeFactor;
            }

            return item;
        }
Exemplo n.º 3
0
        internal BacklogItem PrepareNewBacklogItem(string name, ItemOccurrenceContraints occurrenceConstraint, int? sprintNumber)
        {
            // if no sprint number was informed, tries to fit it at the avaiable sprints
            if (sprintNumber == null)
                sprintNumber = GetSprintNumberForInsert();

            // create the new item
            BacklogItem newItem = new BacklogItem {
                BacklogItemUId = Guid.NewGuid().ToString(),
                ProjectUId = Project.ProjectUId,
                Project = Project,
                Name = name,
                Description = null,
                Status = (short)BacklogItemStatus.ITEM_REQUIRED,
                BusinessPriority = NextBusinessPriority,
                OccurrenceConstraint = (short)occurrenceConstraint,
                SizeFactor = 0,
                CreateDate = DateTime.Now
            };

            SetItemGroupAndSize(newItem);

            // if is a SCRUM MASTER plan it at the sprint
            // if is a PRODUCT OWNER than sprintNumber will be null
            if(Project.HasPermission(authorizator.SignedMemberProfile.MemberUId, PermissionSets.SCRUM_MASTER))
                newItem.SyncPlannedHoursAndRoles(sprintNumber);

            return newItem;
        }
Exemplo n.º 4
0
        internal BacklogItem DuplicateBacklogItem(BacklogItem fromItem)
        {
            int? sprintNumber = GetSprintNumberForInsert();

            // create item
            BacklogItem newItem = new BacklogItem {
                BacklogItemUId = Guid.NewGuid().ToString(),
                ProjectUId = Project.ProjectUId,
                Project = Project,
                Name = fromItem.Name,
                Description = fromItem.Description,
                Status = fromItem.Status,
                BusinessPriority = NextBusinessPriority,
                OccurrenceConstraint = fromItem.OccurrenceConstraint,
                SizeFactor = fromItem.SizeFactor,
                Size = fromItem.Size,
                ItemSizeUId = fromItem.ItemSizeUId,
                CancelReason = fromItem.CancelReason,
                DeliveryDate = fromItem.DeliveryDate,
                StartedAt = fromItem.StartedAt,
                FinishedAt = fromItem.FinishedAt,
                IssueType = fromItem.IssueType,
                CreateDate = DateTime.Now
            };

            // copy planned hours
            if (fromItem.ProjectUId == Project.ProjectUId)
                DuplicateBacklogItemHoursSameProject(newItem, fromItem, sprintNumber);
            else
                DuplicateBacklogItemHours(newItem, fromItem, sprintNumber);

            newItem.SyncPlannedHoursAndRoles(sprintNumber);

            return newItem;
        }
        private void SaveBacklogItem(Action afterSave)
        {
            executor.StartBackgroundTask(
                () => {
                    // if the planned hours was not changed, dont update it
                    if (!Item.HasTheSameHours(oldItem))
                        backlogService.UpdateBacklogItem(Item.BacklogItemUId, Item);
                    else
                        backlogService.UpdateBacklogItemIgnoringHours(Item.BacklogItemUId, Item);
                },
                () => {
                    RefreshUI(); // need this to refresh item in the list

                    aggregator.Publish<BacklogItem[]>(ScrumFactoryEvent.BacklogItemsChanged, new BacklogItem[] { this.Item });

                    // clean the original values
                    oldItem = item.Clone();
                    oldItem.Project = item.Project;
                    oldItem.SyncPlannedHoursAndRoles();

                    //oldItem = null;

                    if(afterSave!=null)
                        afterSave.Invoke();

                });
        }
Exemplo n.º 6
0
        private void ShowItem(BacklogItem item)
        {
            if (item==null)
                return;

            executor.StartBackgroundTask<Project>(
               () => { return projectsService.GetProject(item.ProjectUId); },
               p => {
                   item.Project = p;
                   item.SyncPlannedHoursAndRoles();
                   dialogs.SetBackTopMenu();
                   aggregator.Publish<BacklogItem>(ScrumFactoryEvent.ShowItemDetail, item);
               });
        }
Exemplo n.º 7
0
        private void AddJob()
        {
            if (String.IsNullOrEmpty(NewTicketName))
                return;

            if (NewTicketProject == null)
                return;

            // create the new item
            BacklogItem newItem = new BacklogItem {
                BacklogItemUId = Guid.NewGuid().ToString(),
                ProjectUId = NewTicketProject.ProjectUId,
                Name = NewTicketName,
                Description = null,
                Status = (short)BacklogItemStatus.ITEM_REQUIRED,
                BusinessPriority = 0,
                OccurrenceConstraint = 1,
                SizeFactor = 1,
                CreateDate = DateTime.Now
            };

            // save its
            executor.StartBackgroundTask(
                () => {

                    // needs to get the project here to get its roles
                    Project project = projectsService.GetProject(newItem.ProjectUId);

                    newItem.Project = project;
                    newItem.SyncPlannedHoursAndRoles(1);

                    ICollection<BacklogItemGroup> groups = backlogService.GetBacklogItemGroups(project.ProjectUId);
                    BacklogItemGroup group = groups.FirstOrDefault(g => g.DefaultGroup == (short)DefaultItemGroups.DEV_GROUP);
                    if (group != null)
                        newItem.GroupUId = group.GroupUId;

                    backlogService.AddBacklogItem(newItem);
                },
                () => {
                    BacklogItemViewModel vm = new BacklogItemViewModel();
                    vm.Init(backlogService, executor, aggregator, authorizator, newTicketProject, newItem);

                    ICollection<BacklogItemViewModel> tickets = ticketsSource.Source as ICollection<BacklogItemViewModel>;
                    tickets.Add(vm);

                    ((IEditableCollectionView)ticketsSource.View).EditItem(vm);
                    ((IEditableCollectionView)ticketsSource.View).CommitEdit();

                    vm.NotifyAdded();

                    NewTicketProject = null;
                    NewTicketName = String.Empty;

                });
        }