public ProjectUpdateViewData(FirmaSession currentFirmaSession, ProjectUpdateBatch projectUpdateBatch, ProjectUpdateStatus projectUpdateStatus, List <string> validationWarnings, string currentSectionDisplayName) : base(currentFirmaSession, null) { IsInstructionsPage = currentSectionDisplayName.Equals("Instructions", StringComparison.InvariantCultureIgnoreCase); InstructionsPageUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.Instructions(projectUpdateBatch.Project)); ProjectWorkflowSectionGroupings = ProjectWorkflowSectionGrouping.All.OrderBy(x => x.SortOrder).ToList(); if (!MultiTenantHelpers.TrackAccomplishments()) { ProjectWorkflowSectionGroupings = ProjectWorkflowSectionGroupings.Where(x => x != ProjectWorkflowSectionGrouping.Accomplishments).ToList(); } ProjectUpdateBatch = projectUpdateBatch; Project = projectUpdateBatch.Project; PrimaryContactPerson = projectUpdateBatch.Project.GetPrimaryContact(); EntityName = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} Update"; PageTitle = $"Update: {Project.GetDisplayName()}"; ProjectUpdateMyProjectsUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.MyProjectsRequiringAnUpdate()); ProjectUpdateHistoryUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.History(Project)); DeleteProjectUpdateUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.DeleteProjectUpdate(Project)); SubmitUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.Submit(Project)); ApproveUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.Approve(Project)); ReturnUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.Return(Project)); ProvideFeedbackUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(x => x.UpdateFeedback()); TrainingUrl = SitkaRoute <HomeController> .BuildUrlFromExpression(x => x.Training()); var isApprover = new ProjectUpdateAdminFeatureWithProjectContext().HasPermission(currentFirmaSession, Project).HasPermission; ShowApproveAndReturnButton = projectUpdateBatch.IsSubmitted() && isApprover; IsEditable = projectUpdateBatch.InEditableState() || ShowApproveAndReturnButton; IsReadyToApprove = projectUpdateBatch.IsReadyToApprove(); AreProjectBasicsValid = projectUpdateBatch.AreProjectBasicsValid(); HasCustomAttributesEditableByUser = projectUpdateBatch.Project.HasEditableCustomAttributes(CurrentFirmaSession); //Neuter UpdateStatus for non-approver users until we go live with "Show Changes" for all users. ProjectUpdateStatus = currentFirmaSession.Person.IsApprover() ? projectUpdateStatus : new ProjectUpdateStatus(false, false, false, false, false, false, false, false, false, false, false, false, false, false, false); HasUpdateStarted = ModelObjectHelpers.IsRealPrimaryKeyValue(projectUpdateBatch.ProjectUpdateBatchID); ValidationWarnings = validationWarnings; CurrentSectionDisplayName = currentSectionDisplayName; }
private ProjectCreateViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Project project, string currentSectionDisplayName, // This just here to distinguish this signature uniquely. This is a hack, and deserves fixing. bool bogusParm) : base(currentFirmaSession) { EntityName = $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabel()}"; ProposalListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(x => x.Proposed()); ProvideFeedbackUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(x => x.ProposalFeedback()); CurrentPersonIsSubmitter = new ProjectCreateFeature().HasPermissionByFirmaSession(currentFirmaSession); CurrentPersonIsApprover = project != null && new ProjectApproveFeature().HasPermission(currentFirmaSession, project).HasPermission; ProjectWorkflowSectionGroupings = ProjectWorkflowSectionGrouping.All.OrderBy(x => x.SortOrder).ToList(); if (!MultiTenantHelpers.TrackAccomplishments()) { ProjectWorkflowSectionGroupings = ProjectWorkflowSectionGroupings.Where(x => x != ProjectWorkflowSectionGrouping.Accomplishments).ToList(); } CurrentSectionDisplayName = currentSectionDisplayName; TrainingUrl = SitkaRoute <HomeController> .BuildUrlFromExpression(x => x.Training()); }