Exemple #1
0
        public ActionResult ReportsAdmin()
        {
            Person currentPerson = SecurityHelper.CheckCurrentUser(Session, Response, ViewBag);
            if (currentPerson == null)
            {
                return View("Login");
            }

            if (!currentPerson.HasPermission(Permissions.ViewAdminReports))
            {
                return View("ReportGrid");
            }

            AdminReportsViewModel viewModel = new AdminReportsViewModel();
            viewModel.RoleId = PermissionDataAccessor.FetchDefaultRoleId(currentPerson);
            viewModel.SecurityRoles = PermissionDataAccessor.FetchRoles(currentPerson);

            return View(viewModel);
        }
        public ActionResult ReportsAdmin()
        {
            Person currentPerson = SecurityHelper.CheckCurrentUser(Session, Response, ViewBag);
            if (currentPerson == null)
            {
                return View("Login");
            }

            if (!currentPerson.HasPermission(Permissions.ViewAdminReports))
            {
                return View("ReportGrid");
            }

            var viewModel = new AdminReportsViewModel
            {
                RoleId = PermissionDataAccessor.FetchDefaultRoleId(currentPerson),
                SecurityRoles = PermissionDataAccessor.FetchRoles(currentPerson),
                BirthdaySecurityRoles = PermissionDataAccessor.FetchRoles(currentPerson),
                AnniversarySecurityRoles = PermissionDataAccessor.FetchRoles(currentPerson),
                Months = new List<MonthViewModel>
                {
                    new MonthViewModel {MonthId = 1, Name = "Jan"},
                    new MonthViewModel {MonthId = 2, Name = "Feb"},
                    new MonthViewModel {MonthId = 3, Name = "Mar"},
                    new MonthViewModel {MonthId = 4, Name = "Apr"},
                    new MonthViewModel {MonthId = 5, Name = "May"},
                    new MonthViewModel {MonthId = 6, Name = "Jun"},
                    new MonthViewModel {MonthId = 7, Name = "Jul"},
                    new MonthViewModel {MonthId = 8, Name = "Aug"},
                    new MonthViewModel {MonthId = 9, Name = "Sep"},
                    new MonthViewModel {MonthId = 10, Name = "Oct"},
                    new MonthViewModel {MonthId = 11, Name = "Nov"},
                    new MonthViewModel {MonthId = 12, Name = "Dec"}
                },
                BirthdayMonthId = DateTime.Today.Month,
                AnniversaryMonthId = DateTime.Today.Month
            };

            return View(viewModel);
        }