Пример #1
0
        public void UpdateProductBacklogItem(int id, ProductBacklogItem pbi)
        {
            ProductBacklogItem temp = GetProductBacklogItem(id);

            temp.UpdateItem(pbi);
            db.SaveChanges();
        }
 public string UpdatePriority([FromBody] ChangePBIPriority TableSnapshot)
 {
     try
     {
         using (DataAccessLayer model = new DataAccessLayer())
         {
             LogHelper.InfoLog("Attempting to Update Priorities for Product Backlog Items");
             for (int i = 0; i < TableSnapshot.pbiIDs.Count(); i++)
             {
                 ProductBacklogItem pbi = model.GetProductBacklogItem(int.Parse(TableSnapshot.pbiIDs[i]));
                 if (pbi.Priority != i + 1)
                 {
                     pbi.Priority = i + 1;
                     model.UpdateProductBacklogItem(pbi.ID, pbi);
                 }
             }
         }
         return("Complete");
     }
     catch (Exception ex)
     {
         string errorMessage = "Error updating backlog item priorities: " + ex.ToString();
         LogHelper.ErrorLog(errorMessage);
         return("Error");
     }
 }
Пример #3
0
 public ActionResult BacklogItemDetails(int?id)
 {
     if (id != null)
     {
         using (DataAccessLayer db = new DataAccessLayer())
         {
             ProductBacklogItem pbi = db.GetProductBacklogItem(id.Value);
             if (pbi == null)
             {
                 TempData["errorState"] = 404;
                 TempData["404-Error"]  = "Unable to find Backlog Item with ID: " + id;
                 return(RedirectToAction("Index"));
             }
             TeamAuthenticate teamCheck = new TeamAuthenticate(RoleEnum.Roles.Viewonly, pbi.Project);
             if (teamCheck.isAuthenticated(HttpContext))
             {
                 ViewBag.ProjectID = pbi.Project.ID;
                 return(View(pbi.GetDetails()));
             }
         }
         TempData["errorState"] = 401;
         return(RedirectToAction("Index"));
     }
     TempData["errorState"] = 500;
     return(RedirectToAction("Index"));
 }
Пример #4
0
 public int AddProductBacklogItem(ProductBacklogItem pbi)
 {
     db.ProductBacklogItems.Add(pbi);
     db.SaveChanges();
     if (pbi.ID != 0)
     {
         return(pbi.ID);
     }
     return(0);
 }
Пример #5
0
        public void RestoreProductBacklogItem(int id)
        {
            ProductBacklogItem pbi = GetProductBacklogItem(id);

            if (pbi != null)
            {
                pbi.Archived = false;
                List <BacklogItemTask> taskList = pbi.Tasks.ToList();
                foreach (BacklogItemTask t in taskList)
                {
                    RestoreTask(t.ID);
                }
                db.SaveChanges();
            }
        }
        public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            int id = int.Parse(context.RouteData.Values["backlogtaskid"].ToString());

            BacklogItemTask = await _context.BacklogTasks.Include(p => p.Schedule).Include(p => p.Item).FirstOrDefaultAsync(p => p.Id == id);

            if (BacklogItemTask == null)
            {
                context.Result = new NotFoundResult();
                return;
            }
            else
            {
                BacklogItem = BacklogItemTask.Item;
                await next();
            }
        }
Пример #7
0
        public override async Task OnActionExecutionAsync(ActionExecutingContext context, ActionExecutionDelegate next)
        {
            int id = int.Parse(context.RouteData.Values["backlogid"].ToString());

            BacklogItem = await _context.ProductBackLogItems.Include(p => p.Team).ThenInclude(t => t.UserTeams)
                          .Include(p => p.Tasks).FirstOrDefaultAsync(p => p.Id == id);

            if (BacklogItem == null)
            {
                context.Result = new NotFoundResult();
                return;
            }
            else
            {
                await next();
            }
        }
Пример #8
0
        public async Task <IActionResult> Create([Bind("Id,Description,Priority,Status")] ProductBacklogItem productBacklogItem)
        {
            var allowed = await _authorizationService.AuthorizeAsync(User, Product, Operations.Create);

            if (!allowed.Succeeded)
            {
                return(new ForbidResult());
            }

            if (ModelState.IsValid)
            {
                _context.Add(productBacklogItem);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(productBacklogItem));
        }
        public static bool CreatePBI(int id, string title)
        {
            var room = _rooms.FirstOrDefault(r => r.RoomId == id);

            if (room == null)
            {
                return(false);
            }

            ProductBacklogItem pbi = new ProductBacklogItem()
            {
                Title     = title,
                Estimates = new List <Estimate>()
            };

            room.PBIs.Add(pbi);
            return(true);
        }
Пример #10
0
 public int?AddPBItoIteration([FromBody] SetIteration iterationSet)
 {
     try
     {
         using (DataAccessLayer modelAccess = new DataAccessLayer())
         {
             LogHelper.InfoLog("Adding PBI with ID: " + iterationSet.PbiId + " ,To Iteration with ID: " + iterationSet.IterationId);
             ProductBacklogItem pbi = modelAccess.GetProductBacklogItem(iterationSet.PbiId);
             if (pbi == null)
             {
                 return(null);
             }
             pbi.SprintID = iterationSet.IterationId ?? null;
             modelAccess.UpdateProductBacklogItem(pbi.ID, pbi);
             return(1);
         }
     }
     catch (Exception ex)
     {
         LogHelper.ErrorLog("The following error occured when adding the pbi with id: " + iterationSet.PbiId + " to iteration with id " + iterationSet.IterationId + ": " + ex.ToString());
         return(null);
     }
 }
Пример #11
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,Description,Priority,Status")] ProductBacklogItem productBacklogItem)
        {
            if (id != productBacklogItem.Id)
            {
                return(NotFound());
            }

            var allowed = await _authorizationService.AuthorizeAsync(User, Product, Operations.Manage);

            if (!allowed.Succeeded)
            {
                return(new ForbidResult());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(productBacklogItem);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!ProductBacklogItemExists(productBacklogItem.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(productBacklogItem));
        }