Esempio n. 1
0
        public IndexViewData(FirmaSession currentFirmaSession,
                             ProjectFirmaModels.Models.FirmaPage firmaPage,
                             string gridDataUrl,
                             List <SelectListItem> activeOrAllOrganizationsSelectListItems)
            : base(currentFirmaSession, firmaPage)
        {
            PageTitle = $"{FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabelPluralized()}";

            HasOrganizationManagePermissions = new OrganizationManageFeature().HasPermissionByFirmaSession(CurrentFirmaSession);
            GridSpec = new OrganizationIndexGridSpec(currentFirmaSession, HasOrganizationManagePermissions)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            GridName    = "organizationsGrid";
            GridDataUrl = gridDataUrl;

            PullOrganizationFromKeystoneUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(x => x.PullOrganizationFromKeystone());

            UserIsSitkaAdmin   = new SitkaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);
            NewOrganizationUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(t => t.New());

            ActiveOrAllOrganizationsSelectListItems = activeOrAllOrganizationsSelectListItems;
            ShowOnlyActiveOrAll = "ShowOnlyActiveOrAll";
        }
Esempio n. 2
0
        public IndexViewData(FirmaSession firmaSession, ProjectFirmaModels.Models.FirmaPage firmaPageHomePage, ProjectFirmaModels.Models.FirmaPage firmaPageAdditionalInfo, ProjectFirmaModels.Models.FirmaPage firmaPageMapInfo,
                             FeaturedProjectsViewData featuredProjectsViewData, ProjectLocationsMapViewData projectLocationsMapViewData, ProjectLocationsMapInitJson projectLocationsMapInitJson,
                             List <ProjectFirmaModels.Models.FirmaHomePageImage> firmaHomePageImages) : base(firmaSession, firmaPageHomePage)
        {
            PageTitle = MultiTenantHelpers.GetToolDisplayName();

            Check.EnsureNotNull(firmaPageHomePage, "firmaPageHomePage not found; is one defined?");
            bool hasPermissionToManageHomePage = new FirmaPageManageFeature().HasPermission(firmaSession, firmaPageHomePage).HasPermission;

            Check.EnsureNotNull(firmaPageAdditionalInfo, "firmaPageAdditionalInfo not found; is one defined?");
            bool hasPermissionToManageAdditionalInfo = new FirmaPageManageFeature().HasPermission(firmaSession, firmaPageAdditionalInfo).HasPermission;

            Check.EnsureNotNull(firmaPageMapInfo, "firmaPageMapInfo not found; is one defined?");
            bool hasPermissionToManagePageMapInfo = new FirmaPageManageFeature().HasPermission(firmaSession, firmaPageMapInfo).HasPermission;

            CustomHomePageTextViewData = new ViewPageContentViewData(firmaPageHomePage, hasPermissionToManageHomePage);
            CustomHomePageAdditionalInfoTextViewData = new ViewPageContentViewData(firmaPageAdditionalInfo, hasPermissionToManageAdditionalInfo);
            CustomHomePageMapTextViewData            = new ViewPageContentViewData(firmaPageMapInfo, hasPermissionToManagePageMapInfo);
            FeaturedProjectsViewData = featuredProjectsViewData;
            FullMapUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.ProjectMap());

            ProjectLocationsMapViewData = projectLocationsMapViewData;
            ProjectLocationsMapInitJson = projectLocationsMapInitJson;
            FirmaHomePageCarouselImages = firmaHomePageImages;
            ProposeNewProjectUrl        = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsProposal(null));

            ProjectUpdatesUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.MyProjectsRequiringAnUpdate());

            DisplayActionButtons = !firmaSession.IsAnonymousOrUnassigned();
        }
Esempio n. 3
0
        public ManageViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage neptunePage)
            : base(currentFirmaSession, neptunePage)
        {
            var fieldDefinitionLabelProject = FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel();
            var fieldDefinitionForStatus    = FieldDefinitionEnum.Status.ToType();
            var statusLabelPluralized       =
                fieldDefinitionForStatus.GetFieldDefinitionLabel()
                .Equals("Status", StringComparison.InvariantCultureIgnoreCase)
                    ? "Statuses"
                    : fieldDefinitionForStatus.GetFieldDefinitionLabelPluralized();

            EntityName = $"{fieldDefinitionLabelProject} {fieldDefinitionForStatus.GetFieldDefinitionLabel()}";
            PageTitle  = $"{fieldDefinitionLabelProject} {statusLabelPluralized}";

            NewProjectStatusUrl = SitkaRoute <ProjectStatusController> .BuildUrlFromExpression(t => t.New());

            GridSpec = new ProjectStatusGridSpec()
            {
                ObjectNameSingular  = "Attribute Type",
                ObjectNamePlural    = "Attribute Types",
                SaveFiltersInCookie = true
            };

            GridName    = "projectStatusGrid";
            GridDataUrl = SitkaRoute <ProjectStatusController> .BuildUrlFromExpression(x => x.ProjectStatusGridJsonData());

            EditSortOrderUrl = SitkaRoute <ProjectStatusController> .BuildUrlFromExpression(x => x.EditSortOrder());

            HasManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);
        }
Esempio n. 4
0
 public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, string gridDataUrl) : base(currentFirmaSession, firmaPage)
 {
     PageTitle   = $"Manage {FieldDefinitionEnum.ActionItem.ToType().GetFieldDefinitionLabelPluralized()}";
     GridDataUrl = gridDataUrl;
     GridSpec    = new ActionItemsAdminGridSpec(currentFirmaSession);
     GridName    = "actionItemsIndexGrid";
 }
Esempio n. 5
0
        public IndexViewData(FirmaSession currentFirmaSession,
                             ProjectFirmaModels.Models.FirmaPage externalMapLayersFirmaPage, string externalMapLayerGridDataUrl,
                             ProjectFirmaModels.Models.FirmaPage internalMapLayersFirmaPage, string geospatialAreaMapLayerGridDataUrl,
                             ProjectFirmaModels.Models.FirmaPage externallySourcedGeospatialAreasInstructionsFirmaPage, bool userCanManage)
            : base(currentFirmaSession, externalMapLayersFirmaPage)
        {
            PageTitle = $"{FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabelPluralized()}";
            ExternalMapLayerGridSpec = new ExternalMapLayerGridSpec(userCanManage)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.ExternalReferenceLayer.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.ExternalReferenceLayer.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };
            ExternalMapLayerGridName    = "externalMapLayersGrid";
            ExternalMapLayerGridDataUrl = externalMapLayerGridDataUrl;
            NewUrl = SitkaRoute <MapLayerController> .BuildUrlFromExpression(x => x.New());

            var currentPersonCanManage = new FirmaPageManageFeature().HasPermission(currentFirmaSession, internalMapLayersFirmaPage).HasPermission;

            InternalMapLayersViewPageContentViewData = new ViewPageContentViewData(internalMapLayersFirmaPage, currentPersonCanManage);

            AreGeospatialAreasExternallySourced = MultiTenantHelpers.AreGeospatialAreasExternallySourced();
            ExternallySourcedGeospatialAreasInstructionsViewPageContentViewData = new ViewPageContentViewData(externallySourcedGeospatialAreasInstructionsFirmaPage, currentPersonCanManage);

            GeospatialAreaMapLayerGridSpec = new GeospatialAreaMapLayerGridSpec(userCanManage)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.GeospatialArea.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };
            GeospatialAreaMapLayerGridName    = "geospatialAreaMapLayersGrid";
            GeospatialAreaMapLayerGridDataUrl = geospatialAreaMapLayerGridDataUrl;

            UserCanManage = userCanManage;
        }
Esempio n. 6
0
        public InstructionsViewData(FirmaSession currentFirmaSession, ProjectUpdateBatch projectUpdateBatch,
                                    ProjectUpdateStatus projectUpdateStatus, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, projectUpdateBatch, projectUpdateStatus, new List <string>(), "Instructions")
        {
            PerformanceMeasuresUrl = SitkaRoute <PerformanceMeasureController> .BuildUrlFromExpression(x => x.Index());

            InstructionsViewPageContentViewData = new ViewPageContentViewData(firmaPage, new FirmaPageManageFeature().HasPermission(currentFirmaSession, firmaPage).HasPermission);
        }
Esempio n. 7
0
        public EditViewData(FirmaSession currentFirmaSession,
                            string submitUrl,
                            ProjectFirmaModels.Models.FirmaPage instructionsFirmaPage,
                            ProjectFirmaModels.Models.ProjectCustomAttributeGroup projectCustomAttributeGroup)
            : base(currentFirmaSession)
        {
            EntityName = "Attribute Group";
            PageTitle  =
                $"{(projectCustomAttributeGroup != null ? "Edit" : "New")} Attribute Group";
            ProjectCustomAttributeGroupIndexUrl =
                SitkaRoute <ProjectCustomAttributeGroupController> .BuildUrlFromExpression(x => x.Manage());

            SubmitUrl = submitUrl;

            ViewInstructionsFirmaPage  = new ViewPageContentViewData(instructionsFirmaPage, currentFirmaSession);
            TenantAttribute            = MultiTenantHelpers.GetTenantAttributeFromCache();
            ProjectTypeSelectListItems = ProjectCategory.All.ToSelectList(x => x.ProjectCategoryID.ToString(), x => x.ProjectCategoryDisplayName);

            if (projectCustomAttributeGroup != null && projectCustomAttributeGroup.ProjectCustomAttributeTypes.Any(x => x.ProjectCustomAttributes.Any(y => y.ProjectCustomAttributeValues.Any())))
            {
                HasExistingData = true;
            }
            else
            {
                HasExistingData = false;
            }
        }
Esempio n. 8
0
        public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            PageTitle = $"{FieldDefinitionEnum.OrganizationType.ToType().GetFieldDefinitionLabelPluralized()}";

            var hasManagePermissions = new OrganizationAndRelationshipTypeManageFeature().HasPermissionByFirmaSession(currentFirmaSession);

            OrganizationTypeGridSpec = new OrganizationTypeGridSpec(hasManagePermissions)
            {
                ObjectNameSingular = $"{FieldDefinitionEnum.OrganizationType.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.OrganizationType.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true
            };

            OrganizationTypeGridName    = "organizationTypeGrid";
            OrganizationTypeGridDataUrl = SitkaRoute <OrganizationTypeAndOrganizationRelationshipTypeController> .BuildUrlFromExpression(otc => otc.OrganizationTypeGridJsonData());

            OrganizationRelationshipTypeGridSpec = new OrganizationRelationshipTypeGridSpec(hasManagePermissions, HttpRequestStorage.DatabaseEntities.OrganizationTypes.ToList())
            {
                ObjectNameSingular = $"{FieldDefinitionEnum.ProjectOrganizationRelationshipType.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{ FieldDefinitionEnum.ProjectOrganizationRelationshipType.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true
            };

            OrganizationRelationshipTypeGridName    = "relationshipTypeGrid";
            OrganizationRelationshipTypeGridDataUrl = SitkaRoute <OrganizationTypeAndOrganizationRelationshipTypeController> .BuildUrlFromExpression(otc => otc.OrganizationRelationshipTypeGridJsonData());

            HasManagePermissions   = hasManagePermissions;
            NewOrganizationTypeUrl = SitkaRoute <OrganizationTypeAndOrganizationRelationshipTypeController> .BuildUrlFromExpression(t => t.NewOrganizationType());

            NewProjectAssociationUrl = SitkaRoute <OrganizationTypeAndOrganizationRelationshipTypeController> .BuildUrlFromExpression(t => t.NewOrganizationRelationshipType());
        }
        public MyOrganizationsProjectsViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, List <ProjectCustomGridConfiguration> projectCustomDefaultGridConfigurations) : base(currentFirmaSession, firmaPage)
        {
            //TODO: It shouldn't be possible to reach this if Person.Organization is null...
            var currentPerson = currentFirmaSession.Person;
            var organizationNamePossessive = currentPerson.Organization.GetOrganizationNamePossessive();

            PageTitle = $"{organizationNamePossessive} {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}";
            var projectDetails = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID);

            ProjectCustomDefaultGridSpec = new ProjectCustomGridSpec(currentFirmaSession, projectCustomDefaultGridConfigurations, ProjectCustomGridType.Default.ToEnum, projectDetails, currentFirmaSession.Tenant)
            {
                ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true
            };

            ProjectCustomDefaultGridName    = "myOrganizationsProjectListGrid";
            ProjectCustomDefaultGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.MyOrganizationProjectsCustomGridDefaultJsonData());

            ProposalsGridName = "myOrganizationsProposalsGrid";
            ProposalsGridSpec = new ProposalsGridSpec(currentFirmaSession)
            {
                ObjectNameSingular  = $"{organizationNamePossessive} {FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{organizationNamePossessive} {FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };
            ProposalsGridDataUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(tc => tc.MyOrganizationsProposalsGridJsonData());

            ProposeNewProjectUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(tc => tc.InstructionsProposal(null));
        }
Esempio n. 10
0
 public EditProjectProjectStatusViewData(
     ProjectFirmaModels.Models.Project project
     , bool allowEditUpdateDate
     , string createdByPerson
     , string deleteUrl
     , ProjectFirmaModels.Models.FirmaPage projectStatusFirmaPage
     , FirmaSession currentFirmaSession
     , List <ProjectFirmaModels.Models.ProjectStatus> allProjectStatuses
     , ProjectStatusLegendDisplayViewData projectStatusLegendDisplayViewData
     , bool isFinalStatusReport) : base(currentFirmaSession)
 {
     ProjectStatuses = allProjectStatuses.OrderBy(x => x.ProjectStatusSortOrder)
                       .ToSelectListWithEmptyFirstRow(x => x.ProjectStatusID.ToString(),
                                                      x => !string.IsNullOrEmpty(x.ProjectStatusDescription)
                                                                                  ? $"{x.ProjectStatusDisplayName} - {x.ProjectStatusDescription}"
                                                                                  : $"{x.ProjectStatusDisplayName}");
     ProjectStatusJsonList = new ProjectStatusJsonList(allProjectStatuses.Select(x => new ProjectStatusJson(x)).ToList());
     AllowEditUpdateDate   = allowEditUpdateDate;
     CreatedByPerson       = !string.IsNullOrEmpty(createdByPerson)
         ? createdByPerson
         : currentFirmaSession.UserDisplayName;
     DeleteButton                       = string.IsNullOrEmpty(deleteUrl) ? new HtmlString(string.Empty) : ModalDialogFormHelper.MakeDeleteIconButton(deleteUrl, $"Delete {FieldDefinitionEnum.Status.ToType().GetFieldDefinitionLabel()} Update", true);
     ProjectStatusFirmaPage             = new ViewPageContentViewData(projectStatusFirmaPage, currentFirmaSession);
     ProjectStatusLegendDisplayViewData = projectStatusLegendDisplayViewData;
     AllowEditFinal                     = isFinalStatusReport || ProjectProjectStatusController.AllowUserToSetNewStatusReportToFinal(project, currentFirmaSession);
 }
Esempio n. 11
0
        public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            var taxonomyBranchDisplayNamePluralized = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabelPluralized();

            PageTitle = taxonomyBranchDisplayNamePluralized;

            // if branch is the highest level, let them sort without groups
            OfferEditSortOrder = MultiTenantHelpers.IsTaxonomyLevelBranch();
            // if it is a three tier taxonomy, let them sort grouped by taxonomy trunks
            OfferEditSortOrderInGroup = MultiTenantHelpers.IsTaxonomyLevelTrunk();

            HasTaxonomyBranchManagePermissions = new TaxonomyBranchManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            IsNotTaxonomyLevelLeaf             = !MultiTenantHelpers.IsTaxonomyLevelLeaf();

            var taxonomyBranchDisplayName = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabel();

            GridSpec = new IndexGridSpec(currentFirmaSession)
            {
                ObjectNameSingular  = taxonomyBranchDisplayName,
                ObjectNamePlural    = taxonomyBranchDisplayNamePluralized,
                SaveFiltersInCookie = true
            };

            GridName    = "taxonomyBranchesGrid";
            GridDataUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(tc => tc.IndexGridJsonData());

            NewUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(t => t.New());

            EditSortOrderUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(tc => tc.EditSortOrder());

            EditSortOrderInGroupUrl = SitkaRoute <TaxonomyBranchController> .BuildUrlFromExpression(tc => tc.EditSortOrderInGroup());

            TaxonomyBranchDisplayName = taxonomyBranchDisplayName;
        }
Esempio n. 12
0
        public AccomplishmentsDashboardViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, TenantAttribute tenantAttribute,
                                                List <ProjectFirmaModels.Models.Organization> organizations, List <int> calendarYears, int defaultBeginYear, int defaultEndYear,
                                                List <TaxonomyTier> taxonomyTiers, TaxonomyLevel associatePerformanceMeasureTaxonomyLevel) : base(currentFirmaSession, firmaPage)
        {
            var accomplishmentsDashboardOrganizationTypeName = FieldDefinitionEnum.ProjectStewardOrganizationDisplayName
                                                               .ToType().GetFieldDefinitionLabelPluralized();

            PageTitle        = "Accomplishments Dashboard";
            TenantAttribute  = tenantAttribute;
            Organizations    = organizations;
            CalendarYears    = calendarYears;
            DefaultBeginYear = defaultBeginYear;
            DefaultEndYear   = defaultEndYear;
            TaxonomyTiers    = taxonomyTiers;
            ParticipatingOrganizationsUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.ParticipatingOrganizations(UrlTemplate.Parameter1Int));

            OrganizationDashboardSummaryUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.OrganizationDashboardSummary(UrlTemplate.Parameter1Int));

            OrganizationAccomplishmentsUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.OrganizationAccomplishments(UrlTemplate.Parameter1Int, UrlTemplate.Parameter2Int));

            OrganizationDetailUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(x => x.Detail(UrlTemplate.Parameter1Int, null));

            SpendingByOrganizationTypeAndOrganizationUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.SpendingByOrganizationTypeByOrganization(UrlTemplate.Parameter1Int, UrlTemplate.Parameter2Int, UrlTemplate.Parameter3Int));

            AccomplishmentsDashboardOrganizationTypeName = accomplishmentsDashboardOrganizationTypeName;
            TaxonomyTierDisplayName              = associatePerformanceMeasureTaxonomyLevel.GetFieldDefinition().GetFieldDefinitionLabel();
            HasSitkaAdminPermissions             = new SitkaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);
            ConfigureAccomplishmentsDashboardUrl = SitkaRoute <ResultsController> .BuildUrlFromExpression(c => c.ConfigureAccomplishmentsDashboard());
        }
Esempio n. 13
0
        public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, List <ProjectCustomGridConfiguration> projectCustomFullGridConfigurations) : base(currentFirmaSession, firmaPage)
        {
            PageTitle = $"Full {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} List";
            var projectDetails = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID);

            ProjectCustomFullGridSpec = new ProjectCustomGridSpec(currentFirmaSession, projectCustomFullGridConfigurations, ProjectCustomGridType.Full.ToEnum, projectDetails, currentFirmaSession.Tenant)
            {
                ObjectNameSingular = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true
            };

            if (new ProjectCreateFeature().HasPermissionByFirmaSession(currentFirmaSession))
            {
                ProjectCustomFullGridSpec.CustomExcelDownloadUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(tc => tc.IndexExcelDownload()); // TODO:
            }
            else if (currentFirmaSession.Role.RoleID == ProjectFirmaModels.Models.Role.ProjectSteward.RoleID)
            {
                ProjectCustomFullGridSpec.CreateEntityModalDialogForm = new ModalDialogForm(SitkaRoute <ProjectController> .BuildUrlFromExpression(tc => tc.DenyCreateProject()), $"New {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}");
            }
            ProjectCustomFullGridName    = "projectsGrid";
            ProjectCustomFullGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.AllActiveProjectsCustomGridFullJsonData());

            ProposeNewProjectUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsProposal(null));

            ProjectUpdatesUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.MyProjectsRequiringAnUpdate());

            DisplayActionButtons = !currentFirmaSession.IsAnonymousOrUnassigned();
        }
Esempio n. 14
0
        public ProposedViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            PageTitle = FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized();

            HasProposeProjectPermissions = new ProjectCreateFeature().HasPermissionByFirmaSession(currentFirmaSession);
            ProposeNewProjectUrl         = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsProposal(null));

            GridSpec = new ProposalsGridSpec(currentFirmaSession)
            {
                ObjectNameSingular = $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabel()}", ObjectNamePlural = $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()}", SaveFiltersInCookie = true
            };

            if (new ProjectCreateNewFeature().HasPermissionByFirmaSession(currentFirmaSession))
            {
                GridSpec.CustomExcelDownloadUrl =
                    SitkaRoute <ProjectController> .BuildUrlFromExpression(tc => tc.ProposalsExcelDownload());
            }
            if (new ProjectCreateFeature().HasPermissionByFirmaSession(currentFirmaSession))
            {
                GridSpec.CreateEntityActionPhrase    = "Propose a New Project";
                GridSpec.CreateEntityModalDialogForm = null;
            }
            GridName    = "proposalsGrid";
            GridDataUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(tc => tc.ProposedGridJsonData());
        }
Esempio n. 15
0
        public EditViewData(FirmaSession currentFirmaSession,
                            IEnumerable <MeasurementUnitType> measurementUnitTypes,
                            List <ProjectCustomAttributeDataType> projectCustomAttributeDataTypes,
                            List <ProjectFirmaModels.Models.Role> roles,
                            string submitUrl,
                            ProjectFirmaModels.Models.FirmaPage instructionsFirmaPage,
                            ProjectFirmaModels.Models.ProjectCustomAttributeType projectCustomAttributeType,
                            List <ProjectFirmaModels.Models.ProjectCustomAttributeGroup> allProjectCustomAttributeGroups)
            : base(currentFirmaSession)
        {
            EntityName = "Attribute Type";
            PageTitle  =
                $"{(projectCustomAttributeType != null ? "Edit" : "New")} Attribute Type";
            YesNos = BooleanFormats.GetYesNoSelectList();
            ProjectCustomAttributeDataTypes = projectCustomAttributeDataTypes.ToSelectListWithEmptyFirstRow(
                x => x.ProjectCustomAttributeDataTypeID.ToString(), x => x.ProjectCustomAttributeDataTypeDisplayName);
            ProjectCustomAttributeGroups = allProjectCustomAttributeGroups.ToSelectListWithEmptyFirstRow(x => x.ProjectCustomAttributeGroupID.ToString(), x => x.ProjectCustomAttributeGroupName);
            MeasurementUnitTypes         = measurementUnitTypes.OrderBy(x => x.MeasurementUnitTypeDisplayName)
                                           .ToSelectListWithEmptyFirstRow(
                x => x.MeasurementUnitTypeID.ToString(), x => x.MeasurementUnitTypeDisplayName,
                ViewUtilities.NoneString);
            ProjectCustomAttributeTypeIndexUrl =
                SitkaRoute <ProjectCustomAttributeTypeController> .BuildUrlFromExpression(x => x.Manage());

            SubmitUrl = submitUrl;

            ViewInstructionsFirmaPage = new ViewPageContentViewData(instructionsFirmaPage, currentFirmaSession);

            ViewDataForAngular = new EditViewDataForAngular(projectCustomAttributeDataTypes);
        }
Esempio n. 16
0
        public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            var taxonomyTrunkPluralized = FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabelPluralized();

            PageTitle = taxonomyTrunkPluralized;

            HasTaxonomyTrunkManagePermissions = new TaxonomyTrunkManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            OfferEditSortOrder     = MultiTenantHelpers.IsTaxonomyLevelTrunk() || MultiTenantHelpers.IsTaxonomyLevelTrunk();
            IsNotTaxonomyLevelLeaf = !MultiTenantHelpers.IsTaxonomyLevelLeaf();
            var taxonomyTrunkDisplayName = FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabel();

            GridSpec = new IndexGridSpec(currentFirmaSession)
            {
                ObjectNameSingular = taxonomyTrunkDisplayName, ObjectNamePlural = taxonomyTrunkPluralized, SaveFiltersInCookie = true
            };

            GridName    = "taxonomyTrunksGrid";
            GridDataUrl = SitkaRoute <TaxonomyTrunkController> .BuildUrlFromExpression(tc => tc.IndexGridJsonData());

            NewUrl = SitkaRoute <TaxonomyTrunkController> .BuildUrlFromExpression(t => t.New());

            EditSortOrderUrl = SitkaRoute <TaxonomyTrunkController> .BuildUrlFromExpression(tc => tc.EditSortOrder());

            TaxonomyTrunkDisplayName = taxonomyTrunkDisplayName;
        }
Esempio n. 17
0
        public AgreementIndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            PageTitle = MultiTenantHelpers.GetAgreementNamePluralized();

            HasAgreementManagePermissions = new AgreementManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            DisplayActionButtons          = HasAgreementManagePermissions;

            AgreementGridSpec = new AgreementGridSpec(currentFirmaSession)
            {
                ObjectNameSingular  = MultiTenantHelpers.GetAgreementName(),
                ObjectNamePlural    = MultiTenantHelpers.GetAgreementNamePluralized(),
                SaveFiltersInCookie = true
            };

            AgreementGridName    = "AgreementsGrid";
            AgreementGridDataUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(c => c.AgreementGridJsonData());

            AgreementIndexViewPageContentViewData = new ViewPageContentViewData(firmaPage, true);

            bool hasAgreementManagementRights = new AgreementManageFeature().HasPermissionByPerson(currentFirmaSession.Person);

            ShowAgreementEditingControls = FirmaWebConfiguration.FeatureAlevinAgreementCreationAndEditing && hasAgreementManagementRights;
            NewAgreementUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(t => t.NewAgreement());

            //AgreementGridSpec.CustomExcelDownloadLinkText = $"Download with {FieldDefinitionEnum.AgreementSubcategory.ToType().GetFieldDefinitionLabelPluralized()}";
            //AgreementGridSpec.CustomExcelDownloadUrl = SitkaRoute<AgreementController>.BuildUrlFromExpression(tc => tc.IndexExcelDownload());
        }
Esempio n. 18
0
 public ViewPageContentViewData(ProjectFirmaModels.Models.FirmaPage firmaPage, bool showEditButton)
 {
     FirmaPageContentHtmlString = firmaPage.GetFirmaPageContentHtmlString();
     FirmaPageDisplayName       = firmaPage.GetFirmaPageDisplayName();
     ShowEditButton             = showEditButton;
     HasPageContent             = firmaPage.HasPageContent();
     EditPageContentUrl         = SitkaRoute <FirmaPageController> .BuildUrlFromExpression(t => t.EditInDialog(firmaPage));
 }
Esempio n. 19
0
        public ProjectsViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, List <ProjectCustomGridConfiguration> projectCustomFullGridConfigurations) : base(currentFirmaSession, firmaPage)
        {
            var projectDetails = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID);

            ProjectCustomFullGridSpec = new ProjectCustomGridSpec(currentFirmaSession, projectCustomFullGridConfigurations, ProjectCustomGridType.Reports.ToEnum, projectDetails, currentFirmaSession.Tenant);
            GridName    = "ReportProjects";
            PageTitle   = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}";
            GridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.AllActiveProjectsAndProposalsCustomGridReportsJsonData());
        }
Esempio n. 20
0
 public TaxonomyViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage,
                         List <FancyTreeNode> topLevelTaxonomyTierAsFancyTreeNodes) : base(currentFirmaSession, firmaPage)
 {
     TopLevelTaxonomyTierAsFancyTreeNodes = topLevelTaxonomyTierAsFancyTreeNodes;
     PageTitle = MultiTenantHelpers.GetTaxonomySystemName();
     TaxonomyTrunkDisplayName  = FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabel();
     TaxonomyBranchDisplayName = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabel();
     TaxonomyLeafDisplayName   = FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabel();
     TaxonomyLevel             = MultiTenantHelpers.GetTaxonomyLevel();
 }
        public TechnicalAssistanceRequestsViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, ProjectUpdateBatch projectUpdateBatch, ProjectUpdateStatus projectUpdateStatus, List <TechnicalAssistanceType> technicalAssistanceTypes, List <CalendarYearString> fiscalYearStrings, List <PersonSimple> personSimples) : base(currentFirmaSession, projectUpdateBatch, projectUpdateStatus, new List <string>(), ProjectUpdateSection.TechnicalAssistanceRequests.ProjectUpdateSectionDisplayName)
        {
            Check.EnsureNotNull(firmaPage, "The Firma Page for this section is not found; is one defined?");
            bool hasPermissionToManageFirmaPage = new FirmaPageManageFeature().HasPermission(currentFirmaSession, firmaPage).HasPermission;

            TechnicalAssistanceInstructionsViewData = new ViewPageContentViewData(firmaPage, hasPermissionToManageFirmaPage);
            UserCanAllocate         = new ProjectUpdateAdminFeatureWithProjectContext().HasPermission(currentFirmaSession, projectUpdateBatch.Project).HasPermission;
            ViewDataForAngular      = new TechnicalAssistanceRequestsViewDataForAngular(projectUpdateBatch.ProjectID, technicalAssistanceTypes, fiscalYearStrings, personSimples);
            SectionCommentsViewData = new SectionCommentsViewData(projectUpdateBatch.TechnicalAssistanceRequestsComment, projectUpdateBatch.IsReturned());
            RefreshUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.RefreshTechnicalAssistanceRequests(projectUpdateBatch.Project));
        }
        public ObligationItemIndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            PageTitle = "Obligation Items";

            ObligationItemGridSpec = new ObligationItemGridSpec(currentFirmaSession);

            ObligationItemGridName    = "ObligationItemsGrid";
            ObligationItemGridDataUrl = SitkaRoute <ObligationItemController> .BuildUrlFromExpression(c => c.ObligationItemGridJsonData());

            ObligationItemIndexViewPageContentViewData = new ViewPageContentViewData(firmaPage, true);
        }
Esempio n. 23
0
        public PnBudgetIndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            PageTitle = "PnBudgets";

            PnBudgetGridSpec = new PnBudgetGridSpec(currentFirmaSession);

            PnBudgetGridName    = "PnBudgetsGrid";
            PnBudgetGridDataUrl = SitkaRoute <PnBudgetController> .BuildUrlFromExpression(c => c.PnBudgetNumberGridJsonData());

            PnBudgetIndexViewPageContentViewData = new ViewPageContentViewData(firmaPage, true);
        }
Esempio n. 24
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public FirmaPageImage(FirmaPage firmaPage, FileResourceInfo fileResourceInfo) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.FirmaPageImageID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.FirmaPageID      = firmaPage.FirmaPageID;
     this.FirmaPage        = firmaPage;
     firmaPage.FirmaPageImages.Add(this);
     this.FileResourceInfoID = fileResourceInfo.FileResourceInfoID;
     this.FileResourceInfo   = fileResourceInfo;
     fileResourceInfo.FirmaPageImages.Add(this);
 }
Esempio n. 25
0
        public ManageViewData(FirmaSession currentFirmaSession,
                              ProjectFirmaModels.Models.FirmaPage firmaPage,
                              string customNotificationUrl,
                              ProjectUpdateStatusGridSpec projectsRequiringUpdateGridSpec,
                              string projectsRequiringUpdateGridDataUrl,
                              PeopleReceivingReminderGridSpec peopleReceivingReminderGridSpec,
                              string peopleReceivingReminderGridDataUrl, int projectsWithNoContactCount,
                              ProjectUpdateSetting projectUpdateSetting) : base(currentFirmaSession, firmaPage)
        {
            var reportingYear = FirmaDateUtilities.CalculateCurrentYearToUseForRequiredReporting();
            var fieldDefinitionLabelProject = FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel();

            PageTitle     = $"{fieldDefinitionLabelProject} Updates";
            ReportingYear = reportingYear;

            ProjectsRequiringUpdateGridDataUrl = projectsRequiringUpdateGridDataUrl;
            ProjectsRequiringUpdateGridSpec    = projectsRequiringUpdateGridSpec;
            ProjectsRequiringUpdateGridName    = "projectsRequiringAnUpdateGrid";

            PeopleReceivingReminderGridDataUrl = peopleReceivingReminderGridDataUrl;
            ProjectsWithNoContactCount         = projectsWithNoContactCount;

            ProjectUpdateSetting = projectUpdateSetting;

            PeopleReceivingReminderGridSpec = peopleReceivingReminderGridSpec;
            PeopleReceivingReminderGridName = "peopleReceivingAnReminderGrid";

            KickOffIntroPreviewUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.KickOffIntroPreview());

            ReminderIntroPreviewUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.ReminderIntroPreview());

            CloseOutIntroPreviewUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.CloseOutIntroPreview());

            var getPersonIDFunctionString =
                $"function() {{ return Sitka.{PeopleReceivingReminderGridName}.getValuesFromCheckedGridRows({0}, \'PersonID\', \'PersonIDList\'); }}";

            var modalDialogFormLink = ModalDialogFormHelper.ModalDialogFormLink(
                "<span class=\"glyphicon glyphicon-envelope\" style=\"margin-right:5px\"></span>Send Notification to Selected People",
                customNotificationUrl,
                "Send Notification to Selected People",
                700,
                "Send",
                "Cancel",
                new List <string>(),
                null,
                getPersonIDFunctionString);

            PeopleReceivingReminderGridSpec.ArbitraryHtml = new List <string> {
                modalDialogFormLink.ToString()
            };

            EditProjectUpdateConfigurationUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.EditProjectUpdateConfiguration());
        }
Esempio n. 26
0
 public ManageViewData(FirmaSession currentFirmaSession,
                       ProjectFirmaModels.Models.FirmaPage firmaPage, ViewPageContentViewData factSheetCustomTextViewData,
                       string editFactSheetCustomTextUrl, string deleteFactSheetLogoFileResourceUrl, string editFactSheetLogoUrl, string editBasicsUrl, TenantAttribute tenantAttribute) : base(currentFirmaSession, firmaPage)
 {
     PageTitle = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Fact Sheets";
     FactSheetCustomTextViewData        = factSheetCustomTextViewData;
     EditFactSheetCustomTextUrl         = editFactSheetCustomTextUrl;
     DeleteFactSheetLogoFileResourceUrl = deleteFactSheetLogoFileResourceUrl;
     TenantAttribute      = tenantAttribute;
     EditFactSheetLogoUrl = editFactSheetLogoUrl;
     EditBasicsUrl        = editBasicsUrl;
 }
Esempio n. 27
0
        public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
        {
            PageTitle = $"{FieldDefinitionEnum.ProjectEvaluation.ToType().GetFieldDefinitionLabelPluralized()}";
            GridSpec  = new IndexGridSpec(currentFirmaSession)
            {
                ObjectNameSingular = FieldDefinitionEnum.Evaluation.ToType().GetFieldDefinitionLabel(), ObjectNamePlural = FieldDefinitionEnum.Evaluation.ToType().GetFieldDefinitionLabelPluralized(), SaveFiltersInCookie = true
            };
            GridName    = "evaluationsGrid";
            GridDataUrl = SitkaRoute <EvaluationController> .BuildUrlFromExpression(tc => tc.IndexGridJsonData());

            HasEvaluationManagePermissions = new EvaluationManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            NewUrl = SitkaRoute <EvaluationController> .BuildUrlFromExpression(x => x.New());
        }
Esempio n. 28
0
        public CreateAccountViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage psInfoPage) : base(currentFirmaSession, psInfoPage)
        {
            PageTitle  = "Create Account";
            EntityName = "Users";

            CancelUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.Index());

            IndexUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.Index());

            var allOrganizations = HttpRequestStorage.DatabaseEntities.Organizations.ToList().OrderBy(x => x.OrganizationName).ToList();

            OrganizationsSelectList = allOrganizations.ToSelectList(x => x.OrganizationID.ToString(), x => x.OrganizationName);
        }
Esempio n. 29
0
        /// <summary>
        /// Call for page with associated FirmaPage
        /// </summary>
        protected FirmaViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage)
        {
            FirmaPage = firmaPage;

            //CurrentPerson = currentPerson;
            CurrentFirmaSession = currentFirmaSession;
            FirmaHomeUrl        = SitkaRoute <HomeController> .BuildUrlFromExpression(c => c.Index());

            LogInUrl  = FirmaHelpers.GenerateLogInUrl();
            LogOutUrl = FirmaHelpers.GenerateLogOutUrlWithReturnUrl();

            CurrentUrl         = HttpContext.Current.Request.Url;
            ForgotPasswordUrl  = FirmaHelpers.GenerateForgotPasswordUrlWithReturnUrl(CurrentUrl.AbsoluteUri);
            RegisterAccountUrl = FirmaHelpers.GenerateCreateAccountWithReturnUrl(CurrentUrl.AbsoluteUri);

            QaUrl    = MultiTenantHelpers.GetRelativeUrlForEnvironment(CurrentUrl, FirmaEnvironmentType.Qa);
            LocalUrl = MultiTenantHelpers.GetRelativeUrlForEnvironment(CurrentUrl, FirmaEnvironmentType.Local);
            ProdUrl  = MultiTenantHelpers.GetRelativeUrlForEnvironment(CurrentUrl, FirmaEnvironmentType.Prod);

            TenantSimples = MultiTenantHelpers.GetAllTenantSimples().Where(ts => ts.ShowTenantInSwitcherDropdown).ToList();

            RequestSupportUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(c => c.Support());

            MakeFirmaMenu(currentFirmaSession);

            FullProjectListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Index());

            ProjectSearchUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Search(UrlTemplate.Parameter1String));

            ProjectFindUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Find(string.Empty));

            var currentPersonCanManage = new FirmaPageManageFeature().HasPermission(currentFirmaSession, firmaPage).HasPermission;

            ViewPageContentViewData = firmaPage != null ? new ViewPageContentViewData(firmaPage, currentPersonCanManage) : null;
            CustomFooterViewData    = new CustomFooterViewData(FirmaPageTypeEnum.CustomFooter.GetFirmaPage(), currentPersonCanManage, this.CurrentFirmaSession);
            TenantName             = MultiTenantHelpers.GetTenantName();
            TenantShortDisplayName = MultiTenantHelpers.GetTenantShortDisplayName();
            TenantBannerLogoUrl    = MultiTenantHelpers.GetTenantBannerLogoUrl();
            TenantToolDisplayName  = MultiTenantHelpers.GetToolDisplayName();
            ShowTenantDropdown     =
                // Tenant dropdown can be globally disabled if necessary. (Reclamation needs this, and so might other hard-ish forks.)
                FirmaWebConfiguration.TenantDropdownEnabled &&
                (FirmaWebConfiguration.FirmaEnvironment.FirmaEnvironmentType == FirmaEnvironmentType.Local ||
                 CurrentFirmaSession.IsSitkaAdministrator());
            ShowEnvironmentLabel    = FirmaWebConfiguration.FirmaEnvironment.FirmaEnvironmentType != FirmaEnvironmentType.Prod;
            ShowEnvironmentDropdown =
                FirmaWebConfiguration.FirmaEnvironment.FirmaEnvironmentType == FirmaEnvironmentType.Local ||
                CurrentFirmaSession.IsSitkaAdministrator();
            FirmaIncludesViewData = new FirmaIncludesViewData();
        }
Esempio n. 30
0
 public ReleaseNotesViewData(FirmaSession currentFirmaSession,
                             List <ProjectFirmaModels.Models.ReleaseNote> notes,
                             string addNoteUrl,
                             string entityName,
                             bool canEditNotes,
                             ProjectFirmaModels.Models.FirmaPage releaseNotesFirmaPage) :
     base(currentFirmaSession, releaseNotesFirmaPage)
 {
     PageTitle    = "Release Notes";
     Notes        = notes;
     AddNoteUrl   = addNoteUrl;
     EntityName   = entityName;
     CanEditNotes = canEditNotes;
 }