Exemple #1
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());
        }
Exemple #2
0
        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);
        }
Exemple #3
0
        private ProjectCreateViewData(Models.Project project, Person currentPerson, string currentSectionDisplayName) : base(currentPerson)
        {
            EntityName      = $"{Models.FieldDefinition.Application.GetFieldDefinitionLabel()}";
            ProposalListUrl = SitkaRoute <ProjectController> .BuildUrlFromExpression(x => x.Proposed());

            ProvideFeedbackUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(x => x.ProposalFeedback());

            CurrentPersonIsSubmitter        = new ProjectCreateFeature().HasPermissionByPerson(CurrentPerson);
            CurrentPersonIsApprover         = project != null && new ProjectApproveFeature().HasPermission(currentPerson, project).HasPermission;
            ProjectWorkflowSectionGroupings = ProjectWorkflowSectionGrouping.All.OrderBy(x => x.SortOrder).ToList();
            CurrentSectionDisplayName       = currentSectionDisplayName;
        }
Exemple #4
0
        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));
        }
Exemple #5
0
        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();
            CurrentSectionDisplayName       = currentSectionDisplayName;
            TrainingUrl = SitkaRoute <HomeController> .BuildUrlFromExpression(x => x.Training());
        }