Exemplo n.º 1
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 IActionResult GetUserProfile(int projectId)
 {
     ViewData["ProjectId"] = projectId;
     using (var context = new UsersContext(Context, Configuration))
     {
         ViewData["UserData"]   = context.GetUserAccount(UserId);
         ViewData["UserRights"] = AutherizationManager.ValidateUserRights(projectId, UserId, context);
     }
     return(View());
 }
 public IViewComponentResult Invoke(IncomingIdRequest request)
 {
     ViewData["ProjectId"] = request.ProjectId;
     using (var context = new UsersContext(Context, Configuration))
         ViewData["UserRights"] = AutherizationManager.ValidateUserRights(request.ProjectId, UserId, context);
     using (var context = new DocumentationContext(Context, Configuration))
     {
         if (request.Id == 0)
         {
             request.Id = context.GetDocumentationDefaultCategory(request.ProjectId);
         }
         ViewData["PageData"] = context.GetDocumentationPages(request);
     }
     ViewData["CategoryId"] = request.Id;
     return(View("/Views/Shared/Components/Documentation/DocumentationPage/Default.cshtml"));
 }
 public IViewComponentResult Invoke(IncomingIdRequest request)
 {
     ViewData["ControlName"] = request.Phase;
     ViewData["IsEnabled"]   = request.WorkItemType;
     using (var context = new UsersContext(Context, Configuration))
     {
         if (request.WorkItemType == 1)
         {
             ViewData["Enabled"] = GetControlState(context.GetProectNotificationSetting(request.Phase,
                                                                                        request.ProjectId,
                                                                                        UserId), request.Phase);
         }
         else
         {
             ViewData["Enabled"] = GetControlState(AutherizationManager.ValidateUserRights(request.ProjectId, UserId, context),
                                                   request.Phase);
         }
     }
     return(View());
 }
Exemplo n.º 5
0
        public List <OutgoingIterationModel> GetPersons([FromBody] IncomingIterationRequest request)
        {
            var result = new List <OutgoingIterationModel>();

            using (var context = new UsersContext(Context, Configuration))
            {
                var dataResult = new List <UserAccounts>();

                var userRights = AutherizationManager.ValidateUserRights(request.ProjectId, UserId, context);
                if (userRights != null)
                {
                    result.Add(new OutgoingIterationModel
                    {
                        Text    = "All",
                        IconCss = "e-ddb-icons e-settings",
                        Url     = $"/Boards/Sprints?projectId={request.ProjectId}&&workItemType=7&&iteration={request.Iteration}&&person=0"
                    });
                    result.Add(new OutgoingIterationModel
                    {
                        Text    = "@Mine",
                        IconCss = "e-ddb-icons e-settings",
                        Url     = $"/Boards/Sprints?projectId={request.ProjectId}&&workItemType=7&&iteration={request.Iteration}&&person={userRights.Id}"
                    });
                    dataResult = context.GetProjectPersons(request.ProjectId);
                }
                dataResult.ForEach(x =>
                {
                    result.Add(new OutgoingIterationModel
                    {
                        Text    = x.GitUsername,
                        IconCss = "e-ddb-icons e-settings",
                        Url     = $"/Boards/Sprints?projectId={request.ProjectId}&&workItemType=7&&iteration={request.Iteration}&&person={x.Id}"
                    });
                });
            }
            return(result);
        }