protected ProjectCreateViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Project project, string currentSectionDisplayName, ProposalSectionsStatus proposalSectionsStatus) : this(currentFirmaSession, project, currentSectionDisplayName, false) { Check.Assert(project != null, "Project should be created in database by this point so it cannot be null."); Check.Assert(currentSectionDisplayName.Equals("Instructions", StringComparison.InvariantCultureIgnoreCase) || currentSectionDisplayName.Equals("Basics", StringComparison.InvariantCultureIgnoreCase) || proposalSectionsStatus.IsBasicsSectionComplete, $"Can't access this section of the Proposal - You must complete the basics first ({project.GetEditUrl()})"); CurrentPersonCanWithdraw = new ProjectCreateFeature().HasPermission(currentFirmaSession, project).HasPermission; Project = project; ProposalSectionsStatus = proposalSectionsStatus; CanAdvanceStage = ProposalSectionsStatus.AreAllSectionsValidForProject(project, CurrentFirmaSession); // ReSharper disable PossibleNullReferenceException ProjectStateIsValidInWizard = project.ProjectApprovalStatus == ProjectApprovalStatus.Draft || project.ProjectApprovalStatus == ProjectApprovalStatus.Returned || project.ProjectApprovalStatus == ProjectApprovalStatus.PendingApproval; // ReSharper restore PossibleNullReferenceException IsInstructionsPage = currentSectionDisplayName.Equals("Instructions", StringComparison.InvariantCultureIgnoreCase); InstructionsPageUrl = project.ProjectStage == ProjectStage.Proposal ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsProposal(project.ProjectID)) : SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsEnterHistoric(project.ProjectID)); var fieldDefinitionLabelForProject = FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel(); var pageTitle = project.ProjectStage == ProjectStage.Proposal ? $"Propose {fieldDefinitionLabelForProject}" : $"Add {fieldDefinitionLabelForProject}"; PageTitle = $"{pageTitle}: {project.GetDisplayName()}"; ProposalDetailUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(x => x.Detail(project)); ProposalBasicsUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID)); ProposalAttachmentsAndNotesUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.AttachmentsAndNotes(project.ProjectID)); ProposalPhotosUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Photos(project.ProjectID)); SubmitUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Submit(project)); ApproveUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Approve(project)); ReturnUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Return(project)); WithdrawUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Withdraw(project)); RejectUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Reject(project)); TrainingUrl = SitkaRoute <HomeController> .BuildUrlFromExpression(x => x.Training()); ProjectStage = project.ProjectStage; HasCustomAttributesEditableByUser = project.HasEditableCustomAttributes(currentFirmaSession); }
protected ProjectCreateViewData(Person currentPerson, Models.Project project, string currentSectionDisplayName, ProposalSectionsStatus proposalSectionsStatus) : this(project, currentPerson, currentSectionDisplayName) { IsInstructionsPage = currentSectionDisplayName.Equals("Instructions", StringComparison.InvariantCultureIgnoreCase); bool isBasicsPage = currentSectionDisplayName.Equals("Basics", StringComparison.InvariantCultureIgnoreCase); Check.Assert(project != null, "Project should be created in database by this point so it cannot be null."); // SLG- See Story #1506 - Causing us much grief, perhaps the disease is really better than this cure? We know the Project record exists, is that maybe enough? // This whole expression seems like it had multiple errors in it, giving up on it for now, I don't understand what it is trying to do. // We can't get it to crash once this is removed, so, to heck with it for now. //Check.Assert(IsInstructionsPage || isBasicsPage || proposalSectionsStatus.IsBasicsSectionComplete, $"Can't access this section of the Proposal - You must complete the basics first ({project.GetEditUrl()})"); CurrentPersonCanWithdraw = new ProjectCreateFeature().HasPermission(currentPerson, project).HasPermission; Project = project; ProjectStage = project.ProjectStage; ProposalSectionsStatus = proposalSectionsStatus; CanAdvanceStage = ProposalSectionsStatus.AreAllSectionsValidForProject(project); // ReSharper disable PossibleNullReferenceException ProjectStateIsValidInWizard = project.ProjectApprovalStatus == ProjectApprovalStatus.Draft || project.ProjectApprovalStatus == ProjectApprovalStatus.Returned || project.ProjectApprovalStatus == ProjectApprovalStatus.PendingApproval; InstructionsPageUrl = project.ProjectStage == ProjectStage.Proposed ? SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsProposal(project.ProjectID)) : SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.InstructionsEnterHistoric(project.ProjectID)); var pagetitle = project.ProjectStage == ProjectStage.Proposed ? $"{Models.FieldDefinition.Application.GetFieldDefinitionLabel()}" : $"Add {Models.FieldDefinition.Project.GetFieldDefinitionLabel()}"; PageTitle = $"{pagetitle}: {project.DisplayName}"; ProposalDetailUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(x => x.Detail(project)); ProposalBasicsUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.EditBasics(project.ProjectID)); ProposalNotesUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.DocumentsAndNotes(project.ProjectID)); ProposalPhotosUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Photos(project.ProjectID)); SubmitUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Submit(project)); ApproveUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Approve(project)); ReturnUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Return(project)); WithdrawUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Withdraw(project)); RejectUrl = SitkaRoute <ProjectCreateController> .BuildUrlFromExpression(x => x.Reject(project)); }