Esempio n. 1
0
        static void Main(string[] args)
        {
            var tarea1 = new Tarea();

            tarea1.Estimacion = 1;
            tarea1.Dificultad = Dificultad.complicada;
            Console.WriteLine("Cant estimacion: " + tarea1.Estimacion + ", dificultad: " + tarea1.Dificultad + ", estimacionConDesvio: " + tarea1.CalcularEstimacionDesviada());

            var tarea2 = new Tarea();

            tarea2.Estimacion = 13;
            tarea2.Dificultad = Dificultad.facil;
            Console.WriteLine("Cant estimacion: " + tarea2.Estimacion + ", dificultad: " + tarea2.Dificultad + ", estimacionConDesvio: " + tarea2.CalcularEstimacionDesviada());

            var tarea3 = new Tarea();

            tarea3.Estimacion = 5;
            tarea3.Dificultad = Dificultad.superComplicada;
            Console.WriteLine("Cant estimacion: " + tarea3.Estimacion + ", dificultad: " + tarea3.Dificultad + ", estimacionConDesvio: " + tarea3.CalcularEstimacionDesviada());

            var backlog = new SprintBacklog();

            backlog.AgregarTarea(tarea1);
            backlog.AgregarTarea(tarea2);
            backlog.AgregarTarea(tarea3);

            Console.WriteLine("Total de horas Sprint: " + backlog.CalcularHorasSprint());

            var proyecto = new ProductBacklog();

            proyecto.AgregarSprint(backlog);

            Console.WriteLine("Total de horas Proyecto: " + proyecto.CalcularHorasProyecto());
            Console.ReadKey();
        }
Esempio n. 2
0
        public async Task <IActionResult> PostSprint([FromRoute] int productId, [FromBody] SprintBacklog sprint)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (sprint.ProductId != productId)
            {
                return(BadRequest());
            }

            var userId  = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value);
            var product = await productService.GetProductById(productId);

            if (product == null)
            {
                return(NotFound(new { message = "Product not found." }));
            }

            if (product.Owner.Id != userId)
            {
                return(Forbid());
            }

            var savedSprint = await sprintService.SaveSprint(sprint);

            return(CreatedAtAction("PostSprint", new { prdouctId = productId }, savedSprint));
        }
Esempio n. 3
0
        public async Task <BacklogDTO> SaveSprint(SprintBacklog sprintBacklog)
        {
            sprintBacklog.Id = 0;
            await backlogRepository.SaveBacklog(sprintBacklog);

            return(await GetBacklogById(sprintBacklog.Id));
        }
Esempio n. 4
0
        public void UpdatePlannedTasks(SprintBacklog backlog)
        {
            var sprintIdentity = backlog.SprintId;

            if (sprintIdentity.IsBlankIdentity())
            {
                throw CreateInvalidEntityException();
            }

            var entity = _sprintCollection.Find(x => x.Id == sprintIdentity.ToPersistenceIdentity()).FirstOrDefault();

            if (entity == null)
            {
                throw CreateEntityNotFoundException(sprintIdentity);
            }

            var updateDefinition = Builders <MSprint> .Update
                                   .Set(x => x.PlannedTasks, backlog.Stories.Select(x => x.ToPersistenceIdentity()));

            var result = _sprintCollection.UpdateOne(x => x.Id == sprintIdentity.ToPersistenceIdentity(), updateDefinition);

            if (result.MatchedCount != 1)
            {
                throw CreateEntityNotFoundException(sprintIdentity);
            }
        }
Esempio n. 5
0
 /// <summary>
 /// Bruges til at restte viewet tilbage til normalen så der ikke står noget i input felterne
 /// </summary>
 public void SprintReset()
 {
     SprintBacklog.Clear();
     Backlog.Clear();
     Sprint_GoalVM = "";
     SletState     = "Collapsed";
     CreateCommand = new RelayCommand(Create);
     Load();
 }
Esempio n. 6
0
        public async Task <BacklogDTO> UpdateSprint(SprintBacklog sprintBacklog)
        {
            var sprintToUpdate = backlogRepository.GetBacklogById(sprintBacklog.Id);

            sprintToUpdate.StartTime   = sprintBacklog.StartTime;
            sprintToUpdate.EndTime     = sprintBacklog.EndTime;
            sprintToUpdate.Description = sprintBacklog.Description;
            await backlogRepository.UpdateBacklog(sprintToUpdate);

            return(await GetBacklogById(sprintBacklog.Id));
        }
Esempio n. 7
0
        /// <summary>
        /// Tilføjer en story til et sprint. Når man tilføjer en story til et sprint vil den blive fjernet fra backloggen.
        /// </summary>
        /// <param name="name">String name er navnet på det listviewet den skal flyttes hen til </param>

        public void MoveStory(string name)
        {
            switch (name)
            {
            case "Backlog":
                Backlog.Add(DragStory);
                SprintBacklog.Remove(DragStory);

                break;

            case "SprintBacklog":
                SprintBacklog.Add(DragStory);
                Backlog.Remove(DragStory);

                break;
            }
        }
Esempio n. 8
0
        public void UpdateCurrentTasks(SprintBacklog backlog)
        {
            var sprintIdentity = backlog.SprintId;

            if (sprintIdentity.IsBlankIdentity())
            {
                throw CreateInvalidEntityException();
            }

            var entity = _sprintCollection.Find(x => x.Id == sprintIdentity.ToPersistenceIdentity()).FirstOrDefault();

            if (entity == null)
            {
                throw CreateEntityNotFoundException(sprintIdentity);
            }

            var historyRecord = new MSprint.BacklogHistoryRecord
            {
                Date            = DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture),
                DoneTasks       = backlog.Tasks.Count(x => x.Status == SprintBacklog.WorkTaskStatus.Done),
                InProgressTasks = backlog.Tasks.Count(x => x.Status == SprintBacklog.WorkTaskStatus.InProgress),
                ToDoTasks       = backlog.Tasks.Count(x => x.Status == SprintBacklog.WorkTaskStatus.ToDo),
            };

            var updateDefinition = Builders <MSprint> .Update
                                   .Set(p => p.Backlog, backlog.Tasks.Select(x => new MSprint.BacklogItem
            {
                WorkTaskId   = x.WorkTaskId.ToPersistenceIdentity(),
                ParentTaskId = x.ParentTaskId.ToPersistenceIdentity(),
                Status       = x.Status
            }))
                                   .Set(x => x.CompletedTasks, backlog.CompletedStories.Select(x => x.ToPersistenceIdentity()))
                                   .Push(p => p.BacklogHistory, historyRecord);

            var result = _sprintCollection.UpdateOne(x => x.Id == sprintIdentity.ToPersistenceIdentity(), updateDefinition);

            if (result.MatchedCount != 1)
            {
                throw CreateEntityNotFoundException(sprintIdentity);
            }
        }
Esempio n. 9
0
        public async Task <IActionResult> PutSprint([FromRoute] int productId, [FromRoute] int sprintId, [FromBody] SprintBacklog sprint)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (sprint.ProductId != productId || sprint.Id != sprintId)
            {
                return(BadRequest());
            }

            var userId  = int.Parse(User.Claims.FirstOrDefault(c => c.Type == ClaimTypes.NameIdentifier).Value);
            var product = await productService.GetProductById(productId);

            var sprintToUpdate = await sprintService.GetBacklogById(sprintId);

            if (product == null)
            {
                return(NotFound(new { message = "Product not found." }));
            }

            if (sprintToUpdate == null)
            {
                return(NotFound(new { message = "Sprint not found." }));
            }

            if (product.Owner.Id != userId)
            {
                return(Forbid());
            }
            await sprintService.UpdateSprint(sprint);

            return(NoContent());
        }
Esempio n. 10
0
 public async Task <int> DeleteBacklog(SprintBacklog sprintBacklog)
 {
     _context.Backlog.Remove(sprintBacklog);
     return(await _context.SaveChangesAsync());
 }
Esempio n. 11
0
 public async Task <int> UpdateBacklog(SprintBacklog sprintBacklog)
 {
     _context.Entry(sprintBacklog).State = EntityState.Modified;
     return(await _context.SaveChangesAsync());
 }
Esempio n. 12
0
 public async Task <int> SaveBacklog(SprintBacklog sprintBacklog)
 {
     _context.Backlog.Add(sprintBacklog);
     return(await _context.SaveChangesAsync());
 }