Beispiel #1
0
        public UserStory LoadUserStory(int storyId)
        {
            var exist = db.Tasks.Any(x => x.StoryId == storyId);

            if (exist)
            {
                var list      = db.Tasks.Where(x => x.StoryId == storyId);
                var userStory = new UserStory();
                userStory.storyId = storyId;

                foreach (var taskDB in list)
                {
                    var task = new Tasks();
                    task.TaskMessage = taskDB.TaskMessage;
                    task.TaskId      = taskDB.TaskId;
                    task.StoryPoints = taskDB.StoryPoint;
                    task.StoryId     = storyId;
                    task.Completed   = taskDB.Completed;
                    userStory.addTask(task);
                }

                return(userStory);
            }

            return(null);
        }
Beispiel #2
0
        public Common.ProductBacklog LoadProductBacklog(int groupId)
        {
            var exist = db.UserStories.Any(x => x.GroupId == groupId);

            if (exist)
            {
                var list = db.UserStories.Where(x => x.GroupId == groupId && x.SprintId == -1);
                Common.ProductBacklog productBacklog = new Common.ProductBacklog {
                    groupId = groupId
                };
                foreach (var userStoryDb in list)
                {
                    var userStory = new UserStory();
                    userStory.storyId   = userStoryDb.StoryId;
                    userStory.groupId   = productBacklog.groupId;
                    userStory.completed = 0;
                    if (userStoryDb.Completed)
                    {
                        userStory.completed = 1;
                    }

                    userStory.currentlyActive = userStoryDb.CurrentlyActive;
                    userStory.storyPoint      = userStoryDb.StoryPoint;
                    userStory.userStory       = userStoryDb.Story;
                    productBacklog.addUserStory(userStory);
                }

                return(productBacklog);
            }
            else
            {
                return(null);
            }
        }
Beispiel #3
0
        public bool AddUserStoryToSprint(UserStory userStory)
        {
            try
            {
                var groupId = userStory.groupId;
                var currentlyActiveSprint = db.SprintLists.Find(groupId).CurrentlyActiveSprint;
                var exist = db.Sprints
                            .Any(x => x.GroupId == groupId && x.SprintNumber == currentlyActiveSprint);
                if (exist)
                {
                    var sprintId = db.Sprints
                                   .FirstOrDefault(x => x.GroupId == groupId && x.SprintNumber == currentlyActiveSprint).SprintId;
                    var userStoryItem = db.UserStories.FirstOrDefault(x =>
                                                                      x.Story.Equals(userStory.userStory) && x.StoryPoint == userStory.storyPoint &&
                                                                      x.GroupId == userStory.groupId);
                    userStoryItem.SprintId = sprintId;
                }


                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Beispiel #4
0
        public bool AddStory(UserStory userStory)
        {
            try
            {
                var storyId         = db.UserStories.Count() + 1;
                var groupId         = userStory.groupId;
                var message         = userStory.userStory;
                var storyPoints     = userStory.storyPoint;
                var currentlyActive = userStory.currentlyActive;
                var completed       = false;
                completed = userStory.completed == 1;

                db.Add(new Models.UserStory
                {
                    StoryId         = storyId,
                    GroupId         = groupId,
                    Story           = message,
                    SprintId        = -1,
                    StoryPoint      = storyPoints,
                    CurrentlyActive = currentlyActive,
                    Completed       = completed
                });
                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Beispiel #5
0
        public bool RemoveUserStoryFromSprint(UserStory userStory)
        {
            try
            {
                var storyId       = userStory.storyId;
                var userStoryItem = db.UserStories.Find(storyId);
                userStoryItem.SprintId = -1;

                db.SaveChanges();
                return(true);
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
                return(false);
            }
        }
Beispiel #6
0
        public Sprint LoadSprintBacklog(int sprintNumber, int groupId)
        {
            Console.WriteLine("LOAD SPRINT BACKLOG");
            var sprintId =
                db.Sprints.FirstOrDefault(x => x.GroupId == groupId && x.SprintNumber == sprintNumber).SprintId;
            bool exist = db.UserStories.Any(x => x.SprintId == sprintId);

            if (exist)
            {
                Sprint sprint = new Sprint(sprintNumber);
                sprint.groupId      = groupId;
                sprint.sprintId     = sprintId;
                sprint.sprintNumber = sprintNumber;
                var list = db.UserStories.Where(x => x.SprintId == sprintId);
                foreach (var userStoryDb in list)
                {
                    var userStory = new UserStory();
                    userStory.storyId   = userStoryDb.StoryId;
                    userStory.groupId   = sprint.groupId;
                    userStory.completed = 0;
                    if (userStoryDb.Completed)
                    {
                        userStory.completed = 1;
                    }

                    userStory.currentlyActive = userStoryDb.CurrentlyActive;
                    userStory.storyPoint      = userStoryDb.StoryPoint;
                    userStory.userStory       = userStoryDb.Story;
                    sprint.AddUserStory(userStory);
                }

                return(sprint);
            }
            else
            {
                Console.WriteLine("RETURN NULL?");
                return(null);
            }
        }
 public bool removeUserStoryFromSprint(UserStory userStory)
 {
     return(_groupRepository.RemoveUserStoryFromSprint(userStory));
 }
 public bool addUserStoryToSprint(UserStory userStory)
 {
     return(_groupRepository.AddUserStoryToSprint(userStory));
 }
 public bool AddStory(UserStory userStory)
 {
     return(_groupRepository.AddStory(userStory));
 }
Beispiel #10
0
 public void AddUserStory(UserStory userStory)
 {
     sprintStories.Add(userStory);
 }
 public void addUserStory(UserStory e)
 {
     userStories.Add(e);
 }
 public void removeUserStory(UserStory e)
 {
     userStories.Remove(e);
 }