コード例 #1
0
        public static bool IsAllowed <T>(SitkaRoute <T> sitkaRoute, FirmaSession currentFirmaSession) where T : Controller
        {
            var firmaFeatureLookupAttribute = sitkaRoute.Body.Method.GetCustomAttributes(typeof(FirmaBaseFeature), true).Cast <FirmaBaseFeature>().SingleOrDefault();

            Check.RequireNotNull(firmaFeatureLookupAttribute, $"Could not find feature for {sitkaRoute.BuildUrlFromExpression()}");
            // ReSharper disable PossibleNullReferenceException
            return(firmaFeatureLookupAttribute.HasPermissionByFirmaSession(currentFirmaSession));
            // ReSharper restore PossibleNullReferenceException
        }
コード例 #2
0
        public static string GetSectionUrl(this ProjectCreateSection projectCreateSection, Project project)
        {
            if (project == null)
            {
                return(null);
            }
            switch (projectCreateSection.ToEnum)
            {
            case ProjectCreateSectionEnum.Basics:
                return(SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID)));

            case ProjectCreateSectionEnum.CustomAttributes:
                return(SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.ProjectCustomAttributes(project.ProjectID)));

            case ProjectCreateSectionEnum.LocationSimple:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditLocationSimple(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.Organizations:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Organizations(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.Contacts:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Contacts(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.LocationDetailed:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditLocationDetailed(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.ExpectedAccomplishments:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.ExpectedPerformanceMeasures(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.ReportedAccomplishments:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.PerformanceMeasures(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.Budget:
                return(ProjectCreateSection.Basics.IsComplete(project)
                        ? MultiTenantHelpers.GetTenantAttributeFromCache().BudgetType == BudgetType.AnnualBudgetByCostType
                            ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.ExpectedFundingByCostType(project.ProjectID))
                            : UnsupportedBudgetMode.UnsupportedBudgetModeWarning
                        : null);

            //case ProjectCreateSectionEnum.ReportedExpenditures:
            //    return ProjectCreateSection.Basics.IsComplete(project)
            //        ? MultiTenantHelpers.GetTenantAttributeFromCache().BudgetType == BudgetType.AnnualBudgetByCostType
            //            ? SitkaRoute<ProjectCreateController>.BuildUrlFromExpression(x => x.ExpendituresByCostType(project.ProjectID))
            //            : SitkaRoute<ProjectCreateController>.BuildUrlFromExpression(x => x.Expenditures(project.ProjectID))
            //        : null;
            case ProjectCreateSectionEnum.Classifications:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditClassifications(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.Assessment:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditAssessment(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.Photos:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Photos(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.AttachmentsAndNotes:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.AttachmentsAndNotes(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.BulkSetSpatialInformation:
                return(ProjectCreateSection.Basics.IsComplete(project) ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.BulkSetSpatialInformation(project.ProjectID)) : null);

            case ProjectCreateSectionEnum.PartnerFinder:
                return(SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.PartnerFinder(project)));

            case ProjectCreateSectionEnum.ExternalLinks:
                return(SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.ExternalLinks(project)));

            default:
                throw new ArgumentOutOfRangeException($"IsComplete(): Unhandled ProjectCreateSection Enum: {projectCreateSection.ToEnum}");
            }
        }
コード例 #3
0
        public static List <ProjectSectionSimple> GetProjectCreateSections(this ProjectWorkflowSectionGrouping projectWorkflowSectionGrouping, Project project, bool ignoreStatus, bool hasEditableCustomAttributes)
        {
            switch (projectWorkflowSectionGrouping.ToEnum)
            {
            case ProjectWorkflowSectionGroupingEnum.Overview:
                // remove the custom attributes section from the overview section to begin with
                var projectCreateSectionForOverview = projectWorkflowSectionGrouping.ProjectCreateSections.Except(new List <ProjectCreateSection> {
                    ProjectCreateSection.CustomAttributes
                }).ToList();
                // If there are custom attribute types for this tenant, we can add the section back
                if (hasEditableCustomAttributes)
                {
                    projectCreateSectionForOverview.Add(ProjectCreateSection.CustomAttributes);
                }
                return(GetProjectCreateSectionsImpl(project, projectCreateSectionForOverview, ignoreStatus));

            case ProjectWorkflowSectionGroupingEnum.AdditionalData:
                var projectCreateSectionsForAdditionalData = projectWorkflowSectionGrouping.ProjectCreateSections.Except(new List <ProjectCreateSection> {
                    ProjectCreateSection.Assessment
                }).ToList();

                if (HttpRequestStorage.DatabaseEntities.AssessmentQuestions.Any())
                {
                    projectCreateSectionsForAdditionalData.Add(ProjectCreateSection.Assessment);
                }
                return(GetProjectCreateSectionsImpl(project, projectCreateSectionsForAdditionalData, ignoreStatus));

            case ProjectWorkflowSectionGroupingEnum.Financials:
                var projectCreateSectionsForExpenditures = projectWorkflowSectionGrouping.ProjectCreateSections.Except(new List <ProjectCreateSection> {
                    ProjectCreateSection.Budget
                }).ToList();
                if (project != null && project.IsExpectedFundingRelevant())
                {
                    projectCreateSectionsForExpenditures.Add(ProjectCreateSection.Budget);
                }

                //if (project != null && project.AreReportedExpendituresRelevant())
                //{
                //    projectCreateSectionsForExpenditures.Add(ProjectCreateSection.ReportedExpenditures);
                //}
                return(GetProjectCreateSectionsImpl(project, projectCreateSectionsForExpenditures, ignoreStatus));

            case ProjectWorkflowSectionGroupingEnum.Accomplishments:
                if (project == null)
                {
                    return(new List <ProjectSectionSimple>());
                }

                if (project.AreReportedPerformanceMeasuresRelevant())
                {
                    return(GetProjectCreateSectionsImpl(project, new List <ProjectCreateSection> {
                        ProjectCreateSection.ExpectedAccomplishments, ProjectCreateSection.ReportedAccomplishments
                    }, ignoreStatus));
                }

                return(GetProjectCreateSectionsImpl(project, new List <ProjectCreateSection> {
                    ProjectCreateSection.ExpectedAccomplishments
                }, ignoreStatus));

            case ProjectWorkflowSectionGroupingEnum.SpatialInformation:
                var geospatialAreaTypes = HttpRequestStorage.DatabaseEntities.GeospatialAreaTypes;
                var createSections      = projectWorkflowSectionGrouping.ProjectCreateSections.Except(new List <ProjectCreateSection> {
                    ProjectCreateSection.BulkSetSpatialInformation
                }).ToList();
                if (geospatialAreaTypes.Count() > 1)
                {
                    createSections.Add(ProjectCreateSection.BulkSetSpatialInformation);
                }
                var projectCreateSections = GetProjectCreateSectionsImpl(project, createSections, ignoreStatus);
                //this sort order is used to figure navigation across all sections. Setting this to the BulkSetSpatialInformation sort order because it is currently the only section in the DB for spatial information
                int maxSortOrder = ProjectCreateSection.BulkSetSpatialInformation.SortOrder;
                IEnumerable <ProjectSectionSimple> projectSectionSimples;
                if (project == null)
                {
                    projectSectionSimples = geospatialAreaTypes
                                            .OrderBy(x => x.GeospatialAreaTypeName).ToList().Select((geospatialAreaType, index) =>
                                                                                                    new ProjectSectionSimple(geospatialAreaType.GeospatialAreaTypeNamePluralized,
                                                                                                                             maxSortOrder + index + 1,
                                                                                                                             false, projectWorkflowSectionGrouping,
                                                                                                                             string.Empty,
                                                                                                                             false, false));
                }
                else
                {
                    projectSectionSimples = geospatialAreaTypes
                                            .OrderBy(x => x.GeospatialAreaTypeName).ToList().Select((geospatialAreaType, index) =>
                                                                                                    new ProjectSectionSimple(geospatialAreaType.GeospatialAreaTypeNamePluralized,
                                                                                                                             maxSortOrder + index + 1,
                                                                                                                             true, projectWorkflowSectionGrouping,
                                                                                                                             SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(y =>
                                                                                                                                                                                          y.EditGeospatialArea(project, geospatialAreaType)),
                                                                                                                             !ignoreStatus && geospatialAreaType.IsProjectGeospatialAreaValid(project), false));
                }

                projectCreateSections.AddRange(projectSectionSimples);
                return(projectCreateSections);

            // Partner Finder
            case ProjectWorkflowSectionGroupingEnum.Partners:
                List <ProjectCreateSection> projectCreateSectionsForPartnerFinder = new List <ProjectCreateSection>();
                if (MultiTenantHelpers.GetTenantAttributeFromCache().EnableMatchmaker)
                {
                    projectCreateSectionsForPartnerFinder.AddRange(projectWorkflowSectionGrouping.ProjectCreateSections.ToList());
                }
                return(GetProjectCreateSectionsImpl(project, projectCreateSectionsForPartnerFinder, ignoreStatus));

            default:
                throw new ArgumentOutOfRangeException($"Unhandled Workflow Section Grouping: {projectWorkflowSectionGrouping.ToEnum}");
            }
        }
コード例 #4
0
ファイル: OVTASection.cs プロジェクト: sitkatech/neptune
 public override string GetSectionUrl(OnlandVisualTrashAssessment ovta)
 {
     return(ovta == null ? null : SitkaRoute <OnlandVisualTrashAssessmentController> .BuildUrlFromExpression(x => x.FinalizeOVTA(ovta)));
 }
コード例 #5
0
 public static string GetDetailUrl(this Classification classification)
 {
     return(SitkaRoute <ClassificationController> .BuildUrlFromExpression(t => t.Detail(classification)));
 }
コード例 #6
0
 public static string GetDeleteUrl(this ContactRelationshipType contactRelationshipType)
 {
     return(SitkaRoute <ContactRelationshipTypeController> .BuildUrlFromExpression(c =>
                                                                                   c.DeleteContactRelationshipType(contactRelationshipType.ContactRelationshipTypeID)));
 }
コード例 #7
0
        public DetailViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Project project,
                              List <ProjectStage> projectStages,
                              ProjectBasicsViewData projectBasicsViewData, ProjectLocationSummaryViewData projectLocationSummaryViewData,
                              ProjectBudgetSummaryViewData projectBudgetSummaryViewData,
                              ProjectBudgetsAnnualViewData projectBudgetsAnnualViewData,
                              ProjectBudgetsAnnualByCostTypeViewData projectBudgetsAnnualByCostTypeViewData,
                              TechnicalAssistanceRequestsDetailViewData technicalAssistanceRequestDetailViewData,
                              PerformanceMeasureExpectedSummaryViewData performanceMeasureExpectedSummaryViewData,
                              PerformanceMeasureReportedValuesGroupedViewData performanceMeasureReportedValuesGroupedViewData,
                              ProjectExpendituresDetailViewData projectExpendituresDetailViewData,
                              ProjectExpendituresByCostTypeDetailViewData projectExpendituresByCostTypeDetailViewData,
                              ImageGalleryViewData imageGalleryViewData, EntityNotesViewData projectNotesViewData,
                              EntityNotesViewData internalNotesViewData,
                              EntityExternalLinksViewData entityExternalLinksViewData,
                              ProjectBasicsTagsViewData projectBasicsTagsViewData, bool userHasProjectAdminPermissions,
                              bool userHasEditProjectPermissions, bool userHasProjectUpdatePermissions,
                              bool userHasPerformanceMeasureActualManagePermissions, string mapFormID,
                              string editProjectCustomAttributesUrl,
                              string editSimpleProjectLocationUrl, string editDetailedProjectLocationUrl,
                              string editProjectOrganizationsUrl, string editPerformanceMeasureExpectedsUrl,
                              string editPerformanceMeasureActualsUrl, string editReportedExpendituresUrl,
                              bool reportFinancialsByCostType, AuditLogsGridSpec auditLogsGridSpec, string auditLogsGridDataUrl,
                              string editExternalLinksUrl, ProjectNotificationGridSpec projectNotificationGridSpec,
                              string projectNotificationGridName, string projectNotificationGridDataUrl, bool userCanEditProposal,
                              ProjectOrganizationsDetailViewData projectOrganizationsDetailViewData,
                              ProjectPotentialPartnerDetailViewData projectPotentialPartnerDetailViewData,
                              List <ProjectFirmaModels.Models.ClassificationSystem> classificationSystems,
                              string editProjectBoundingBoxFormID, List <GeospatialAreaType> geospatialAreaTypes,
                              DisplayProjectCustomAttributesViewData displayProjectCustomAttributeTypesViewData,
                              ProjectContactsDetailViewData projectContactsDetailViewData, string editProjectContactsUrl,
                              string editExpectedFundingUrl, ProjectTimelineDisplayViewData projectTimelineDisplayViewData,
                              bool userHasProjectTimelinePermissions, List <ProjectEvaluation> projectEvaluationsUserHasAccessTo,
                              bool userHasStartUpdateWorkflowPermission)
            : base(currentFirmaSession, project)
        {
            PageTitle       = project.GetDisplayName();
            BreadCrumbTitle = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Detail";
            ProjectStages   = projectStages;

            EditProjectUrl = project.GetEditUrl();
            UserHasProjectAdminPermissions = userHasProjectAdminPermissions;
            UserHasEditProjectPermissions  = userHasEditProjectPermissions;
            UserHasPerformanceMeasureActualManagePermissions = userHasPerformanceMeasureActualManagePermissions;
            UserHasProjectTimelinePermissions = userHasProjectTimelinePermissions;
            CanLaunchProjectOrProposalWizard  = userHasStartUpdateWorkflowPermission;
            WithdrawUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(c => c.Withdraw(project));

            var projectAlerts          = new List <string>();
            var proposedProjectListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Proposed());

            var backToAllProposalsText = "Back to all Proposals";
            var pendingProjectsListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.Pending());

            var backToAllPendingProjectsText = $"Back to all Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}";

            var currentPerson = currentFirmaSession.Person;

            if (project.IsRejected())
            {
                var projectApprovalStatus = project.ProjectApprovalStatus;
                ProjectUpdateButtonText =
                    projectApprovalStatus == ProjectApprovalStatus.Draft ||
                    projectApprovalStatus == ProjectApprovalStatus.Returned
                        ? $"Edit Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}"
                        : $"Review Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}";
                ProjectWizardUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID));

                if (project.IsProposal())
                {
                    ProjectListUrl     = proposedProjectListUrl;
                    BackToProjectsText = backToAllProposalsText;
                }
                else if (project.IsPendingProject())
                {
                    ProjectListUrl     = pendingProjectsListUrl;
                    BackToProjectsText = backToAllPendingProjectsText;
                }

                if (userHasProjectAdminPermissions || currentPerson.CanStewardProject(project))
                {
                    projectAlerts.Add(
                        $"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} was rejected and can no longer be edited. It can be deleted, or preserved for archival purposes.");
                }
            }
            else if (project.IsProposal())
            {
                var projectApprovalStatus = project.ProjectApprovalStatus;
                ProjectUpdateButtonText =
                    projectApprovalStatus == ProjectApprovalStatus.Draft ||
                    projectApprovalStatus == ProjectApprovalStatus.Returned
                        ? "Edit Proposal"
                        : "Review Proposal";
                ProjectWizardUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID));

                ProjectListUrl     = proposedProjectListUrl;
                BackToProjectsText = backToAllProposalsText;
                if ((projectApprovalStatus == ProjectApprovalStatus.Draft || projectApprovalStatus == ProjectApprovalStatus.Returned) && (userHasProjectAdminPermissions || userHasStartUpdateWorkflowPermission))
                {
                    projectAlerts.Add(
                        $"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} is in the Proposal stage. Any edits to this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} must be made using the Add New {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} workflow.");
                }
                else if (projectApprovalStatus == ProjectApprovalStatus.PendingApproval)
                {
                    if (userHasProjectAdminPermissions || currentPerson.IsPersonAProjectOwnerWhoCanStewardProjects() && currentPerson.CanStewardProject(project))
                    {
                        projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has been submitted and is awaiting review.");
                    }
                    else if (userHasStartUpdateWorkflowPermission)
                    {
                        projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has been submitted, no change can be made.");
                        CanLaunchProjectOrProposalWizard = false;
                        ShowWithdrawProjectButton        = true;
                    }
                }
            }
            else if (project.IsPendingProject())
            {
                var projectApprovalStatus = project.ProjectApprovalStatus;
                ProjectUpdateButtonText =
                    projectApprovalStatus == ProjectApprovalStatus.Draft ||
                    projectApprovalStatus == ProjectApprovalStatus.Returned
                        ? $"Edit Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}"
                        : $"Review Pending {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}";
                ProjectWizardUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID));

                ProjectListUrl     = pendingProjectsListUrl;
                BackToProjectsText = backToAllPendingProjectsText;
                if ((projectApprovalStatus == ProjectApprovalStatus.Draft || projectApprovalStatus == ProjectApprovalStatus.Returned) && (userHasProjectAdminPermissions || userHasStartUpdateWorkflowPermission))
                {
                    projectAlerts.Add(
                        $"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} is pending. Any edits to this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} must be made using the Add New {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} workflow.");
                }
                else if (projectApprovalStatus == ProjectApprovalStatus.PendingApproval)
                {
                    if (userHasProjectAdminPermissions || currentPerson.IsPersonAProjectOwnerWhoCanStewardProjects() && currentPerson.CanStewardProject(project))
                    {
                        projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has been submitted and is awaiting review.");
                    }
                    else if (userHasStartUpdateWorkflowPermission)
                    {
                        projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} is pending, no change can be made.");
                        CanLaunchProjectOrProposalWizard = false;
                        ShowWithdrawProjectButton        = true;
                    }
                }
            }
            else
            {
                var latestUpdateState = project.GetLatestUpdateStateResilientToDuplicateUpdateBatches();
                ProjectUpdateButtonText =
                    latestUpdateState == ProjectUpdateState.Submitted ||
                    latestUpdateState == ProjectUpdateState.Returned
                        ? "Review Update"
                        : $"Update {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}";
                ProjectWizardUrl   = project.GetProjectUpdateUrl();
                ProjectListUrl     = FullProjectListUrl;
                BackToProjectsText = $"Back to all {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}";


                if (currentPerson.IsPersonAProjectOwnerWhoCanStewardProjects())
                {
                    if (currentPerson.CanStewardProject(project))
                    {
                        projectAlerts.Add(
                            $"You are a {FieldDefinitionEnum.ProjectSteward.ToType().GetFieldDefinitionLabel()} for this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}. You may edit this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} by using the <i class=\"glyphicon glyphicon-edit\"></i> icon on each panel.<br/>");
                    }
                    else
                    {
                        projectAlerts.Add(
                            $"You are a {FieldDefinitionEnum.ProjectSteward.ToType().GetFieldDefinitionLabel()}, but not for this {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}. You may only edit {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} that are associated with your {FieldDefinitionEnum.ProjectStewardshipArea.ToType().GetFieldDefinitionLabel()}.");
                    }
                }
            }

            if (ProjectModelExtensions.GetLatestNotApprovedUpdateBatch(project) != null)
            {
                if (userHasEditProjectPermissions)
                {
                    projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has an Update in progress. Changes made through this page will be overwritten when the Update is approved.");
                }
                else
                {
                    projectAlerts.Add($"This {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} has an Update in progress.");
                }
            }

            ProjectAlerts = projectAlerts;

            ProjectBasicsViewData     = projectBasicsViewData;
            ProjectBasicsTagsViewData = projectBasicsTagsViewData;

            EditProjectCustomAttributesUrl = editProjectCustomAttributesUrl;

            ProjectLocationSummaryViewData = projectLocationSummaryViewData;
            MapFormID = mapFormID;
            EditSimpleProjectLocationUrl   = editSimpleProjectLocationUrl;
            EditDetailedProjectLocationUrl = editDetailedProjectLocationUrl;

            EditProjectBoundingBoxUrl = SitkaRoute <ProjectLocationController> .BuildUrlFromExpression(c => c.EditProjectBoundingBox(project));

            EditProjectBoundingBoxFormID = editProjectBoundingBoxFormID;

            EditProjectOrganizationsUrl = editProjectOrganizationsUrl;

            PerformanceMeasureExpectedSummaryViewData = performanceMeasureExpectedSummaryViewData;
            EditPerformanceMeasureExpectedsUrl        = editPerformanceMeasureExpectedsUrl;

            PerformanceMeasureReportedValuesGroupedViewData = performanceMeasureReportedValuesGroupedViewData;
            EditPerformanceMeasureActualsUrl = editPerformanceMeasureActualsUrl;

            ProjectBudgetSummaryViewData           = projectBudgetSummaryViewData;
            ProjectBudgetsAnnualViewData           = projectBudgetsAnnualViewData;
            ProjectBudgetsAnnualByCostTypeViewData = projectBudgetsAnnualByCostTypeViewData;
            EditTechnicalAssistanceRequestsUrl     = SitkaRoute <TechnicalAssistanceRequestController> .BuildUrlFromExpression(c => c.EditTechnicalAssistanceRequestsForProject(project));

            TechnicalAssistanceRequestDetailViewData = technicalAssistanceRequestDetailViewData;
            EditExpectedFundingUrl = editExpectedFundingUrl;

            ProjectExpendituresDetailViewData           = projectExpendituresDetailViewData;
            ProjectExpendituresByCostTypeDetailViewData = projectExpendituresByCostTypeDetailViewData;
            EditReportedExpendituresUrl = editReportedExpendituresUrl;
            GeospatialAreaTypes         = geospatialAreaTypes;
            DisplayProjectCustomAttributeTypesViewData = displayProjectCustomAttributeTypesViewData;
            EditExternalLinksUrl = editExternalLinksUrl;
            ImageGalleryViewData = imageGalleryViewData;

            ProjectNotesViewData  = projectNotesViewData;
            InternalNotesViewData = internalNotesViewData;

            EntityExternalLinksViewData = entityExternalLinksViewData;

            ProjectUpdateBatchGridSpec = new ProjectUpdateBatchGridSpec
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Update",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Updates",
                SaveFiltersInCookie = true
            };
            ProjectUpdateBatchGridName    = "projectUpdateBatch";
            ProjectUpdateBatchGridDataUrl =
                SitkaRoute <ProjectController> .BuildUrlFromExpression(x =>
                                                                       x.ProjectUpdateBatchGridJsonData(project.ProjectID));

            ReportFinancialsByCostType = reportFinancialsByCostType;

            AuditLogsGridSpec    = auditLogsGridSpec;
            AuditLogsGridName    = "projectAuditLogsGrid";
            AuditLogsGridDataUrl = auditLogsGridDataUrl;

            ProjectNotificationGridSpec        = projectNotificationGridSpec;
            ProjectNotificationGridName        = projectNotificationGridName;
            ProjectNotificationGridDataUrl     = projectNotificationGridDataUrl;
            ProjectOrganizationsDetailViewData = projectOrganizationsDetailViewData;

            // Potential Partner panel
            ProjectPotentialPartnerDetailViewData = projectPotentialPartnerDetailViewData;

            ProjectContactsDetailViewData = projectContactsDetailViewData;
            EditProjectContactsUrl        = editProjectContactsUrl;

            EditProjectGeospatialAreaFormID = ProjectGeospatialAreaController.GetEditProjectGeospatialAreasFormID();

            ProjectStewardCannotEditUrl =
                SitkaRoute <ProjectController> .BuildUrlFromExpression(c => c.ProjectStewardCannotEdit());

            ProjectStewardCannotEditPendingApprovalUrl =
                SitkaRoute <ProjectController> .BuildUrlFromExpression(c =>
                                                                       c.ProjectStewardCannotEditPendingApproval(project));

            ClassificationSystems = classificationSystems;

            ProjectAttachmentsDetailViewData = new ProjectAttachmentsDetailViewData(
                EntityAttachment.CreateFromProjectAttachment(project.ProjectAttachments),
                SitkaRoute <ProjectAttachmentController> .BuildUrlFromExpression(x => x.New(project)),
                project.ProjectName,
                new ProjectEditAsAdminFeature().HasPermission(currentFirmaSession, project).HasPermission,
                project.GetAllAttachmentTypes().ToList(),
                currentFirmaSession);

            ProjectTimelineDisplayViewData = projectTimelineDisplayViewData;

            ProjectEvaluationsUserHasAccessTo = projectEvaluationsUserHasAccessTo;

            ShowFactSheetButton = OfferProjectFactSheetLinkFeature.OfferProjectFactSheetLink(currentFirmaSession, project);
        }
コード例 #8
0
        public override string GetSectionUrl(Project project)
        {
            var projectUpdateBatch = project.GetLatestNotApprovedUpdateBatch();

            return(ModelObjectHelpers.IsRealPrimaryKeyValue(projectUpdateBatch.ProjectUpdateBatchID) ? SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.LocationDetailed(project)) : null);
        }
コード例 #9
0
 public string GetContentUrl()
 {
     return(SitkaRoute <FieldDefinitionController> .BuildUrlFromExpression(x => x.FieldDefinitionDetailsForClassificationSystem(ClassificationSystemID)));
 }
コード例 #10
0
        public ContactRelationshipTypeGridSpec(bool hasManagePermissions)
        {
            var basicsColumnGroupCount = 5;

            if (hasManagePermissions)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), true, x.CanDelete()), 30, DhtmlxGridColumnFilterType.None);
                Add(string.Empty, a => DhtmlxGridHtmlHelpers.MakeLtInfoEditIconAsModalDialogLinkBootstrap(new ModalDialogForm(SitkaRoute <ContactRelationshipTypeController> .BuildUrlFromExpression(t => t.EditContactRelationshipType(a)),
                                                                                                                              $"Edit {FieldDefinitionEnum.ProjectContactRelationshipType.ToType().GetFieldDefinitionLabel()} \"{a.ContactRelationshipTypeName}\"")),
                    30, DhtmlxGridColumnFilterType.None);
                basicsColumnGroupCount += 2;
            }

            Add($"{FieldDefinitionEnum.ProjectContactRelationshipType.ToType().GetFieldDefinitionLabel()} Name", a => a.ContactRelationshipTypeName, 240);
            Add(FieldDefinitionEnum.ContactRelationshipTypeAcceptsMultipleValues.ToType().ToGridHeaderString(), a => a.ContactRelationshipTypeAcceptsMultipleValues.ToCheckboxImageOrEmptyForGrid(), 120);
            Add(FieldDefinitionEnum.IsContactRelationshipTypeRequired.ToType().ToGridHeaderString(), a => a.IsContactRelationshipTypeRequired.ToCheckboxImageOrEmptyForGrid(), 120);
            Add(FieldDefinitionEnum.CanContactTypeManageProject.ToType().ToGridHeaderString(), a => a.CanManageProject.ToCheckboxImageOrEmptyForGrid(), 120);
            Add("If Contact Relationship Type is required, Minimum Project Stage to require by", a => a.IsContactRelationshipRequiredMinimumProjectStage != null ? a.IsContactRelationshipRequiredMinimumProjectStage.ProjectStageDisplayName : string.Empty, 300);
        }
コード例 #11
0
 public string GetDeleteUrl()
 {
     return(SitkaRoute <TreatmentBMPAssessmentController> .BuildUrlFromExpression(c =>
                                                                                  c.DeletePhoto(TreatmentBMPAssessmentPhotoID)));
 }
コード例 #12
0
 private static string EditCostAuthorityObligationRequestsUrl(this ProjectFirmaModels.Models.ObligationRequest obligationRequest)
 {
     return(SitkaRoute <ObligationRequestController> .BuildUrlFromExpression(x => x.EditCostAuthorityObligationRequests(obligationRequest.PrimaryKey)));
 }
コード例 #13
0
        private void BasicProjectInfoGridSpec_Impl(FirmaSession currentFirmaSession,
                                                   bool allowTaggingFunctionality,
                                                   ProjectFirmaModels.Models.CostAuthority costAuthorityWorkBreakdownStructure,
                                                   ProjectFirmaModels.Models.Agreement agreement)
        {
            var userHasTagManagePermissions = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);

            if (userHasTagManagePermissions && allowTaggingFunctionality)
            {
                BulkTagModalDialogForm = new BulkTagModalDialogForm(
                    SitkaRoute <TagController> .BuildUrlFromExpression(x => x.BulkTagProjects(null)),
                    $"Tag Checked {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}",
                    $"Tag {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}");
                AddCheckBoxColumn();
                Add("ProjectID", x => x.ProjectID, 0);
            }

            Add(string.Empty,
                x => UrlTemplate.MakeHrefString(x.GetFactSheetUrl(), FirmaDhtmlxGridHtmlHelpers.FactSheetIcon.ToString()), 30,
                DhtmlxGridColumnFilterType.None);
            Add(FieldDefinitionEnum.ProjectName.ToType().ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 300, DhtmlxGridColumnFilterType.Html);
            if (costAuthorityWorkBreakdownStructure != null)
            {
                Add($"Is {costAuthorityWorkBreakdownStructure.GetDisplayName()} Primary or Secondary CAWBS for this project?",
                    x => x.CostAuthorityProjects.Any(rcap =>
                                                     rcap.IsPrimaryProjectCawbs && rcap.CostAuthorityID ==
                                                     costAuthorityWorkBreakdownStructure.CostAuthorityID)
                        ? "Primary"
                        : "Secondary", 70, DhtmlxGridColumnFilterType.SelectFilterStrict);
            }

            if (agreement != null)
            {
                Add(FieldDefinitionEnum.PrimaryCostAuthorityWorkBreakdownStructure.ToType().ToGridHeaderString(), x => x.CostAuthorityProjects.SingleOrDefault(rcap => rcap.IsPrimaryProjectCawbs)?.CostAuthority.GetDetailLinkUsingCostAuthorityWorkBreakdownStructure(), 120, DhtmlxGridColumnFilterType.Html);

                Add(FieldDefinitionEnum.SecondaryCostAuthorityWorkBreakdownStructure.ToType().ToGridHeaderStringPlural(), x => GetSecondaryCostAuthorityAsCommaDelimitedList(x), 200, DhtmlxGridColumnFilterType.Text);
            }

            if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship())
            {
                Add(FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().ToGridHeaderString(),
                    x => x.GetCanStewardProjectsOrganization().GetShortNameAsUrl(), 150,
                    DhtmlxGridColumnFilterType.Html);
            }

            Add(FieldDefinitionEnum.IsPrimaryContactOrganization.ToType().ToGridHeaderString(),
                x => x.GetPrimaryContactOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html);
            Add(FieldDefinitionEnum.ProjectStage.ToType().ToGridHeaderString(), x => x.ProjectStage.ProjectStageDisplayName, 90,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.PlanningDesignStartYear.ToType().ToGridHeaderString(), x => x.GetPlanningDesignStartYear(),
                90, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.ImplementationStartYear.ToType().ToGridHeaderString(), x => x.GetImplementationStartYear(),
                115, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.CompletionYear.ToType().ToGridHeaderString(), x => x.GetCompletionYear(), 90,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.FundingType.ToType().ToGridHeaderString(),
                x => x.FundingType?.FundingTypeDisplayName ?? string.Empty, 300, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionEnum.EstimatedTotalCost.ToType().ToGridHeaderString(),
                x => x.GetEstimatedTotalRegardlessOfFundingType(), 110, DhtmlxGridColumnFormatType.Currency,
                DhtmlxGridColumnAggregationType.Total);

            Add(FieldDefinitionEnum.ProjectedFunding.ToType().ToGridHeaderString(), x => x.GetProjectedFunding(), 100,
                DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
            Add(FieldDefinitionEnum.NoFundingSourceIdentified.ToType().ToGridHeaderString(),
                x => x.GetNoFundingSourceIdentifiedAmount(), 110, DhtmlxGridColumnFormatType.Currency,
                DhtmlxGridColumnAggregationType.Total);
            foreach (var geospatialAreaType in new List <GeospatialAreaType>())
            {
                Add($"{geospatialAreaType.GeospatialAreaTypeNamePluralized}",
                    a => a.GetProjectGeospatialAreaNamesAsHyperlinks(geospatialAreaType), 350, DhtmlxGridColumnFilterType.Html);
            }

            Add(FieldDefinitionEnum.ProjectDescription.ToType().ToGridHeaderString(), x => x.ProjectDescription, 300);
            if (userHasTagManagePermissions)
            {
                Add("Tags",
                    x => new HtmlString(!x.ProjectTags.Any()
                        ? string.Empty
                        : string.Join(", ", x.ProjectTags.Select(pt => pt.Tag.GetDisplayNameAsUrl()))), 100,
                    DhtmlxGridColumnFilterType.Html);
            }
        }
コード例 #14
0
 public CustomPageGridSpec(bool hasManagePermissions)
 {
     if (hasManagePermissions)
     {
         Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), true, true), 30, DhtmlxGridColumnFilterType.None);
         Add(string.Empty, a => DhtmlxGridHtmlHelpers.MakeLtInfoEditIconAsModalDialogLinkBootstrap(new ModalDialogForm(SitkaRoute <CustomPageController> .BuildUrlFromExpression(t => t.Edit(a)),
                                                                                                                       850, "Edit")),
             30, DhtmlxGridColumnFilterType.None);
         Add(string.Empty, a => DhtmlxGridHtmlHelpers.MakeModalDialogLink("<span>Edit Content</span>",
                                                                          SitkaRoute <CustomPageController> .BuildUrlFromExpression(y => y.EditInDialog(a)),
                                                                          800,
                                                                          $"Edit Content for {a.CustomPageDisplayName}",
                                                                          true,
                                                                          "Save",
                                                                          "Cancel",
                                                                          new List <string> {
             "gridButton"
         },
                                                                          null,
                                                                          null), 80, DhtmlxGridColumnFilterType.None);
     }
     Add("Menu", a => a.FirmaMenuItem.GetFirmaMenuItemDisplayName(), 110, DhtmlxGridColumnFilterType.Text);
     Add("Page Name", a => !a.IsDisabled() ? UrlTemplate.MakeHrefString(a.GetAboutPageUrl(), a.CustomPageDisplayName) : new HtmlString($"{a.CustomPageDisplayName}"), 180, DhtmlxGridColumnFilterType.Text);
     Add("Has Content", a => a.HasPageContent().ToYesNo(), 85, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionEnum.CustomPageViewableBy.ToType().ToGridHeaderString(), a => a.GetViewableRolesAsListOfStrings(), 400, DhtmlxGridColumnFilterType.Text);
     Add("CustomPageID", a => a.CustomPageID, 0);
 }
コード例 #15
0
 public override string GetHomeUrl()
 {
     return(SitkaRoute <Controllers.HomeController> .BuildUrlFromExpression(hc => hc.Index()) + "#welcome");
 }
コード例 #16
0
 private static LtInfoMenuItem BuildResultsMenu(Person currentPerson)
 {
     return(new LtInfoMenuItem(SitkaRoute <HomeController> .BuildUrlFromExpression(c => c.Index()), "Results", true, true, null));
 }
コード例 #17
0
 public override string GetHomeUrl()
 {
     return(SitkaRoute <Areas.Modeling.Controllers.HomeController> .BuildUrlFromExpression(hc => hc.Index()));
 }
コード例 #18
0
 public static string GetEditGeospatialAreasUrl(this GeospatialAreaType geospatialAreaType, Project project)
 {
     return(SitkaRoute <ProjectGeospatialAreaController> .BuildUrlFromExpression(x =>
                                                                                 x.EditProjectGeospatialAreas(project.ProjectID, geospatialAreaType.GeospatialAreaTypeID)));
 }
コード例 #19
0
        private ViewResult ViewEdit(EditViewModel viewModel, CustomAttributeType customAttributeType)
        {
            var instructionsNeptunePage = NeptunePage.GetNeptunePageByPageType(NeptunePageType.ManageCustomAttributeTypeInstructions);
            var customAttributeInstructionsNeptunePage = NeptunePage.GetNeptunePageByPageType(NeptunePageType.ManageCustomAttributeInstructions);

            var submitUrl = ModelObjectHelpers.IsRealPrimaryKeyValue(viewModel.CustomAttributeTypeID) ? SitkaRoute <CustomAttributeTypeController> .BuildUrlFromExpression(x => x.Edit(viewModel.CustomAttributeTypeID)) : SitkaRoute <CustomAttributeTypeController> .BuildUrlFromExpression(x => x.New());

            var viewData = new EditViewData(CurrentPerson, MeasurementUnitType.All, CustomAttributeDataType.All, submitUrl, instructionsNeptunePage, customAttributeInstructionsNeptunePage, customAttributeType);

            return(RazorView <Edit, EditViewData, EditViewModel>(viewData, viewModel));
        }
コード例 #20
0
        public ViewResult ProjectMap()
        {
            List <int> filterValues;
            ProjectLocationFilterType projectLocationFilterType;
            ProjectColorByType        colorByValue;

            var currentPersonCanViewProposals = CurrentPerson.CanViewProposals;

            if (!String.IsNullOrEmpty(Request.QueryString[ProjectMapCustomization.FilterByQueryStringParameter]))
            {
                projectLocationFilterType = ProjectLocationFilterType.ToType(Request
                                                                             .QueryString[ProjectMapCustomization.FilterByQueryStringParameter]
                                                                             .ParseAsEnum <ProjectLocationFilterTypeEnum>());
            }
            else
            {
                projectLocationFilterType = ProjectMapCustomization.DefaultLocationFilterType;
            }

            if (!String.IsNullOrEmpty(Request.QueryString[ProjectMapCustomization.FilterValuesQueryStringParameter]))
            {
                var filterValuesAsString = Request.QueryString[ProjectMapCustomization.FilterValuesQueryStringParameter]
                                           .Split(',');
                filterValues = filterValuesAsString.Select(Int32.Parse).ToList();
            }
            else
            {
                filterValues = ProjectMapCustomization.GetDefaultLocationFilterValues(currentPersonCanViewProposals);
            }

            if (!String.IsNullOrEmpty(Request.QueryString[ProjectMapCustomization.ColorByQueryStringParameter]))
            {
                colorByValue = ProjectColorByType.ToType(Request
                                                         .QueryString[ProjectMapCustomization.ColorByQueryStringParameter]
                                                         .ParseAsEnum <ProjectColorByTypeEnum>());
            }
            else
            {
                colorByValue = ProjectMapCustomization.DefaultColorByType;
            }

            var firmaPage = FirmaPage.GetFirmaPageByPageType(FirmaPageType.ProjectMap);

            var projectsToShow = ProjectMapCustomization.ProjectsForMap(CurrentPerson);

            var initialCustomization =
                new ProjectMapCustomization(projectLocationFilterType, filterValues, colorByValue);
            var projectLocationsLayerGeoJson =
                new LayerGeoJson($"{FieldDefinition.ProjectLocation.GetFieldDefinitionLabel()}",
                                 Project.MappedPointsToGeoJsonFeatureCollection(projectsToShow, true, true), "red", 1,
                                 LayerInitialVisibility.Show);
            var projectLocationsMapInitJson = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson, initialCustomization, "ProjectLocationsMap");

            projectLocationsMapInitJson.Layers.AddRange(HttpRequestStorage.DatabaseEntities.Organizations.GetBoundaryLayerGeoJson());

            var interactionEventLayer = HttpRequestStorage.DatabaseEntities.InteractionEvents.GetInteractionEventsLayerGeoJson();

            projectLocationsMapInitJson.Layers.Add(interactionEventLayer);
            projectLocationsMapInitJson.Layers.Add(MapInitJson.GetWashingtonCountyLayer());
            projectLocationsMapInitJson.Layers.Add(MapInitJson.GetWashingtonLegislativeDistrictLayer());


            var projectLocationsMapViewData = new ProjectLocationsMapViewData(projectLocationsMapInitJson.MapDivID,
                                                                              colorByValue.DisplayName,
                                                                              MultiTenantHelpers.GetTopLevelTaxonomyTiers(),
                                                                              currentPersonCanViewProposals);


            var projectLocationFilterTypesAndValues = CreateProjectLocationFilterTypesAndValuesDictionary(currentPersonCanViewProposals);
            var projectLocationsUrl = SitkaRoute <ResultsController> .BuildAbsoluteUrlHttpsFromExpression(x => x.ProjectMap());

            var filteredProjectsWithLocationAreasUrl =
                SitkaRoute <ResultsController> .BuildUrlFromExpression(x => x.FilteredProjectsWithLocationAreas(null));

            var projectMapLocationJsons = new List <ProjectMapLocationJson>();
            var filteredProjectList     = projectsToShow.Where(x1 => x1.HasProjectLocationPoint).Where(x => x.ProjectStage.ShouldShowOnMap()).ToList();

            projectMapLocationJsons = filteredProjectList.ToList().Select(p => new ProjectMapLocationJson(p)).ToList();

            var viewData = new ProjectMapViewData(CurrentPerson,
                                                  firmaPage,
                                                  projectLocationsMapInitJson,
                                                  projectLocationsMapViewData,
                                                  projectLocationFilterTypesAndValues,
                                                  projectLocationsUrl,
                                                  filteredProjectsWithLocationAreasUrl,
                                                  projectMapLocationJsons);

            return(RazorView <ProjectMap, ProjectMapViewData>(viewData));
        }
コード例 #21
0
 public static string GetEditGeospatialAreaPerformanceMeasureTargetUrl(this GeospatialArea geospatialArea, PerformanceMeasure performanceMeasure)
 {
     return(SitkaRoute <GeospatialAreaPerformanceMeasureTargetController> .BuildUrlFromExpression(t => t.Edit(geospatialArea.GeospatialAreaID, performanceMeasure.PerformanceMeasureID)));
 }
コード例 #22
0
ファイル: IndexViewData.cs プロジェクト: sitkatech/alevin
        public IndexViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, string gridDataUrl, List <SelectListItem> activeOnlyOrAllUsersSelectListItems) : base(currentFirmaSession, firmaPage)
        {
            PageTitle = "Users";
            GridSpec  = new IndexGridSpec(currentFirmaSession)
            {
                ObjectNameSingular = "User", ObjectNamePlural = "Users", SaveFiltersInCookie = true
            };
            GridName      = "UserGrid";
            GridDataUrl   = gridDataUrl;
            InviteUserUrl = SitkaRoute <UserController> .BuildUrlFromExpression(x => x.Invite());

            CreateAccountUrl = FirmaWebConfiguration.AuthenticationType == AuthenticationType.LocalAuth ? SitkaRoute <UserController> .BuildUrlFromExpression(x => x.CreateAccount()) : string.Empty;

            UserIsFirmaAdmin = new FirmaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession);

            ActiveOnlyOrAllUsersSelectListItems = activeOnlyOrAllUsersSelectListItems;
            ShowOnlyActiveOrAll = "ShowOnlyActiveOrAll";
        }
コード例 #23
0
ファイル: OVTASection.cs プロジェクト: sitkatech/neptune
 public override string GetSectionUrl(OnlandVisualTrashAssessment ovta)
 {
     return(ovta == null ? SitkaRoute <OnlandVisualTrashAssessmentController> .BuildUrlFromExpression(x => x.InitiateOVTA(null)) : SitkaRoute <OnlandVisualTrashAssessmentController> .BuildUrlFromExpression(x => x.InitiateOVTA(ovta.OnlandVisualTrashAssessmentID)));
 }
コード例 #24
0
        public ManageProjectCustomGridsViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage,
                                                List <ProjectCustomGridConfiguration> projectCustomDefaultGridConfigurations,
                                                List <ProjectCustomGridConfiguration> projectCustomFullGridConfigurations,
                                                List <ProjectCustomGridConfiguration> projectCustomReportsGridConfigurations)
            : base(currentFirmaSession, firmaPage)
        {
            PageTitle = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Custom Grids";
            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    = "projectsCustomDefaultGrid";
            ProjectCustomDefaultGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.AllActiveProjectsCustomGridDefaultJsonData());

            CustomizeDefaultGridUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.EditProjectCustomGrid(1));

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

            if (currentFirmaSession.Person.RoleID == ProjectFirmaModels.Models.Role.ProjectSteward.RoleID)
            {
                ProjectCustomFullGridSpec.CreateEntityModalDialogForm = new ModalDialogForm(SitkaRoute <ProjectController> .BuildUrlFromExpression(tc => tc.DenyCreateProject()), $"New {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}");
            }
            ProjectCustomFullGridName    = "projectsCustomFullGrid";
            ProjectCustomFullGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.AllActiveProjectsCustomGridFullJsonData());

            CustomizeFullGridUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.EditProjectCustomGrid(2));


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

            if (currentFirmaSession.Person.RoleID == ProjectFirmaModels.Models.Role.ProjectSteward.RoleID)
            {
                ProjectCustomReportsGridSpec.CreateEntityModalDialogForm = new ModalDialogForm(SitkaRoute <ProjectController> .BuildUrlFromExpression(tc => tc.DenyCreateProject()), $"New {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}");
            }
            ProjectCustomReportsGridName    = "projectsCustomReportsGrid";
            ProjectCustomReportsGridDataUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.AllActiveProjectsAndProposalsCustomGridReportsJsonData());

            CustomizeReportsGridUrl = SitkaRoute <ProjectCustomGridController> .BuildUrlFromExpression(tc => tc.EditProjectCustomGrid(3));
        }
コード例 #25
0
 public static string GetDeleteUrl(this Classification classification)
 {
     return(SitkaRoute <ClassificationController> .BuildUrlFromExpression(c => c.DeleteClassification(classification.ClassificationID)));
 }
コード例 #26
0
        public string GetDetailUrl()
        {
            var urlTemplateString = SitkaRoute <DNRUplandRegionController> .BuildUrlFromExpression(t => t.Detail(UrlTemplate.Parameter1Int));

            return(urlTemplateString.Replace(UrlTemplate.Parameter1Int.ToString(), this.DNRUplandRegionID.ToString()));
        }
コード例 #27
0
        public static List <ProjectSectionSimple> GetProjectUpdateSections(this ProjectWorkflowSectionGrouping projectWorkflowSectionGrouping,
                                                                           FirmaSession currentFirmaSession,
                                                                           ProjectUpdateBatch projectUpdateBatch,
                                                                           ProjectUpdateStatus projectUpdateStatus,
                                                                           bool ignoreStatus,
                                                                           bool hasEditableCustomAttributes)
        {
            switch (projectWorkflowSectionGrouping.ToEnum)
            {
            case ProjectWorkflowSectionGroupingEnum.Overview:
                // remove the custom attributes section from the overview section to begin with
                var projectUpdateSectionForCustomAttributes = projectWorkflowSectionGrouping.ProjectUpdateSections.Except(new List <ProjectUpdateSection> {
                    ProjectUpdateSection.CustomAttributes
                }).ToList();
                // If there are custom attribute types for this tenant, we can add the section back
                if (hasEditableCustomAttributes)
                {
                    projectUpdateSectionForCustomAttributes.Add(ProjectUpdateSection.CustomAttributes);
                }
                return(GetProjectUpdateSectionsImpl(projectUpdateBatch, projectUpdateSectionForCustomAttributes, projectUpdateStatus, ignoreStatus));

            case ProjectWorkflowSectionGroupingEnum.SpatialInformation:
                var geospatialAreaTypes = HttpRequestStorage.DatabaseEntities.GeospatialAreaTypes;
                var updateSections      = projectWorkflowSectionGrouping.ProjectUpdateSections.Except(new List <ProjectUpdateSection> {
                    ProjectUpdateSection.BulkSetSpatialInformation
                }).ToList();
                if (geospatialAreaTypes.Count() > 1)
                {
                    updateSections.Add(ProjectUpdateSection.BulkSetSpatialInformation);
                }
                var projectUpdateSections = GetProjectUpdateSectionsImpl(projectUpdateBatch, updateSections, projectUpdateStatus, ignoreStatus);
                //Bulk Set is the only section setup for spatial areas in the DB. so we always want to start with that sort order
                int maxSortOrder = ProjectUpdateSection.BulkSetSpatialInformation.SortOrder;
                projectUpdateSections.AddRange(geospatialAreaTypes
                                               .OrderBy(x => x.GeospatialAreaTypeName).ToList().Select((geospatialAreaType, index) =>
                                                                                                       new ProjectSectionSimple(geospatialAreaType.GeospatialAreaTypeNamePluralized, maxSortOrder + index + 1,
                                                                                                                                !projectUpdateBatch.IsNew(), projectWorkflowSectionGrouping,
                                                                                                                                projectUpdateBatch.IsNew() ? null :
                                                                                                                                SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(y =>
                                                                                                                                                                                             y.GeospatialArea(projectUpdateBatch.Project, geospatialAreaType)),
                                                                                                                                projectUpdateStatus != null && projectUpdateBatch.IsProjectGeospatialAreaValid(geospatialAreaType),
                                                                                                                                projectUpdateStatus != null && IsGeospatialAreaUpdated(projectUpdateBatch, geospatialAreaType)
                                                                                                                                )));
                return(projectUpdateSections);

            case ProjectWorkflowSectionGroupingEnum.Accomplishments:
                var projectUpdateSectionsForPerformanceMeasures = projectWorkflowSectionGrouping.ProjectUpdateSections.Except(new List <ProjectUpdateSection> {
                    ProjectUpdateSection.ReportedAccomplishments
                }).ToList();
                if (projectUpdateBatch.AreAccomplishmentsRelevant())
                {
                    projectUpdateSectionsForPerformanceMeasures.Add(ProjectUpdateSection.ReportedAccomplishments);
                }
                return(GetProjectUpdateSectionsImpl(projectUpdateBatch, projectUpdateSectionsForPerformanceMeasures, projectUpdateStatus, ignoreStatus));

            case ProjectWorkflowSectionGroupingEnum.Financials:
                var projectUpdateSectionsForExpenditures = projectWorkflowSectionGrouping.ProjectUpdateSections.Except(new List <ProjectUpdateSection> {
                    ProjectUpdateSection.Budget
                }).ToList();
                if (projectUpdateBatch.Project.IsExpectedFundingRelevant())
                {
                    projectUpdateSectionsForExpenditures.Add(ProjectUpdateSection.Budget);
                }
                return(GetProjectUpdateSectionsImpl(projectUpdateBatch, projectUpdateSectionsForExpenditures, projectUpdateStatus, ignoreStatus));

            case ProjectWorkflowSectionGroupingEnum.AdditionalData:
                var additionalDataProjectUpdateSections = projectWorkflowSectionGrouping.ProjectUpdateSections.ToList();

                var sections = GetProjectUpdateSectionsImpl(projectUpdateBatch, additionalDataProjectUpdateSections, projectUpdateStatus, ignoreStatus);
                // Remove Technical Assistance Requests for all tenants except Idaho
                if (!MultiTenantHelpers.UsesTechnicalAssistanceParameters())
                {
                    sections = sections.Where(x => x.SectionDisplayName != ProjectUpdateSection.TechnicalAssistanceRequests.ProjectUpdateSectionDisplayName).ToList();
                }
                return(sections);

            // Partner Finder
            // Whole section is conditional
            case ProjectWorkflowSectionGroupingEnum.Partners:
                bool shouldShowPartnerFinder = new MatchMakerViewPotentialPartnersFeature().HasPermissionForProjectByFirmaSession(currentFirmaSession, projectUpdateBatch.Project);
                if (!shouldShowPartnerFinder)
                {
                    // An empty group won't be shown.
                    return(new List <ProjectSectionSimple>());
                }

                var projectUpdateSectionsForPartners = projectWorkflowSectionGrouping.ProjectUpdateSections.Except(new List <ProjectUpdateSection> {
                    ProjectUpdateSection.Budget
                }).ToList();
                return(GetProjectUpdateSectionsImpl(projectUpdateBatch, projectUpdateSectionsForPartners, projectUpdateStatus, ignoreStatus));

            default:
                throw new ArgumentOutOfRangeException($"Unhandled Workflow Section Grouping: {projectWorkflowSectionGrouping.ToEnum}");
            }
        }
コード例 #28
0
 public InstructionsProposalViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.FirmaPage firmaPage, bool isNewProjectCreate) : base(currentFirmaSession, "Instructions", SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsProposal(null)))
 {
     PageTitle = $"Propose {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}";
     InstructionsViewPageContentViewData = new ViewPageContentViewData(firmaPage, new FirmaPageManageFeature().HasPermission(currentFirmaSession, firmaPage).HasPermission);
     IsNewProjectCreate = isNewProjectCreate;
 }
コード例 #29
0
 public static string GetDeleteFocusAreaUrl(this FocusArea focusArea)
 {
     return(SitkaRoute <FocusAreaController> .BuildUrlFromExpression(t => t.Delete(focusArea.PrimaryKey)));
 }
コード例 #30
0
ファイル: ProjectTimeline.cs プロジェクト: sitkatech/alevin
 public ProjectTimelineProjectStatusChangeEvent(ProjectProjectStatus projectProjectStatus, bool canEditProjectProjectStatus, bool canEditFinalStatusReport)
 {
     Date        = projectProjectStatus.ProjectProjectStatusUpdateDate;
     DateDisplay = Date.ToString("MMM dd, yyyy");
     FiscalYear  = FirmaDateUtilities.CalculateFiscalYearForTenant(Date);
     Quarter     = (Quarter)FirmaDateUtilities.CalculateQuarterForTenant(Date);
     ProjectTimelineEventType       = ProjectTimelineEventType.ProjectStatusChange;
     TimelineEventTypeDisplayName   = projectProjectStatus.IsFinalStatusUpdate ? "Final Status Update" : "Status Updated";
     TimelineEventPersonDisplayName = projectProjectStatus.ProjectProjectStatusCreatePerson.GetPersonDisplayNameWithContactTypesListForProject(projectProjectStatus.Project);
     ProjectTimelineSide            = ProjectTimelineSide.Right;
     EditButton   = ProjectTimeline.MakeProjectStatusEditLinkButton(projectProjectStatus, canEditProjectProjectStatus, canEditFinalStatusReport);
     DeleteButton = ProjectTimeline.MakeProjectStatusDeleteLinkButton(projectProjectStatus, canEditProjectProjectStatus, canEditFinalStatusReport);
     Color        = projectProjectStatus.ProjectStatus.ProjectStatusColor;
     ShowDetailsLinkHtmlString = ProjectTimeline.MakeProjectStatusDetailsLinkButton(projectProjectStatus);
     ProjectProjectStatus      = projectProjectStatus;
     ActionItems = projectProjectStatus.ActionItems.ToList();
     AddActionItemLinkHtmlString = ModalDialogFormHelper.ModalDialogFormLink(string.Format("<span class='glyphicon glyphicon-plus' style='margin-right: 3px'></span>Add {0}", FieldDefinitionEnum.ActionItem.ToType().GetFieldDefinitionLabel()), SitkaRoute <ActionItemController> .BuildUrlFromExpression(c => c.NewForProjectStatus(projectProjectStatus.Project, projectProjectStatus)), string.Format("Add New {0}", FieldDefinitionEnum.ActionItem.ToType().GetFieldDefinitionLabel()), 700, "Add", "Cancel", new List <string> {
     }, null, null);
 }