Example #1
0
        public IActionResult Sprints(int projectId, int iteration, int person)
        {
            using (var context = new DatabaseController(Context, Configuration))
            {
                ViewData["ProjectId"]   = projectId;
                ViewData["ProjectName"] = context.GetProjectName(projectId);
                ViewData["Iteration"]   = iteration;
                ViewData["Person"]      = person;

                var projectPublicAccess = context.CheckProjectAccess(projectId, Request.Host.Host);
                ViewData["PublicProject"] = projectPublicAccess.Item1;
                ViewData["PublicAddress"] = projectPublicAccess.Item2;
            }
            using (var context = new UsersContext(Context, Configuration))
                ViewData["GetUserViewRights"] = context.CheckUserViewWorkitemRights(UserId, projectId);

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                var dates = context.GetActiveSprintDates(projectId, iteration);
                ViewData["WorkItemTypes"] = context.GetAllWorkItemTypes();
                ViewData["StartDate"]     = dates.Item1;
                ViewData["EndDate"]       = dates.Item2;
            }
            return(View());
        }
Example #2
0
        public bool ChangeCardOwner([FromBody] IncomingCardOwnerRequest card)
        {
            var getUserByName = default(UserAccounts);
            var workItem      = default(WorkItem);

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                context.ChangeCardOwner(card);
                var getId = card.CardId.Split(" ");
                var parse = int.Parse(getId[1]);
                workItem = context.GetWorkItemById(parse);
            }
            using (var context = new UsersContext(Context, Configuration))
                getUserByName = context.GetUserAccountByName(card.Name);
            using (var context = new NotificationContext(Context, Configuration))
                context.AddNewUserNotification(1, workItem, getUserByName.Id);

            var reciverData = Program.Members.Where(x => x.Name != getUserByName.Email).ToList();

            reciverData.ForEach(x =>
            {
                MessageHub.SendCardDetailChange(MessageContext, x, card.CardId);
            });


            return(true);
        }
        public List <OutgoingWorkItem> GetBacklogWorkItems([FromBody] IncomingIdRequest IncomingIdRequest)
        {
            var result = new List <OutgoingWorkItem>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                var data  = context.GetProjectWorkItems(IncomingIdRequest.Id, IncomingIdRequest.WorkItemType, IncomingIdRequest.ProjectId);
                var bData = data.Select(x => x.WorkItem).ToList();
                bData.ForEach(x =>
                {
                    result.Add(new OutgoingWorkItem
                    {
                        Id = x.Id,
                        //     WorkItemIcon = x.WorkItemType.Icon,
                        Title       = x.Title,
                        TypeId      = x.WorkItemTypeId.Value,
                        Description = x.Description,
                        AssignedTo  = x.AssignedAccountNavigation == null ? "" : x.AssignedAccountNavigation.Email,
                        subtasks    = x.AssociatedWrorkItemChildrenWorkItem != null ? context.GetWorkItemChildrenClean(x.Id).Select(y => new OutgoingWorkItem
                        {
                            Id = y.Id,
                            //  WorkItemIcon = y.WorkItemType.Icon,
                            Title       = y.Title,
                            TypeId      = y.WorkItemTypeId.Value,
                            Description = y.Description,
                            AssignedTo  = y.AssignedAccountNavigation == null ? "" : y.AssignedAccountNavigation.Email,
                        }).ToList() : null
                    });
                });
                // result = GetChildren(data,result);
            }

            return(result);
        }
        public List <OutgoingWorkItem> GetEmptyStories([FromBody] IncomingIdRequest IncomingIdRequest)
        {
            var result = new List <OutgoingWorkItem>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                var data  = context.GetProjectWorkItems(IncomingIdRequest.Id, IncomingIdRequest.WorkItemType, IncomingIdRequest.ProjectId);
                var bData = data.Select(x => x.WorkItem).ToList();
                bData.ForEach(x =>
                {
                    if (x.AssociatedWrorkItemChildrenWorkItem.Count == 0 && !context.IsNotParent(x.Id))
                    {
                        result.Add(new OutgoingWorkItem
                        {
                            Id           = x.Id,
                            WorkItemIcon = x.WorkItemType.Icon,
                            Title        = x.Title,
                            Description  = x.Description,
                            AssignedTo   = x.AssignedAccountNavigation == null ? "" : x.AssignedAccountNavigation.Email,
                            //    subtasks = new List<OutgoingWorkItem>()
                        });
                    }
                });
                // result = GetChildren(data,result);
            }

            return(result);
        }
Example #5
0
        public async Task <IActionResult> ProjectDashboardAsync(int id)
        {
            var project = default(Projects);

            using (var context = new DatabaseController(Context, Configuration))
                project = context.GetProjectData(id);

            using (var context = new UsersContext(Context, Configuration))
            {
                ViewData["ProjectMembers"] = context.GetProjectMembers(id);
                await RemovePastProjectClaimsAsync();

                var userRight = AutherizationManager.ValidateUserRights(id, UserId, context);
                await UpdateUserRightClaiimsAsync(userRight, project.ProjectTitle);
            }

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                var initials = project.ProjectName.ToUpper().Substring(0, 2);
                ViewData["Project"]             = project;
                ViewData["ProjectId"]           = id;
                ViewData["Initials"]            = initials;
                ViewData["WorkItemsCreated"]    = context.GetCreatedWorkItemCount(id);
                ViewData["WorkItemsNew"]        = context.GetWorkItemCountByType(id, 1);
                ViewData["WorkItemsActive"]     = context.GetWorkItemCountByType(id, 2);
                ViewData["WorkItemsTesting"]    = context.GetWorkItemCountByType(id, 3);
                ViewData["WorkItemsCompleated"] = context.GetWorkItemCountByType(id, 4);
            }

            return(View());
        }
        public List <OutgoingWorkItem> GetUserWorkItems([FromBody] IncomingIdRequest IncomingIdRequest)
        {
            var result = new List <OutgoingWorkItem>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                var data = context.GetUserWorkItems(IncomingIdRequest.ProjectId, UserId);
                if (IncomingIdRequest.Phase != "!" && IncomingIdRequest.Phase != null)
                {
                    data = data.Where(x => x.WorkItem.Title.Contains(IncomingIdRequest.Phase)).ToList();
                }
                var bData = data.Select(x => x.WorkItem).ToList();
                bData.ForEach(x =>
                {
                    result.Add(new OutgoingWorkItem
                    {
                        Id           = x.Id,
                        WorkItemIcon = x.WorkItemType.Icon,
                        Title        = x.Title,
                        Description  = x.Description,
                        AssignedTo   = x.AssignedAccountNavigation == null ? "" : x.AssignedAccountNavigation.Email,
                        //    subtasks = new List<OutgoingWorkItem>()
                    });
                });
                // result = GetChildren(data,result);
            }

            return(result);
        }
        public IActionResult Commit(int id, string commitId)
        {
            using (var context = new DatabaseController(Context, Configuration))
            {
                ViewData["ProjectId"]   = id;
                ViewData["ProjectName"] = context.GetProjectName(id);
            }

            using (var context = new RepositoriesContext(Context, Configuration, new RepositoryManager()))
            {
                var items = context.GetCommitDetailsRaw(new IncomingIdRequest
                {
                    Phase     = commitId,
                    ProjectId = id,
                });
                ViewData["CommitDetails"] = items;
                // Program.AccountEditorPages.Add(new(User.ToString(), items));
                //  ViewBag["CommitDetails"] = items;
            }

            using (var context = new WorkItemsContext(Context, Configuration))
                ViewData["WorkItemTypes"] = context.GetAllWorkItemTypes();

            ViewData["CommitId"] = commitId;
            ViewData["IsEmpty"]  = true;
            return(View());
        }
Example #8
0
        public IActionResult EditWorkItem(int projectId, int workItem, string returnUrl)
        {
            var defaultUserAccount = default(UserAccounts);

            using (var context = new UsersContext(Context, Configuration))
                defaultUserAccount = context.GetDefaultAccount();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                var workItemData = context.GetWorkItem(workItem, projectId);
                workItemData.DueDate   = workItemData.DueDate.HasValue ? workItemData.DueDate.Value : new System.DateTime();
                workItemData.StartDate = workItemData.StartDate.HasValue ? workItemData.StartDate.Value : new System.DateTime();
                workItemData.EndDate   = workItemData.EndDate.HasValue ? workItemData.EndDate.Value : new System.DateTime();
                workItemData.AssignedAccountNavigation = workItemData.AssignedAccountNavigation == null ? defaultUserAccount : workItemData.AssignedAccountNavigation;
                var currentWorkItem = workItemData;
                ViewData["Priorities"]       = context.GetProjectPriorities(projectId);
                ViewData["Areas"]            = context.GetProjectAreas(projectId);
                ViewData["Severities"]       = context.GetProjectSeverities(projectId);
                ViewData["Activities"]       = context.GetProjectActivities(projectId);
                ViewData["Reasons"]          = context.GetProjectReasons(projectId);
                ViewData["Builds"]           = context.GetProjectBuilds(projectId);
                ViewData["ValueAreas"]       = context.GetProjectValueAreas(projectId);
                ViewData["Risks"]            = context.GetProjectRisks(projectId);
                ViewData["Iterations"]       = context.GetProjectIterations(projectId);
                ViewData["WorkItemFiles"]    = context.GetWorkItemFiles(workItem);
                ViewData["WorkItemType"]     = currentWorkItem.WorkItemTypeId;
                ViewData["WorkItemTypeName"] = context.GetAllWorkItemTypes()
                                               .FirstOrDefault(x => x.Id == currentWorkItem.WorkItemTypeId)
                                               .TypeName;
                ViewData["WorkItemData"] = currentWorkItem;
                ViewData["ProjectId"]    = projectId;
                ViewData["ReturnPath"]   = returnUrl;
            }
            return(View());
        }
Example #9
0
        public List <OutgoingIterationModel> GetIterations([FromBody] IncomingIterationRequest request)
        {
            var result = new List <OutgoingIterationModel>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                var dataResult = context.GetProjectIterations(request.ProjectId);
                dataResult.ForEach(x =>
                {
                    var boardName = string.Empty;
                    if (request.Calling == "Sprints")
                    {
                        boardName = request.IsPublic ? "Boards/PublicBoard" : "Boards/Sprints";
                    }
                    else
                    {
                        boardName = request.Calling;
                    }
                    result.Add(new OutgoingIterationModel
                    {
                        Text    = x.IterationName,
                        IconCss = "e-ddb-icons e-settings",
                        Url     = $"/{boardName}?projectId={request.ProjectId}&&workItemType=7&&iteration={x.Id}&&person=0"
                    });
                });
            }
            return(result);
        }
Example #10
0
 public IActionResult Files(int projectId)
 {
     ViewData["ProjectId"] = projectId;
     using (var context = new WorkItemsContext(Context, Configuration))
         ViewData["Relationships"] = context.GetProjectRelationships();
     using (var context = new DatabaseController(Context, Configuration))
     {
         var bindingBranches = context.GetProjectBranches(projectId);
         if (bindingBranches != null)
         {
             ViewData["BranchId"] = bindingBranches.FirstOrDefault(x => x.BranchName == "master").Id;
             ViewData["Branches"] = bindingBranches;
         }
         else
         {
             return(View(new ClientErrorData {
                 Title = "Invalid data result, please supply proper Project Id or contact your system administrator."
             }));
         }
     }
     using (var context = new WorkItemsContext(Context, Configuration))
         ViewData["DefaultIteration"] = context.GetProjectDefautIteration(projectId);
     using (var context = new UsersContext(Context, Configuration))
         ViewData["Projects"] = context.GetUserProjects(UserId);
     return(View());
 }
Example #11
0
        public List <WorkItemReasons> GetWorkItemReasons()
        {
            var result = new List <WorkItemReasons>();

            using (var context = new WorkItemsContext(Context, Configuration))
                result = context.GetProjectReasons(0);
            return(result);
        }
Example #12
0
 public bool AssociatedWorkItemRelation([FromBody] IncomingWorkItemRelation incomingRelation)
 {
     using (var context = new WorkItemsContext(Context, Configuration))
     {
         context.AssociatedRelation(incomingRelation);
     }
     return(true);
 }
Example #13
0
        public List <WorkItemRelations> GetWorkItemRelations()
        {
            var relationships = new List <WorkItemRelations>();

            using (var context = new WorkItemsContext(Context, Configuration))
                relationships = context.GetProjectRelationships();
            return(relationships);
        }
Example #14
0
 public IViewComponentResult Invoke(int projectId)
 {
     using (var context = new WorkItemsContext(Context, Configuration))
     {
         ViewData["CurrentIteration"] = context.GetProjectDefautIteration(projectId);
     }
     return(View());
 }
Example #15
0
 public IViewComponentResult Invoke(IncomingIdRequest ids)
 {
     ViewData["ProjectId"] = ids.ProjectId;
     ViewData["Calling"]   = ids.Phase;
     using (var context = new WorkItemsContext(Context, Configuration))
         ViewData["CurrentIteration"] = context.GetProjectIteration(ids.Id);
     return(View());
 }
Example #16
0
        public List <WorkItemIterations> GetProjectIterations(int projectId)
        {
            var result = new List <WorkItemIterations>();

            using (var context = new WorkItemsContext(Context, Configuration))
                result = context.GetProjectIterations(projectId);

            return(result);
        }
Example #17
0
        public IActionResult AddNewAccount()
        {
            using (var context = new WorkItemsContext(Context, Configuration))
                ViewData["Relationships"] = context.GetProjectRelationships();
            using (var context = new UsersContext(Context, Configuration))
                ViewData["Projects"] = context.GetUserProjects(UserId);

            return(View());
        }
Example #18
0
        public void CloseIteration([FromBody] IncomingIdRequest request)
        {
            var result = new List <BindingCards>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                context.CloseIteration(request.ProjectId, request.WorkItemType, request.Id);
            }
        }
Example #19
0
        public bool ChangeWorkItemBoard([FromBody] IncomingCardRequest card)
        {
            using (var context = new WorkItemsContext(Context, Configuration))
            {
                context.ChangeWorkItemBoard(card, MessageContext, UserId);
            }

            return(true);
        }
Example #20
0
        public OutgoingBoundRelations GetAllWorkItemRelations(int workItemId, int projectId)
        {
            var result = default(OutgoingBoundRelations);

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                result = context.GetAllWorkItemRelations(workItemId, projectId);
            }
            return(result);
        }
Example #21
0
        public List <OutgoingBindingWorkItem> GetAllWorkItems(int projectId)
        {
            var result = new List <OutgoingBindingWorkItem>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                result = context.GetAllWorkItems(projectId);
            }
            return(result);
        }
 public OutgoingJsonData MakeWorkItemPublic([FromBody] IncomingIdRequest request)
 {
     using (var context = new WorkItemsContext(Context, Configuration))
     {
         context.MakeWorkItemPrivate(request.Id, 1);
     }
     return(new OutgoingJsonData {
         Data = ""
     });
 }
 public OutgoingJsonData ItemsRemoved([FromBody] IncomingWorkItemRecycle Items)
 {
     using (var context = new WorkItemsContext(Context, Configuration))
     {
         context.RemoveWorkItems(Items.Items);
     }
     return(new OutgoingJsonData {
         Data = ""
     });
 }
Example #24
0
        public List <AssociatedWorkItemMessages> GetWorkItemDiscussions([FromBody] IncomingWorkItem request)
        {
            var result = new List <AssociatedWorkItemMessages>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                result = context.GetWorkItemDiscussions(request.ProjectId, request.WorkItemId);
            }
            return(result);
        }
Example #25
0
        public bool UpdateWorkItem([FromBody] IncomingWorkItem currentItem)
        {
            var result = default(bool);

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                result = context.UpdateWorkItem(currentItem);
            }
            return(result);
        }
Example #26
0
 public OutgoingJsonData ImportWorkItems([FromBody] OutgoingJsonData data)
 {
     using (var context = new WorkItemsContext(Context, Configuration))
     {
         context.ImportExistingProject(data.Data);
     }
     return(new OutgoingJsonData {
         Data = ""
     });
 }
Example #27
0
        public List <BindingCards> GetSprintsPublic([FromBody] IncomingSprintRequest dataRequest)
        {
            var result = new List <BindingCards>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                result = context.GetProjectSprints(dataRequest, true, 0);
            }
            return(result);
        }
Example #28
0
        public List <BindingCards> GetWorkItems(int projectId, int workItemType)
        {
            var result = new List <BindingCards>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                result = context.GetProjectCards(projectId, workItemType);
            }
            return(result);
        }
Example #29
0
        public List <WorkItemStates> GetWorkItemStates()
        {
            var result = new List <WorkItemStates>();

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                result = context.GetWorkItemStates();
            }
            return(result);
        }
Example #30
0
        public IViewComponentResult Invoke(IncomingIdRequest request)
        {
            ViewData["ProjectId"] = request.ProjectId;

            using (var context = new WorkItemsContext(Context, Configuration))
            {
                ViewData["CurrentIteration"]  = context.GetProjectDefautIteration(request.ProjectId);
                ViewData["ProjectIterations"] = context.GetProjectIterations(request.ProjectId);
            }
            return(View());
        }