Пример #1
0
 public Group(int id)
 {
     sprintList     = new SprintList();
     productBacklog = new ProductBacklog();
     groupId        = id;
     groupMembers   = new List <GroupMember>();
 }
Пример #2
0
        public bool SetActiveSprint(SprintList sprintList)
        {
            try
            {
                var activeSprint = sprintList.currentlyActiveSprint;
                var groupId      = sprintList.groupID;

                var sprintListItem = db.SprintLists.Find(groupId);
                sprintListItem.CurrentlyActiveSprint = activeSprint;

                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Пример #3
0
        public bool SetDurationOfSprints(SprintList sprintList)
        {
            try
            {
                var duration = sprintList.duration;
                var groupId  = sprintList.groupID;

                var sprintListItem = db.SprintLists.Find(groupId);
                sprintListItem.Duration = duration;

                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Пример #4
0
        public bool SetNumberOfSprints(SprintList sprintList)
        {
            try
            {
                var numberOfSprints = sprintList.numberOfSprints;
                var groupId         = sprintList.groupID;

                var sprintListItem = db.SprintLists.Find(groupId);
                var oldValue       = sprintListItem.NumberOfSprints;
                var difference     = numberOfSprints - oldValue;
                sprintListItem.NumberOfSprints = numberOfSprints;

                var edit = Enumerable.Any(db.Sprints, sprint => sprint.GroupId == groupId);
                if (edit == false)
                {
                    for (var i = 1; i <= numberOfSprints; i++)
                    {
                        db.Add(new Models.Sprint
                        {
                            SprintId     = db.Sprints.Count() + i,
                            GroupId      = groupId,
                            SprintNumber = i
                        });
                    }
                }
                else
                {
                    if (difference > 0)
                    {
                        for (var i = oldValue + 1; i <= numberOfSprints; i++)
                        {
                            db.Add(new Models.Sprint
                            {
                                SprintId     = db.Sprints.Count() + i,
                                GroupId      = groupId,
                                SprintNumber = i
                            });
                        }
                    }
                    else if (difference < 0)
                    {
                        for (var i = oldValue; i > numberOfSprints; i--)
                        {
                            var sprintItem =
                                db.Sprints.FirstOrDefault(x => x.GroupId == groupId && x.SprintNumber == i);
                            db.Sprints.Remove(sprintItem);
                        }
                    }
                    else
                    {
                    }
                }

                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
 public bool setSprintNumber(SprintList sprintList)
 {
     return(_groupRepository.SetNumberOfSprints(sprintList));
 }
 public bool setSprintDuration(SprintList sprintList)
 {
     return(_groupRepository.SetDurationOfSprints(sprintList));
 }