Example #1
0
        public void UpdateItemSizeOccurrenceContraint(string itemSizeUId, string constraint)
        {
            authorizationService.VerifyFactoryOwner();
            ItemOccurrenceContraints c = (ItemOccurrenceContraints)Enum.Parse(typeof(ItemOccurrenceContraints), constraint);

            backlogRepository.UpdateItemSizeOccurrenceContraint(itemSizeUId, c);
        }
Example #2
0
        public void UpdateItemSizeOccurrenceContraint(string itemSizeUId, ItemOccurrenceContraints constraint)
        {
            // gets the item and set the constraint
            ItemSize newSize = GetItemSize(itemSizeUId);

            if (newSize == null)
            {
                return;
            }

            // now seacrh for the olditem with the same constraint and clean it
            using (var context = new ScrumFactoryEntities(this.connectionString)) {
                ItemSize oldSize = context.ItemSizes.SingleOrDefault(z => z.OccurrenceConstraint == (int)constraint);
                if (oldSize != null)
                {
                    oldSize.OccurrenceConstraint = (int)ItemOccurrenceContraints.DEVELOPMENT_OCC;
                }

                context.AttachTo("ItemSizes", newSize);
                newSize.OccurrenceConstraint = (int)constraint;

                context.SaveChanges();
            }
        }
Example #3
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;
        }
        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;
        }
        public void UpdateItemSizeOccurrenceContraint(string itemSizeUId, ItemOccurrenceContraints constraint)
        {
            // gets the item and set the constraint
            ItemSize newSize = GetItemSize(itemSizeUId);
            if (newSize == null)
                return;

            // now seacrh for the olditem with the same constraint and clean it
            using (var context = new ScrumFactoryEntities(this.connectionString)) {
                ItemSize oldSize = context.ItemSizes.SingleOrDefault(z => z.OccurrenceConstraint == (int)constraint);
                if (oldSize != null)
                    oldSize.OccurrenceConstraint = (int)ItemOccurrenceContraints.DEVELOPMENT_OCC;

                context.AttachTo("ItemSizes", newSize);
                newSize.OccurrenceConstraint = (int)constraint;

                context.SaveChanges();
            }
        }
Example #6
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);
        }
        private void SetItemOccurrenceContraint(SizeViewModel sizeVM, ItemOccurrenceContraints constraint)
        {
            executor.StartBackgroundTask(
                () => { backlogService.UpdateItemSizeOccurrenceContraint(sizeVM.ItemSize.ItemSizeUId, constraint.ToString()); },
                () => {
                    // remove the previous planning/delivery selection
                    if(constraint==ItemOccurrenceContraints.PLANNING_OCC)
                        PlanningSize.OccurrenceConstraint = (int) ItemOccurrenceContraints.DEVELOPMENT_OCC;
                    if (constraint == ItemOccurrenceContraints.DELIVERY_OCC)
                        DeliverySize.OccurrenceConstraint = (int)ItemOccurrenceContraints.DEVELOPMENT_OCC;

                    // mark the new one
                    sizeVM.OccurrenceConstraint = (int)constraint;
                });
        }