public ActionResult Index(int size = 50, string iteration = "current")
        {
            try
            {
                var statusIds = new List<int> { 1, 2, 3, 4 };
                IssueListVM bugListVM = new IssueListVM { TeamID = userSessionHelper.TeamId };
                var projectExists = projectManager.DoesProjectsExist();

                if (!projectExists)
                {
                    return RedirectToAction("Index", "Projects");
                }
                else
                {
                    List<IssueVM> issueVMs = new List<IssueVM>();

                    if (Request.IsAjaxRequest())
                    {
                        issueVMs = issueManager.GetIssues(statusIds, 50).ToList();
                        return Json(issueVMs, JsonRequestBehavior.AllowGet);
                    }
                    else
                    {
                        bugListVM.Bugs = issueManager.GetIssues(statusIds, 50).ToList();
                        bugListVM.ProjectsExist = true;

                        bool defaultProjectExist = projectManager.GetDefaultProjectForCurrentTeam() > 0;
                        if (!defaultProjectExist)
                        {
                            var alertMessages = new AlertMessageStore();
                            alertMessages.AddMessage("system", String.Format("Hey!, You need to set a default project for the current team. Go to your <a href='{0}account/settings'>profile</a> and set a project as default project.", SiteBaseURL));
                            TempData["AlertMessages"] = alertMessages;
                        }
                        return View("Index", bugListVM);
                    }
                }

            }
            catch (Exception ex)
            {
                ErrorStore.LogException(ex, System.Web.HttpContext.Current);
                return View("Error");
            }
        }
Ejemplo n.º 2
0
        public ActionResult Index(int? teamId, string teamName = "")
        {
            try
            {
                var teamIdToUse = _userSessionHelper.TeamId;


                var bugListVm = new IssueListVM();

                if (teamId != null)
                {
                    teamIdToUse = teamId.Value;
                    // a publicily visible Issue board
                    var team = this._teamManager.GetTeam(teamId.Value);
                    if (team != null && team.IsPublic)
                    {
                        bugListVm.TeamID = team.Id;
                        bugListVm.IsPublicTeam = true;
                        bugListVm.ProjectsExist = true;
                        bugListVm.IsReadonlyView = true;

                    }
                    else
                    {
                        teamIdToUse = 0;
                    }
                }



                bugListVm.TeamID = teamIdToUse;



                if (!bugListVm.IsReadonlyView)
                {
                    var projectExists = _projectManager.DoesProjectsExist();

                    if (!projectExists)
                    {
                        return RedirectToAction("Index", "Projects");
                    }
                }
                bugListVm.ProjectsExist = true;




                bool defaultProjectExist = _projectManager.GetDefaultProjectForCurrentTeam() != null;
                if (!defaultProjectExist)
                {
                    var tt = new Dictionary<string, string>
                        {
                            {
                                "warning",
                                "Hey!, You need to set a default project for the current team. Go to your profile settings and set a project as default project."
                            }
                        };
                    TempData["AlertMessages"] = tt;
                }



                return View("Index", bugListVm);

            }
            catch (Exception ex)
            {
                //ErrorStore.LogException(ex, System.Web.HttpContext.Current);
                return View("Error");
            }
        }