示例#1
0
        private void RenderContentForTimer()
        {
            var participantId = Guid.Empty;

            if (!WebItemSecurity.IsProductAdministrator(EngineFactory.ProductId, SecurityContext.CurrentAccount.ID))
            {
                participantId = Participant.ID;
            }

            UserProjects = EngineFactory.ProjectEngine.GetOpenProjectsWithTasks(participantId);

            if (UserProjects.Any() && (Project == null || !UserProjects.Contains(Project)))
            {
                Project = UserProjects.First();
            }

            var tasks = EngineFactory.TaskEngine.GetByProject(Project.ID, null, Participant.IsVisitor ? participantId : Guid.Empty);

            OpenUserTasks   = tasks.Where(r => r.Status == TaskStatus.Open).OrderBy(r => r.Title);
            ClosedUserTasks = tasks.Where(r => r.Status == TaskStatus.Closed).OrderBy(r => r.Title);

            Users = EngineFactory.ProjectEngine.GetTeam(Project.ID).OrderBy(r => DisplayUserSettings.GetFullUserName(r.UserInfo)).Where(r => r.UserInfo.IsVisitor() != true).ToList();

            if (!string.IsNullOrEmpty(Request.QueryString["taskId"]))
            {
                Target = int.Parse(Request.QueryString["taskId"]);
            }
        }
示例#2
0
文件: AryaDb.cs 项目: ewin66/Arya
        private void SetCurrentUser(Guid userID, Guid projectID)
        {
            if (!AuthorizedUsers.ContainsKeys(userID, projectID))
            {
                var authorized = UserProjects.Any(up => up.ProjectID == projectID && up.UserID == userID);
                if (authorized)
                {
                    AuthorizedUsers[userID, projectID] = DateTime.Now;
                }
            }
            //set current user

            if (AuthorizedUsers.ContainsKeys(userID, projectID))
            {
                CurrentUser = CurrentProject.UserProjects.Where(up => up.UserID == userID).Select(up => up.User).First();

                if (AuthorizedUsers[userID, projectID].AddHours(1) < DateTime.Now)
                {
                    AuthorizedUsers.Remove(userID, projectID);
                }
                return;
            }

            throw new UnauthorizedAccessException();
        }
示例#3
0
        private void RenderContentForTimer()
        {
            var participantId = Guid.Empty;

            if (!Participant.IsAdmin)
            {
                participantId = Participant.ID;
            }

            UserProjects = Global.EngineFactory.GetProjectEngine().GetOpenProjectsWithTasks(participantId);

            if (UserProjects.Any() && (Project == null || !UserProjects.Contains(Project)))
            {
                Project = UserProjects[0];
            }

            if (Project == null)
            {
                return;
            }

            var tasks = Global.EngineFactory.GetTaskEngine().GetByProject(Project.ID, null, Participant.IsVisitor ? participantId : Guid.Empty);

            OpenUserTasks   = tasks.Where(r => r.Status == TaskStatus.Open).OrderBy(r => r.Title);
            ClosedUserTasks = tasks.Where(r => r.Status == TaskStatus.Closed).OrderBy(r => r.Title);

            Users = Global.EngineFactory.GetProjectEngine().GetTeam(Project.ID).OrderBy(r => DisplayUserSettings.GetFullUserName(r.UserInfo)).Where(r => r.UserInfo.IsVisitor() != true).ToList();

            if (!string.IsNullOrEmpty(Request.QueryString["taskId"]))
            {
                Target = int.Parse(Request.QueryString["taskId"]);
            }
        }
示例#4
0
        private void RenderContentForTimer()
        {
            var participantId = Guid.Empty;

            if (!WebItemSecurity.IsProductAdministrator(EngineFactory.ProductId, SecurityContext.CurrentAccount.ID))
            {
                participantId = Participant.ID;
            }

            UserProjects = EngineFactory.ProjectEngine.GetByFilter(new TaskFilter
            {
                ProjectStatuses = new List <ProjectStatus> {
                    ProjectStatus.Open
                },
                SortBy    = "title",
                SortOrder = true
            }).Where(r => r.TaskCountTotal > 0).ToList();

            if (UserProjects.Any() && (Project == null || !UserProjects.Contains(Project)))
            {
                Project = UserProjects.First();
            }

            var tasks = EngineFactory.TaskEngine.GetByProject(Project.ID, null, Participant.IsVisitor ? participantId : Guid.Empty).Where(r => ProjectSecurity.CanCreateTimeSpend(r)).ToList();

            OpenUserTasks   = tasks.Where(r => r.Status == TaskStatus.Open).OrderBy(r => r.Title);
            ClosedUserTasks = tasks.Where(r => r.Status == TaskStatus.Closed).OrderBy(r => r.Title);

            Users = EngineFactory.ProjectEngine.GetProjectTeamExcluded(Project.ID).OrderBy(r => DisplayUserSettings.GetFullUserName(r.UserInfo)).Where(r => !r.UserInfo.IsVisitor()).ToList();

            if (!string.IsNullOrEmpty(Request.QueryString["taskId"]))
            {
                Target = int.Parse(Request.QueryString["taskId"]);
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            CurrentUser = SecurityContext.CurrentAccount.ID;

            var filter = new TaskFilter
            {
                SortBy          = "title",
                SortOrder       = true,
                ProjectStatuses = new List <ProjectStatus> {
                    ProjectStatus.Open
                }
            };

            if (!ProjectSecurity.IsAdministrator(CurrentUser))
            {
                filter.ParticipantId = CurrentUser;
            }

            UserProjects = Global.EngineFactory.GetProjectEngine().GetByFilter(filter);

            if (UserProjects.Any() && (Project == null || !UserProjects.Contains(Project)))
            {
                Project = UserProjects[0];
            }

            var tasks = Global.EngineFactory.GetTaskEngine().GetByProject(Project.ID, null, Guid.Empty);

            OpenUserTasks   = tasks.Where(r => r.Status == TaskStatus.Open).OrderBy(r => r.Title);
            ClosedUserTasks = tasks.Where(r => r.Status == TaskStatus.Closed).OrderBy(r => r.Title);

            Users = Global.EngineFactory.GetProjectEngine().GetTeam(Project.ID).OrderBy(r => DisplayUserSettings.GetFullUserName(r.UserInfo)).ToList();

            if (!string.IsNullOrEmpty(Request.QueryString["taskId"]))
            {
                Target = int.Parse(Request.QueryString["taskId"]);
            }
        }