Example #1
0
        public void DeleteProject(int id)
        {
            // Get the project:

            Project pro = (from p in _repo.Query <Project>()
                           where p.Id == id
                           select p).FirstOrDefault();

            // Get the project's sprints:

            List <Sprint> sprintsToBeDeleted = (from s in _repo.Query <Sprint>()
                                                where s.Project.Id == id
                                                select s).ToList();

            // Delete each sprint's requirements:

            foreach (Sprint sprint in sprintsToBeDeleted)
            {
                // Get a list of all the requirements (stories):
                List <Requirement> requirementsToBeDeleted = (from r in _repo.Query <Requirement>()
                                                              where r.Sprint.Id == sprint.Id
                                                              select r).ToList();

                // Delete each requirement's (story's) tasks and then the story:

                foreach (Requirement requirement in requirementsToBeDeleted)
                {
                    // Get a list of all the tasks:
                    List <Thask> tasksToBeDeleted = (from t in _repo.Query <Thask>()
                                                     where t.Story.Id == requirement.Id
                                                     select t).ToList();

                    // loop through the tasks and delete them:
                    foreach (Thask task in tasksToBeDeleted)
                    {
                        _repo.Delete(task);
                    }

                    // and then delete the requirement (story):

                    _repo.Delete(requirement);
                }
            }

            // Now delete the project's sprints:

            foreach (Sprint sprint in sprintsToBeDeleted)
            {
                _repo.Delete(sprint);
            }

            // And finally delete the project:

            _repo.Delete(pro);
        }
Example #2
0
        public void DeleteRequirement(int id)
        {
            Requirement requirementToBeDeleted = (from r in _repo.Query <Requirement>()
                                                  where r.Id == id
                                                  select r).FirstOrDefault();

            List <Thask> tasksToBeDeleted = (from t in _repo.Query <Thask>()
                                             where t.Story.Id == id
                                             select t).ToList();

            foreach (Thask task in tasksToBeDeleted)
            {
                _repo.Delete(task);
            }

            _repo.Delete(requirementToBeDeleted);
        }
Example #3
0
        public void DeleteStatus(int id)
        {
            Status statusToBeDeleted = (from s in _repo.Query <Status>()
                                        where s.Id == id
                                        select s).FirstOrDefault();

            _repo.Delete(statusToBeDeleted);
        }
Example #4
0
        public void DeleteTask(int id)
        {
            Thask taskToBeDeleted = (from t in _repo.Query <Thask>()
                                     where t.id == id
                                     select t).FirstOrDefault();

            _repo.Delete(taskToBeDeleted);
        }
Example #5
0
        public void DeleteSprint(int id)
        {
            Sprint sprintToBeDeleted = (from s in _repo.Query <Sprint>()
                                        where s.Id == id
                                        select s).FirstOrDefault();

            // get a list of all the sprint's requirements(stories):
            List <Requirement> requirementsToBeDeleted = (from r in _repo.Query <Requirement>()
                                                          where r.Sprint.Id == id
                                                          select r).ToList();

            // get a list of all the requirement's (storie's) tasks:
            List <Thask> tasksToBeDeleted = (from s in _repo.Query <Sprint>()
                                             join r in _repo.Query <Requirement>() on s.Id equals r.Sprint.Id
                                             join t in _repo.Query <Thask>() on r.Id equals t.Story.Id
                                             where s.Id == id
                                             select new Thask
            {
                id = t.id,
                TaskName = t.TaskName,
                Description = t.Description,
                PointValue = t.PointValue
            }).ToList();

            // loop through the list of tasks and delete them:
            foreach (Thask task in tasksToBeDeleted)
            {
                _repo.Delete(task);
            }

            // loop through the list of requirements (stories) and delete them:
            foreach (Requirement requirement in requirementsToBeDeleted)
            {
                _repo.Delete(requirement);
            }

            // finally delete the sprint:
            _repo.Delete(sprintToBeDeleted);
        }