Esempio n. 1
0
        public ActionResult Edit(int id)
        {
            var team = _teamManager.GetTeam(id);

            if (team != null)
            {
                var vm = new TeamVM {
                    Name = team.Name, Id = team.Id
                };
                return(PartialView(vm));
            }
            return(View("NotFound"));
        }
        public async Task <IActionResult> Index(int?id)
        {
            int teamId = userSessionHelper.TeamId;
            var vm     = new DashBoardVM {
            };

            if (id != null)
            {
                var team = teamManager.GetTeam(id.Value);
                if (team != null && team.IsPublic)
                {
                    teamId = id.Value;
                }
                userSessionHelper.SetTeamId(id.Value);
                await userAccountManager.SetDefaultTeam(userSessionHelper.UserId, id.Value);
            }

            var issues = this.issueManager.GetIssuesGroupedByStatusGroup(teamId, 25).SelectMany(f => f.Issues).ToList();

            vm.RecentIssues = issues;

            vm.Projects = this.projectManager.GetProjects().ToList();

            return(View(vm));
        }
        public async Task <IActionResult> Index(string teamName)
        {
            var teamId = userSessionHelper.TeamId;
            var vm     = new DashBoardVm {
            };

            if (!string.IsNullOrEmpty(teamName))
            {
                var team = teamManager.GetTeam(teamName);
                if (team != null)
                {
                    //If the current user who is accessing is already a member of this team,
                    if (teamManager.DoesCurrentUserBelongsToTeam(this.userSessionHelper.UserId, team.Id))
                    {
                        vm.IsCurrentUserTeamMember = true;
                        //userSessionHelper.SetTeamId(team.Id);
                        //await userAccountManager.SetDefaultTeam(userSessionHelper.UserId, teamId);
                    }
                    else
                    {
                        // He is either accessing a public dashboard or TRYING to peep into a private dashboard

                        if (team.IsPublic)
                        {
                            teamId     = team.Id;
                            vm.TeamKey = teamId.GetHashCode();
                        }
                        else
                        {
                            return(View("NotFound"));
                        }
                    }
                }
                else
                {
                    return(View("NotFound"));
                }
            }
            vm.TeamId = teamId;
            if (userSessionHelper.TeamId > 0)
            {
                if (teamManager.DoesCurrentUserBelongsToTeam(this.userSessionHelper.UserId, teamId))
                {
                    vm.IsCurrentUserTeamMember = true;
                    var myIssues = await issueManager.GetIssuesAssignedToUser(this.userSessionHelper.UserId);

                    vm.IssuesAssignedToMe = myIssues;
                }
            }

            var issues = this.issueManager.GetIssuesGroupedByStatusGroup(teamId, 25).SelectMany(f => f.Issues).OrderByDescending(s => s.CreatedDate).ToList();

            vm.RecentIssues = issues;

            vm.Projects = this.projectManager.GetProjects(teamId).ToList();

            return(View(vm));
        }
Esempio n. 4
0
        public IEnumerable <ActivityDto> GetActivityStream(int count, int?teamId)
        {
            var teamIdToUse = this.userSessionHelper.TeamId;

            if (teamId != null)
            {
                var t = teamManager.GetTeam(teamId.Value);
                if (t != null && t.IsPublic)
                {
                    teamIdToUse = t.Id;
                }
            }
            return(this.teamManager.GeActivityItems(teamIdToUse, count));
        }
Esempio n. 5
0
        public async Task <IActionResult> Index(string teamName)
        {
            tc.TrackEvent("Dashboard view");
            var vm = new DashBoardVm {
            };

            try
            {
                var teamId = _userSessionHelper.TeamId;

                if (!string.IsNullOrEmpty(teamName))
                {
                    var team = _teamManager.GetTeam(teamName);
                    if (team != null)
                    {
                        //If the current user who is accessing is already a member of this team,
                        if (_teamManager.DoesCurrentUserBelongsToTeam(this._userSessionHelper.UserId, team.Id))
                        {
                            vm.IsCurrentUserTeamMember = true;
                            //userSessionHelper.SetTeamId(team.Id);
                            //await userAccountManager.SetDefaultTeam(userSessionHelper.UserId, teamId);
                        }
                        else
                        {
                            // He is either accessing a public dashboard or TRYING to peep into a private dashboard

                            if (team.IsPublic)
                            {
                                teamId     = team.Id;
                                vm.TeamKey = teamId.GetHashCode();

                                tc.TrackEvent("Public dashboard view-" + team.Name.ToLower());
                            }
                            else
                            {
                                return(View("NotFound"));
                            }
                        }
                    }
                    else
                    {
                        return(View("NotFound"));
                    }
                }
                vm.TeamId = teamId;
                if (_userSessionHelper.TeamId > 0)
                {
                    if (_teamManager.DoesCurrentUserBelongsToTeam(this._userSessionHelper.UserId, teamId))
                    {
                        vm.IsCurrentUserTeamMember = true;
                        var myIssues = await _issueManager.GetIssuesAssignedToUser(this._userSessionHelper.UserId);

                        vm.OverDueIssuesAssignedToMe = myIssues
                                                       .Where(d => d.DueDate != null && d.DueDate.Value < DateTime.Now)
                                                       .Where(c => c.Status.Code != "Completed" || c.Status.Code != "Closed").OrderBy(f => f.DueDate);
                        vm.IssuesAssignedToMe = myIssues;
                    }
                }

                var issues =
                    this._issueManager.GetIssuesGroupedByStatusGroup(teamId, 25)
                    .SelectMany(f => f.Issues)
                    .OrderByDescending(s => s.CreatedDate)
                    .ToList();
                vm.RecentIssues = issues;

                vm.Projects = this._projectManager.GetProjects(teamId).ToList();
            }
            catch (Exception ex)
            {
                tc.TrackException(ex);
            }
            return(View(vm));
        }