public static bool CompleteBacklog(int backlogId, int?memberId) { using (var db = new ScrumApplicationDbContext()) { var existTask = new ProductBacklog(); existTask = db.ProductBacklogs.FirstOrDefault(x => x.ProductBacklogId == backlogId); if (!memberId.HasValue) { memberId = TeamRepository.GetUserMemberIdFromProjectId(existTask.ProjectId); } var existMember = db.Members.FirstOrDefault(x => x.MemberId == memberId); if (existMember != null) { if (ProjectRepository.IsUserAssigned(backlogId, existMember.MemberId) == 1) { if (existTask.BacklogStatus < Status.Completed) { existTask.BacklogStatus = Status.Completed; } existTask.Done = true; existMember.TotalPoint += existTask.StoryPoint; db.SaveChanges(); ActivityRepository.ActivityCreator ("completed " + existTask.Name, existTask.ProjectId, existTask.ProductBacklogId); return(true); } } return(false); } }
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(); }
public ActionResult IndexBacklog(int projectId, int sprintNo = 0, int sortBy = 0) { if (UserRepository.IsUserSigned()) { var existProject = db.Projects.FirstOrDefault(x => x.ProjectId == projectId); if (existProject != null) { var projectHVM = new ProjectHomeViewModel { ProjectId = projectId, ProjectName = existProject.Name, TeamId = existProject.TeamId ?? default(int), CurrentSprintNo = existProject.CurrentSprintNo, TotalSprintCount = ProjectRepository.GetSprintCount(projectId), ProductBacklogs = ProjectRepository.GetProjectBacklogs(projectId, sprintNo, sortBy), ViewSprintNo = sprintNo, ViewSortBy = sortBy }; if (projectHVM.ProductBacklogs.Count == 0) { var backlog = new ProductBacklog(); backlog.ProjectId = projectId; projectHVM.ProductBacklogs.Add(backlog); } return(View(projectHVM)); } return(Content("Project cannot found.")); } return(RedirectToAction("Login", "User")); }
private IEnumerable <Domain.Core.Entities.WorkTask> GetTasksFromBacklog(ProductBacklog backlog, Func <ProductBacklog.WorkTaskStatus, bool> statusFilter, Func <WorkTaskType, bool> typeFilter) { return(backlog .Where(x => statusFilter(x.Status)) .Select(x => RepositoryProvider.WorkTask.Read(x.WorkTaskId)) .Where(x => typeFilter(x.Type))); }
public ActionResult Edit(int id) { CarregaLista(); //passando uma model A ProductBacklog A = PBacklogList.Where(X => X.ID == id).First(); List <Equipe> Equipes = (List <Equipe>)Session["Equipes"]; ProjetoList = _ProjetoRep.Lista(new ProjetoMapper(), Equipes); ViewBag.Descricao = new SelectList(ProjetoList, "ID", "Descricao"); ViewBag.Importanciaa = new List <SelectListItem> { new SelectListItem { Text = "Baixa", Value = "Baixa" }, new SelectListItem { Text = "Média", Value = "Média" }, new SelectListItem { Text = "Alta", Value = "Alta" } }; ViewBag.Aceitoo = new List <SelectListItem> { new SelectListItem { Text = "Não", Value = "Não" }, new SelectListItem { Text = "Sim", Value = "Sim" } }; return(View(A)); }
public void AddWorkItem(ProductBacklog productBacklog, string projectName) { JsonPatchDocument patchDocument = new JsonPatchDocument(); patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.Title", Value = productBacklog.Title } ); patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.Description", Value = productBacklog.Description } ); patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.State", Value = productBacklog.State } ); patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/Microsoft.VSTS.Scheduling.OriginalEstimate", Value = productBacklog.TimeAllocated } ); patchDocument.Add( new JsonPatchOperation() { Operation = Operation.Add, Path = "/fields/System.CreatedDate", Value = productBacklog.CreatedDate } ); using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials)) { WorkItem result = workItemTrackingHttpClient.CreateWorkItemAsync(patchDocument, projectName, productBacklog.Type).Result; if (result != null) { productBacklog.Id = result.Id; _FrameworxProjectDatabaseContext.Add <ProductBacklog>(productBacklog); } } }
public ActionResult Create(ProductBacklog PB) { _PBacklogRep.ADD(PB); Session["Lista"] = PBacklogList; CarregaLista(); return(RedirectToAction("Index")); }
public ActionResult EditBacklog(BacklogViewModel backlogModel) { var _existBacklog = new ProductBacklog(); _existBacklog = db.ProductBacklogs.FirstOrDefault(x => x.ProductBacklogId == backlogModel.Backlog.ProductBacklogId); _existBacklog.Name = backlogModel.Backlog.Name; _existBacklog.Priority = backlogModel.Backlog.Priority; _existBacklog.StoryPoint = backlogModel.Backlog.StoryPoint; _existBacklog.AcceptanceCriteria = backlogModel.Backlog.AcceptanceCriteria; _existBacklog.EpicId = backlogModel.Backlog.EpicId; _existBacklog.SprintNo = backlogModel.Backlog.SprintNo; _existBacklog.BacklogStatus = backlogModel.Backlog.BacklogStatus; if (backlogModel.AssignMember != null) { var existMember = db.Members.FirstOrDefault (x => x.MemberId == backlogModel.AssignMember.MemberId); var backlogToMember = new BacklogToMember(); if (existMember != null && backlogToMember != null) { backlogToMember.MemberId = existMember.MemberId; backlogToMember.MemberName = existMember.Name; backlogToMember.ProductBacklogId = backlogModel.Backlog.ProductBacklogId; db.BacklogToMembers.Add(backlogToMember); } } db.SaveChanges(); ActivityRepository.ActivityCreator ("edited " + _existBacklog.Name + " backlog.", _existBacklog.ProjectId, _existBacklog.ProductBacklogId); return(RedirectToAction("EditBacklog", new { id = _existBacklog.ProductBacklogId, sprintNo = backlogModel.ViewSprintNo, sortBy = backlogModel.ViewSortBy })); }
public ActionResult DeleteConfirmed(int id) { ProductBacklog productBacklog = db.ProductBacklogs.Find(id); db.ProductBacklogs.Remove(productBacklog); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit(ProductBacklog PB) { //carrega lista e traz um objeto da lista para ser editado CarregaLista(); _PBacklogRep.Update(PB); Session["Lista"] = PBacklogList; return(RedirectToAction("Index")); }
private List <SelectListItem> GetTasksFromBacklog(ProductBacklog backlog, Func <ProductBacklog.WorkTaskStatus, bool> statusFilter, Func <WorkTaskType, bool> typeFilter) { return(backlog .Where(x => statusFilter(x.Status)) .Select(x => RepositoryProvider.WorkTask.Read(x.WorkTaskId)) .Where(x => typeFilter(x.Type)) .Select(x => x.ToSelectListItem()) .ToList()); }
public IActionResult Get(int groupID) { ProductBacklog productBacklog = null; Console.WriteLine("------------------" + groupID); productBacklog = databaseServer.loadProductBacklog(groupID); // Console.WriteLine(productBacklog.userStories[0].userStory); return(CreatedAtAction("Post", productBacklog)); }
public ActionResult Edit([Bind(Include = "Id,Name,Description")] ProductBacklog productBacklog) { if (ModelState.IsValid) { productBacklog.OwnerId = Utility.GetEmployeeSession(Session).Id; service.UpdateProduct(productBacklog); return(RedirectToAction("Details", new { Id = productBacklog.Id })); } return(View(productBacklog)); }
public ActionResult Edit([Bind(Include = "Id,Name,Description,EmpId")] ProductBacklog productBacklog) { if (ModelState.IsValid) { db.Entry(productBacklog).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productBacklog)); }
public List<ProductBacklogItem> GetProductBacklogItems(ProductBacklog productBacklog) { return new List<ProductBacklogItem> { new ProductBacklogItem() { Id = 1, Name = "Jane", ProductBacklog = productBacklog, CreatedOn = DateTime.Now, Active = true }, new ProductBacklogItem() { Id = 2, Name = "Miguel", ProductBacklog = productBacklog, CreatedOn = DateTime.Now, Active = true }, new ProductBacklogItem() { Id = 3, Name = "Charles", ProductBacklog = productBacklog, CreatedOn = DateTime.Now, Active = true }, new ProductBacklogItem() { Id = 4, Name = "Shoya", ProductBacklog = productBacklog, CreatedOn = DateTime.Now, Active = true } }; }
public IEnumerable <ProductBacklog> GetAllProductBacklog(string projectName) { Wiql wiql = new Wiql() { Query = "Select * " + "From WorkItems " + "Where System.TeamProject='" + projectName + "' " + "Order By [Changed Date] Desc" }; using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials)) { WorkItemQueryResult queryResult = workItemTrackingHttpClient.QueryByWiqlAsync(wiql).Result; if (queryResult != null && queryResult.WorkItems.Count() > 0) { // return queryResult; var workItems = GetWorkItemsWithSpecificFields(queryResult.WorkItems.Select(t => t.Id)); List <ProductBacklog> productBacklogs = new List <ProductBacklog>(); var detailsFromDb = _FrameworxProjectDatabaseContext.Query <ProductBacklog>().ToList(); foreach (var item in workItems) { var productBacklogItem = new ProductBacklog() { Id = int.Parse(item.Fields["System.Id"].ToString()), Title = item.Fields["System.Title"].ToString(), State = item.Fields["System.State"].ToString(), Type = item.Fields.ContainsKey("System.WorkItemType") ? item.Fields["System.WorkItemType"].ToString() : Constants.InformationNotAvailableText, Area = item.Fields.ContainsKey("System.AreaPath") ? item.Fields["System.AreaPath"].ToString() : Constants.InformationNotAvailableText, AssigneeEmail = detailsFromDb.Any(t => t.Id == item.Id) ? detailsFromDb.FirstOrDefault(t => t.Id == item.Id).AssigneeEmail : "", AssignedBy = detailsFromDb.Any(t => t.Id == item.Id) ? detailsFromDb.FirstOrDefault(t => t.Id == item.Id).AssignedBy : "", TimeAllocated = item.Fields.ContainsKey("Microsoft.VSTS.Scheduling.OriginalEstimate") ? (double)item.Fields["Microsoft.VSTS.Scheduling.OriginalEstimate"] : 0.00, TimeSpent = item.Fields.ContainsKey("Microsoft.VSTS.Scheduling.CompletedWork") ? (double)item.Fields["Microsoft.VSTS.Scheduling.CompletedWork"] : 0.0, CreatedDate = (DateTime)item.Fields["System.CreatedDate"], ChangedDate = (DateTime)item.Fields["System.ChangedDate"] }; productBacklogItem.AssigneeDisplayName = detailsFromDb.Any(t => t.Id == item.Id) ? detailsFromDb.FirstOrDefault(t => t.Id == item.Id).AssigneeDisplayName : "Unassigned"; if (string.IsNullOrWhiteSpace(productBacklogItem.AssigneeDisplayName)) { productBacklogItem.AssigneeDisplayName = "Unassigned"; } productBacklogs.Add(productBacklogItem); } return(productBacklogs); } else { throw new NullReferenceException("Wiql '" + wiql.Query + "' did not find any results"); } } }
public void UpdateAssignee(ProductBacklog productBacklog) { if (_FrameworxProjectDatabaseContext.Query <ProductBacklog>().Any(t => t.Id == productBacklog.Id)) { _FrameworxProjectDatabaseContext.Update <ProductBacklog>(productBacklog); } else { _FrameworxProjectDatabaseContext.Add <ProductBacklog>(productBacklog); } }
public ActionResult Create([Bind(Include = "Id,Name,Description,EmpId")] ProductBacklog productBacklog) { if (ModelState.IsValid) { db.ProductBacklogs.Add(productBacklog); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(productBacklog)); }
// GET: ProductBacklogs1/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductBacklog productBacklog = db.ProductBacklogs.Find(id); if (productBacklog == null) { return(HttpNotFound()); } return(View(productBacklog)); }
public static void AddProductBacklog(int projectId, string name) { var newTask = new ProductBacklog(); newTask.Name = name; newTask.ProjectId = projectId; using (var db = new ScrumApplicationDbContext()) { db.ProductBacklogs.Add(newTask); db.SaveChanges(); } ActivityRepository.ActivityCreator ("added " + newTask.Name + " to the project.", newTask.ProjectId, newTask.ProductBacklogId); }
public ActionResult DeleteConfirmed(int id) { try { service.DeleteProduct(id); return(RedirectToAction("Index")); } catch (Exception ex) { ProductBacklog productBacklog = service.GetById(id); ViewBag.Message = ex.Message; return(View(productBacklog)); } }
public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } ProductBacklog productBacklog = service.GetById(id.Value); if (productBacklog == null) { return(HttpNotFound()); } return(View(productBacklog)); }
public ProductBacklog GetWorkItemDetails(int id) { var fields = new string[] { "System.Id", "System.Title", "System.Description", "System.State", "System.WorkItemType", "System.AreaPath", "System.AssignedTo", "Microsoft.VSTS.Scheduling.OriginalEstimate", "Microsoft.VSTS.Scheduling.CompletedWork", "System.CreatedDate", "System.ChangedDate" }; using (WorkItemTrackingHttpClient workItemTrackingHttpClient = new WorkItemTrackingHttpClient(_uri, _credentials)) { WorkItem result = workItemTrackingHttpClient.GetWorkItemAsync(id, fields).Result; var backlogItem = new ProductBacklog() { Id = int.Parse(result.Fields["System.Id"].ToString()), Title = result.Fields["System.Title"].ToString(), State = result.Fields["System.State"].ToString(), Description = result.Fields.ContainsKey("System.Description") ? result.Fields["System.Description"].ToString() : "", Type = result.Fields.ContainsKey("System.WorkItemType") ? result.Fields["System.WorkItemType"].ToString() : Constants.InformationNotAvailableText, Area = result.Fields.ContainsKey("System.AreaPath") ? result.Fields["System.AreaPath"].ToString() : Constants.InformationNotAvailableText, TimeAllocated = result.Fields.ContainsKey("Microsoft.VSTS.Scheduling.OriginalEstimate") ? (double)result.Fields["Microsoft.VSTS.Scheduling.OriginalEstimate"] : 0.00, TimeSpent = result.Fields.ContainsKey("Microsoft.VSTS.Scheduling.CompletedWork") ? (double)result.Fields["Microsoft.VSTS.Scheduling.CompletedWork"] : 0.0, CreatedDate = (DateTime)result.Fields["System.CreatedDate"], ChangedDate = result.Fields.ContainsKey("System.ChangedDate") ? (DateTime)result.Fields["System.ChangedDate"] : DateTime.Now }; var detailsFromDb = _FrameworxProjectDatabaseContext.Query <ProductBacklog>().FirstOrDefault(t => t.Id == backlogItem.Id); if (detailsFromDb != null) { backlogItem.AssigneeDisplayName = detailsFromDb.AssigneeDisplayName; if (string.IsNullOrWhiteSpace(backlogItem.AssigneeDisplayName)) { backlogItem.AssigneeDisplayName = "Unassigned"; } backlogItem.AssignedBy = detailsFromDb.AssignedBy; } return(backlogItem); } }
public ActionResult DeleteConfirmed(int id) { //ProductBacklog productBacklog = db.ProductBacklogs.Find(id); //db.ProductBacklogs.Remove(productBacklog); //db.SaveChanges(); //ProductBacklog productBacklog = productBacklogRepository.GetProductBacklogByID(id); //productBacklogRepository.DeleteProductBacklog(id); //productBacklogRepository.Save(); ProductBacklog productBacklog = unitOfWork.ProductBacklogRepository.GetByID(id); unitOfWork.ProductBacklogRepository.Delete(id); unitOfWork.Save(); return(RedirectToAction("Index")); }
// GET: ProductBacklog/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } //ProductBacklog productBacklog = db.ProductBacklogs.Find(id); //ProductBacklog productBacklog = productBacklogRepository.GetProductBacklogByID(id); ProductBacklog productBacklog = unitOfWork.ProductBacklogRepository.GetByID(id); if (productBacklog == null) { return(HttpNotFound()); } return(View(productBacklog)); }
public ActionResult Edit([Bind(Include = "ID,Name,Description,CreatedBy,CreatedDate,StartDate,ExpectedEndDate,ActualEndDate")] ProductBacklog productBacklog) { if (ModelState.IsValid) { //db.Entry(productBacklog).State = EntityState.Modified; //db.SaveChanges(); //productBacklogRepository.UpdateProductBacklog(productBacklog); //productBacklogRepository.Save(); unitOfWork.ProductBacklogRepository.Update(productBacklog); unitOfWork.Save(); return(RedirectToAction("Index")); } return(View(productBacklog)); }
public IActionResult Create([FromBody] ProductBacklogDto productBacklogDto) { if (string.IsNullOrWhiteSpace(productBacklogDto.Name)) { return(BadRequest("Name cannot be empty.")); } var backlog = new ProductBacklog { Name = productBacklogDto.Name }; this.backlogContext.ProductBacklogs.Add(backlog); this.backlogContext.SaveChanges(); return(Created($"{backlog.Id}", backlog)); }
public static int GetTeamIdFromProductBacklog(int taskId) { using (var db = new ScrumApplicationDbContext()) { var existBacklog = new ProductBacklog(); var existProject = new Project(); var existTeam = new Team(); existBacklog = db.ProductBacklogs.FirstOrDefault(x => x.ProductBacklogId == taskId); existProject = db.Projects.FirstOrDefault(x => x.ProjectId == existBacklog.ProjectId); existTeam = db.Teams.FirstOrDefault(x => x.TeamId == existProject.TeamId); if (existTeam.TeamId != 0) { return(existTeam.TeamId); } return(0); } }
public ActionResult Create([Bind(Include = "ID,Name,Description,CreatedBy,CreatedDate,StartDate,ExpectedEndDate,ActualEndDate")] ProductBacklog productBacklog) { if (ModelState.IsValid) { productBacklog.CreatedBy = 1; // this has to be the id of the person to be logged in productBacklog.CreatedDate = DateTime.Now; //db.ProductBacklogs.Add(productBacklog); //db.SaveChanges(); //productBacklogRepository.InsertProductBacklog(productBacklog); //productBacklogRepository.Save(); unitOfWork.ProductBacklogRepository.Insert(productBacklog); unitOfWork.Save(); return(RedirectToAction("Index")); } return(View(productBacklog)); }
public ActionResult AssignBacklog(int memberId, int backlogId, int?from) { if (UserRepository.IsUserSigned()) { var _backlogToMember = new BacklogToMember(); var existBacklog = new ProductBacklog(); existBacklog = db.ProductBacklogs.FirstOrDefault(x => x.ProductBacklogId == backlogId); var existProject = new Project(); existProject = db.Projects.FirstOrDefault(x => x.ProjectId == existBacklog.ProjectId); if (existProject != null) { if (memberId != 0) { var existMember = db.Members.FirstOrDefault(x => x.MemberId == memberId); var existAssignment = db.BacklogToMembers.FirstOrDefault (x => x.ProductBacklogId == existBacklog.ProductBacklogId && x.MemberId == memberId); if (existAssignment != null) { return(Content("Member already assigned that backlog.")); } else { _backlogToMember.ProductBacklogId = backlogId; _backlogToMember.MemberId = memberId; _backlogToMember.MemberName = existMember.Name; db.BacklogToMembers.Add(_backlogToMember); db.SaveChanges(); ActivityRepository.ActivityCreator ("assigned " + existMember.Name + " to the backlog " + existBacklog.Name, existBacklog.ProjectId, existBacklog.ProductBacklogId); return(RedirectToAction("EditBacklog", new { id = backlogId })); } } } return(Content("There are errors, you cannot assign to this backlog.")); } return(RedirectToAction("Login", "User")); }
public void UpdateProductBacklog(ProductBacklog productBacklog) { var projectIdentity = productBacklog.ProjectId; if (projectIdentity.IsBlankIdentity()) { throw CreateInvalidEntityException(); } var entity = _projectCollection.Find(x => x.Id == projectIdentity.ToPersistenceIdentity()).FirstOrDefault(); if (entity == null) { throw CreateEntityNotFoundException(projectIdentity); } var historyRecord = new MProject.BacklogHistoryRecord { Date = DateTime.Now.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), DoneTasks = productBacklog.Count(x => x.Status == ProductBacklog.WorkTaskStatus.Done), InSprintTasks = productBacklog.Count(x => x.Status == ProductBacklog.WorkTaskStatus.InSprint), ReadyTasks = productBacklog.Count(x => x.Status == ProductBacklog.WorkTaskStatus.Ready), ToDoTasks = productBacklog.Count(x => x.Status == ProductBacklog.WorkTaskStatus.ToDo), }; var updateDefinition = Builders <MProject> .Update .Set(p => p.Backlog, productBacklog.Select(x => new MProject.BacklogItem { WorkTaskId = x.WorkTaskId.ToPersistenceIdentity(), Status = x.Status })) .Push(p => p.BacklogHistory, historyRecord); var result = _projectCollection.UpdateOne(x => x.Id == projectIdentity.ToPersistenceIdentity(), updateDefinition); if (result.MatchedCount != 1) { throw CreateEntityNotFoundException(projectIdentity); } }
public void GivenIHaveAProductBacklog() { backlog = new ProductBacklog(); }
public Project() { Backlog = new ProductBacklog(); Sprints = new Collection<Sprint>(); Team = new Team(); }