コード例 #1
0
        public ViewResult Detail(PersonPrimaryKey personPrimaryKey)
        {
            var person = personPrimaryKey.EntityObject;
            var userNotificationGridSpec    = new UserNotificationGridSpec();
            var userNotificationGridDataUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.UserNotificationsGridJsonData(personPrimaryKey));

            var basicProjectInfoGridSpec = new Views.Project.ProjectInfoForUserDetailGridSpec(CurrentPerson, person)
            {
                ObjectNameSingular  = $"{FieldDefinition.Project.GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinition.Project.GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };
            const string basicProjectInfoGridName            = "userProjectListGrid";
            var          projectInfoForUserDetailGridDataUrl = SitkaRoute <UserController> .BuildUrlFromExpression(tc => tc.ProjectInfoForUserDetailGridJsonData(person));

            var activateInactivateUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.ActivateInactivatePerson(person));

            var agreements = GetAgreementsByPerson(person);
            var viewData   = new DetailViewData(CurrentPerson,
                                                person,
                                                basicProjectInfoGridSpec,
                                                basicProjectInfoGridName,
                                                projectInfoForUserDetailGridDataUrl,
                                                userNotificationGridSpec,
                                                "userNotifications",
                                                userNotificationGridDataUrl,
                                                activateInactivateUrl,
                                                agreements.Any(x => x.AgreementFileResourceID.HasValue));

            return(RazorView <Detail, DetailViewData>(viewData));
        }
コード例 #2
0
        public GridJsonNetJObjectResult <ProjectPersonRelationship> ProjectInfoForUserDetailGridJsonData(PersonPrimaryKey personPrimaryKey)
        {
            var person         = personPrimaryKey.EntityObject;
            var gridSpec       = new Views.Project.ProjectInfoForUserDetailGridSpec(CurrentPerson, person);
            var projectPersons = person.IsFullUser()
                ? person.GetPrimaryContactProjects(CurrentPerson).OrderBy(x => x.DisplayName).Select(x => new ProjectPersonRelationship(x, person, null)).ToList()
                : person.ProjectPeople.Where(x => person.PersonID == CurrentPerson.PersonID || x.ProjectPersonRelationshipType.IsViewableByUser(CurrentPerson)).Select(x => new ProjectPersonRelationship(x)).ToList();
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <ProjectPersonRelationship>(projectPersons, gridSpec);

            return(gridJsonNetJObjectResult);
        }