public LocationDetailedViewData(FirmaSession currentFirmaSession,
                                 ProjectFirmaModels.Models.Project project,
                                 ProposalSectionsStatus proposalSectionsStatus,
                                 ProjectLocationDetailViewData projectLocationDetailViewData)
     : base(currentFirmaSession, project, ProjectCreateSection.LocationDetailed.ProjectCreateSectionDisplayName, proposalSectionsStatus)
 {
     ProjectLocationDetailViewData = projectLocationDetailViewData;
     ShowCommentsSection           = project.IsPendingApproval() || (project.BasicsComment != null &&
                                                                     project.ProjectApprovalStatus == ProjectApprovalStatus.Returned);
     CanEditComments = project.IsPendingApproval() && new ProjectEditAsAdminRegardlessOfStageFeature().HasPermission(currentFirmaSession, project).HasPermission;
 }
Exemple #2
0
        public void UpdateModel(ProjectFirmaModels.Models.Project project, FirmaSession currentFirmaSession)
        {
            if (ImportExternalProjectStagingID.HasValue)
            {
                var importExternalProjectStagingToDelete = HttpRequestStorage.DatabaseEntities.ImportExternalProjectStagings.Single(x =>
                                                                                                                                    x.ImportExternalProjectStagingID == ImportExternalProjectStagingID);
                HttpRequestStorage.DatabaseEntities.AllImportExternalProjectStagings.Remove(importExternalProjectStagingToDelete);
            }

            project.ProposingPersonID = currentFirmaSession.PersonID;
            // NO. You should not directly try to change the TaxonomyLeaf this way. Use override, as shown below.
            // Incorrect code left in because it keeps cropping up. -- SLG
            //project.GetTaxonomyLeaf().TaxonomyLeafID = TaxonomyLeafID ?? ModelObjectHelpers.NotYetAssignedID;
            project.OverrideTaxonomyLeafID = TaxonomyLeafID ?? ModelObjectHelpers.NotYetAssignedID;
            project.ProjectID               = ProjectID ?? ModelObjectHelpers.NotYetAssignedID;
            project.ProjectName             = ProjectName;
            project.ProjectDescription      = ProjectDescription;
            project.ProjectStageID          = ProjectStageID ?? ModelObjectHelpers.NotYetAssignedID;
            project.PlanningDesignStartYear = PlanningDesignStartYear;
            project.ImplementationStartYear = ImplementationStartYear;
            project.CompletionYear          = CompletionYear;
            project.ProjectCategoryID       = (int)ProjectCategoryEnum;
            project.BpaProjectNumber        = BpaProjectNumber;

            if (project.ProjectApprovalStatus == ProjectApprovalStatus.PendingApproval)
            {
                project.BasicsComment = Comments;
            }

            var secondaryProjectTaxonomyLeavesToUpdate = SecondaryProjectTaxonomyLeafIDs
                                                         .Select(x => new SecondaryProjectTaxonomyLeaf(project.ProjectID, x)
            {
                TenantID = HttpRequestStorage.Tenant.TenantID
            })
                                                         .ToList();

            project.SecondaryProjectTaxonomyLeafs.Merge(
                secondaryProjectTaxonomyLeavesToUpdate,
                HttpRequestStorage.DatabaseEntities.AllSecondaryProjectTaxonomyLeafs.Local,
                (a, b) => a.TaxonomyLeafID == b.TaxonomyLeafID && a.ProjectID == b.ProjectID,
                HttpRequestStorage.DatabaseEntities);

            // If this is the first time saving the project, and if the current person belongs to a primary contact organization, prepopulate.
            if (project.ProjectID == ModelObjectHelpers.NotYetAssignedID && !currentFirmaSession.IsAnonymousUser() && currentFirmaSession.Person.Organization.CanBeAPrimaryContactOrganization())
            {
                var primaryContactRelationshipTypes = HttpRequestStorage.DatabaseEntities.OrganizationRelationshipTypes
                                                      .Where(x => x.IsPrimaryContact).ToList();
                var primaryContactOrganizationRelationshipTypeIDs = primaryContactRelationshipTypes.Select(x => x.OrganizationRelationshipTypeID).ToList();

                project.PrimaryContactPersonID = currentFirmaSession.Person.Organization.PrimaryContactPersonID;
                project.ProjectOrganizations   = primaryContactOrganizationRelationshipTypeIDs.Select(x =>
                                                                                                      new ProjectOrganization(project.ProjectID, currentFirmaSession.Person.OrganizationID, x)).ToList();
            }
        }
Exemple #3
0
 public BulkSetSpatialInformationViewData(FirmaSession currentFirmaSession,
                                          ProjectFirmaModels.Models.Project project,
                                          ProposalSectionsStatus proposalSectionStatus,
                                          BulkSetProjectSpatialInformationViewData quickSetViewData)
     : base(currentFirmaSession,
            project,
            ProjectCreateSection.BulkSetSpatialInformation.ProjectCreateSectionDisplayName,
            proposalSectionStatus)
 {
     BulkSetProjectSpatialInformationViewData = quickSetViewData;
 }
 public void UpdateModel(ProjectFirmaModels.Models.Project project)
 {
     foreach (var projectAssessmentQuestion in project.ProjectAssessmentQuestions)
     {
         projectAssessmentQuestion.DeleteFull(HttpRequestStorage.DatabaseEntities);
     }
     foreach (var simple in ProjectAssessmentQuestionSimples)
     {
         project.ProjectAssessmentQuestions.Add(new ProjectFirmaModels.Models.ProjectAssessmentQuestion(simple));
     }
 }
 public ExpectedPerformanceMeasureValuesViewData(FirmaSession currentFirmaSession,
                                                 ProjectFirmaModels.Models.Project project,
                                                 ProposalSectionsStatus proposalSectionsStatus,
                                                 EditPerformanceMeasureExpectedViewData editPerformanceMeasureExpectedViewData)
     : base(currentFirmaSession, project, ProjectCreateSection.ExpectedAccomplishments.ProjectCreateSectionDisplayName, proposalSectionsStatus)
 {
     EditPerformanceMeasureExpectedViewData = editPerformanceMeasureExpectedViewData;
     ShowCommentsSection = project.IsPendingApproval() || (project.BasicsComment != null &&
                                                           project.ProjectApprovalStatus == ProjectApprovalStatus.Returned);
     CanEditComments = project.IsPendingApproval() && new ProjectEditAsAdminRegardlessOfStageFeature().HasPermission(currentFirmaSession, project).HasPermission;
 }
Exemple #6
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);
        }
            public ViewDataForAngularClass(ProjectFirmaModels.Models.Project project,
                                           List <FundingSourceSimple> allFundingSources,
                                           List <int> requiredCalendarYearRange)
            {
                RequiredCalendarYearRange = requiredCalendarYearRange;
                AllFundingSources         = allFundingSources;
                ProjectID = project.ProjectID;

                MaxYear        = FirmaDateUtilities.CalculateCurrentYearToUseForUpToAllowableInputInReporting();
                UseFiscalYears = MultiTenantHelpers.UseFiscalYears();
            }
Exemple #8
0
 public PartnerFinderProjectCreateViewData(FirmaSession currentFirmaSession,
                                           ProjectFirmaModels.Models.Project project,
                                           ProposalSectionsStatus proposalSectionStatus
                                           )
     : base(currentFirmaSession,
            project,
            ProjectCreateSection.PartnerFinder.ProjectCreateSectionDisplayName,
            proposalSectionStatus)
 {
     // Our component's view data
     ProjectPotentialPartnerDetailViewData = new ProjectPotentialPartnerDetailViewData(CurrentFirmaSession, project, ProjectPotentialPartnerListDisplayMode.ProjectDetailViewPartialList);
 }
Exemple #9
0
 public AttachmentsAndNotesViewData(FirmaSession currentFirmaSession,
                                    ProjectFirmaModels.Models.Project project,
                                    ProposalSectionsStatus proposalSectionsStatus,
                                    EntityNotesViewData entityNotesViewData,
                                    ProjectAttachmentsDetailViewData projectAttachmentsDetailViewData) : base(currentFirmaSession, project, ProjectCreateSection.AttachmentsAndNotes.ProjectCreateSectionDisplayName, proposalSectionsStatus)
 {
     EntityNotesViewData = entityNotesViewData;
     ProjectAttachmentsDetailViewData = projectAttachmentsDetailViewData;
     ShowCommentsSection = project.IsPendingApproval() || (project.ContactsComment != null &&
                                                           project.ProjectApprovalStatus == ProjectApprovalStatus.Returned);
     CanEditComments = project.IsPendingApproval() && new ProjectEditAsAdminRegardlessOfStageFeature().HasPermission(currentFirmaSession, project).HasPermission;
 }
 private ProjectTaxonomyViewData(ProjectFirmaModels.Models.TaxonomyTrunk taxonomyTrunk, ProjectFirmaModels.Models.TaxonomyBranch taxonomyBranch, ProjectFirmaModels.Models.TaxonomyLeaf taxonomyLeaf, ProjectFirmaModels.Models.Project project, TaxonomyLevel taxonomyLevel)
 {
     TaxonomyLeaf     = taxonomyLeaf;
     TaxonomyTrunk    = taxonomyTrunk;
     TaxonomyBranch   = taxonomyBranch;
     Project          = project;
     IsProject        = Project != null;
     IsTaxonomyLeaf   = TaxonomyLeaf != null && !IsProject;
     IsTaxonomyBranch = TaxonomyBranch != null && !IsTaxonomyLeaf && !IsProject;
     IsTaxonomyTrunk  = TaxonomyTrunk != null && !IsTaxonomyBranch && !IsTaxonomyLeaf && !IsProject;
     TaxonomyLevel    = taxonomyLevel;
 }
Exemple #11
0
        public EditProjectFundingSourceExpendituresViewModel(ProjectFirmaModels.Models.Project project,
                                                             List <ProjectFundingSourceExpenditureBulk> projectFundingSourceExpenditureBulks)
        {
            // Preconditions
            Check.EnsureNotNull(project);
            Check.EnsureNotNull(projectFundingSourceExpenditureBulks);

            ProjectFundingSourceExpenditures = projectFundingSourceExpenditureBulks;
            ExpendituresNote = project.ExpendituresNote;
            ProjectID        = project.ProjectID;
            HasExpenditures  = projectFundingSourceExpenditureBulks.Any();
        }
        public ExpendituresByCostTypeViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Project project, ViewDataForAngularClass viewDataForAngularClass, ProposalSectionsStatus proposalSectionsStatus)
            : base(currentFirmaSession, project, ProjectCreateSection.ReportedExpenditures.ProjectCreateSectionDisplayName, proposalSectionsStatus)
        {
            ViewDataForAngular      = viewDataForAngularClass;
            RequestFundingSourceUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(x => x.MissingFundingSource());

            TotalOperatingCostInYearOfExpenditure     = project.CalculateTotalRemainingOperatingCost();
            StartYearForTotalOperatingCostCalculation = project.StartYearForTotalCostCalculations();
            FieldDefinitionForProject       = FieldDefinitionEnum.Project.ToType();
            FieldDefinitionForFundingSource = FieldDefinitionEnum.FundingSource.ToType();
            FieldDefinitionForCostType      = FieldDefinitionEnum.CostType.ToType();
        }
        public void UpdateModel(ProjectFirmaModels.Models.Project project, ICollection <ProjectFirmaModels.Models.ProjectOrganization> allProjectOrganizations)
        {
            project.PrimaryContactPersonID = PrimaryContactPersonID;

            var projectOrganizationsUpdated = ProjectOrganizationSimples.Where(x => ModelObjectHelpers.IsRealPrimaryKeyValue(x.OrganizationID)).Select(x =>
                                                                                                                                                       new ProjectFirmaModels.Models.ProjectOrganization(project.ProjectID, x.OrganizationID, x.OrganizationRelationshipTypeID)).ToList();

            project.ProjectOrganizations.Merge(projectOrganizationsUpdated,
                                               allProjectOrganizations,
                                               (x, y) => x.ProjectID == y.ProjectID && x.OrganizationID == y.OrganizationID && x.OrganizationRelationshipTypeID == y.OrganizationRelationshipTypeID, HttpRequestStorage.DatabaseEntities);

            project.OtherPartners = OtherPartners;
        }
        public void UpdateModel(ProjectFirmaModels.Models.Project project, FirmaSession currentFirmaSession)
        {
            CheckForNotNullProjectId();
            var fileResourceInfo = FileResourceModelExtensions.CreateNewFromHttpPostedFile(UploadedFile, currentFirmaSession.Person);

            HttpRequestStorage.DatabaseEntities.AllFileResourceInfos.Add(fileResourceInfo);
            var projectAttachment = new ProjectFirmaModels.Models.ProjectAttachment(project.ProjectID, fileResourceInfo.FileResourceInfoID, AttachmentTypeID, DisplayName)
            {
                Description = Description
            };

            project.ProjectAttachments.Add(projectAttachment);
        }
Exemple #15
0
        public EditContactsViewData(ProjectFirmaModels.Models.Project currentProject,
                                    List <Person> allContacts,
                                    List <ProjectFirmaModels.Models.ContactRelationshipType> allContactRelationshipTypes,
                                    FirmaSession currentFirmaSession)
        {
            UserDoingEditingHasAdminPermissions = currentFirmaSession.IsAdministrator();
            AllContacts = allContacts.Select(x => new PersonSimple(x)).ToList();
            // Everyone not inactive or unassigned, OR is current Primary Contact Person
            var currentPrimaryContactPersonID = currentProject.PrimaryContactPerson?.PersonID;

            AllActiveContactsAndPrimaryContactPerson = allContacts.Where(c => (c.IsActive && c.Role != ProjectFirmaModels.Models.Role.Unassigned) || c.PersonID == currentPrimaryContactPersonID).Select(x => new PersonSimple(x)).ToList();
            AllContactRelationshipTypes = allContactRelationshipTypes.Select(x => new ContactRelationshipTypeSimple(currentProject, x)).ToList();
        }
        public EditTechnicalAssistanceRequestsViewModel(ProjectFirmaModels.Models.Project project)
        {
            // Preconditions
            Check.EnsureNotNull(project);

            var technicalAssistanceRequestSimples = new List <TechnicalAssistanceRequestSimple>();

            if (project.TechnicalAssistanceRequests != null)
            {
                technicalAssistanceRequestSimples.AddRange(project.TechnicalAssistanceRequests.Select(x => new TechnicalAssistanceRequestSimple(x)).ToList());
            }
            TechnicalAssistanceRequestSimples = technicalAssistanceRequestSimples;
        }
Exemple #17
0
        public ExpectedFundingViewData(FirmaSession currentFirmaSession,
                                       ProjectFirmaModels.Models.Project project,
                                       ProposalSectionsStatus proposalSectionsStatus,
                                       ViewDataForAngularClass viewDataForAngularClass
                                       ) : base(currentFirmaSession, project, ProjectCreateSection.Budget.ProjectCreateSectionDisplayName, proposalSectionsStatus)
        {
            RequestFundingSourceUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(x => x.MissingFundingSource());

            ViewDataForAngular  = viewDataForAngularClass;
            ShowCommentsSection = project.IsPendingApproval() || (project.BudgetComment != null &&
                                                                  project.ProjectApprovalStatus == ProjectApprovalStatus.Returned);
            CanEditComments = project.IsPendingApproval() && new ProjectEditAsAdminRegardlessOfStageFeature().HasPermission(currentFirmaSession, project).HasPermission;
        }
        private void SetTaxonomyLeaf(ProjectFirmaModels.Models.Project project, FirmaSession currentFirmaSession)
        {
            var currentTaxonomyLeaf = project.GetTaxonomyLeaf();

            // Are we attempting to change the TaxonomyLeaf away from what it is either already overridden to,
            // or away from what it currently calculates to?
            if (currentTaxonomyLeaf?.TaxonomyLeafID != this.TaxonomyLeafID)
            {
                // If so, we need a deliberate override.
                project.OverrideTaxonomyLeafID = this.TaxonomyLeafID;
            }
            // Immediate check for problems
            project.GetTaxonomyLeaf();
        }
Exemple #19
0
        public override void UpdateModel(List <PerformanceMeasureExpected> currentPerformanceMeasureExpecteds,
                                         IList <PerformanceMeasureExpected> allPerformanceMeasureExpecteds,
                                         IList <PerformanceMeasureExpectedSubcategoryOption> allPerformanceMeasureExpectedSubcategoryOptions,
                                         ProjectFirmaModels.Models.Project project)
        {
            project.PerformanceMeasureNotes = PerformanceMeasureNotes;
            if (project.ProjectApprovalStatus == ProjectApprovalStatus.PendingApproval)
            {
                project.ExpectedAccomplishmentsComment = Comments;
            }

            base.UpdateModel(currentPerformanceMeasureExpecteds, allPerformanceMeasureExpecteds,
                             allPerformanceMeasureExpectedSubcategoryOptions, project);
        }
 public EditProjectViewModel(ProjectFirmaModels.Models.Project project, bool hasExistingProjectUpdate)
 {
     TaxonomyLeafID = project.TaxonomyLeafID;
     SecondaryProjectTaxonomyLeafIDs = project.SecondaryProjectTaxonomyLeafs.Select(x => x.TaxonomyLeafID);
     ProjectID                = project.ProjectID;
     ProjectName              = project.ProjectName;
     ProjectDescription       = project.ProjectDescription;
     ProjectStageID           = project.ProjectStageID;
     OldProjectStageID        = project.ProjectStageID;
     ImplementationStartYear  = project.ImplementationStartYear;
     PlanningDesignStartYear  = project.PlanningDesignStartYear;
     CompletionYear           = project.CompletionYear;
     HasExistingProjectUpdate = hasExistingProjectUpdate;
 }
Exemple #21
0
 public BasicsViewModel(ProjectFirmaModels.Models.Project project)
 {
     TaxonomyLeafID = project.TaxonomyLeafID;
     SecondaryProjectTaxonomyLeafIDs = project.SecondaryProjectTaxonomyLeafs.Select(x => x.TaxonomyLeafID);
     ProjectID               = project.ProjectID;
     ProjectName             = project.ProjectName;
     ProjectDescription      = project.ProjectDescription;
     ProjectStageID          = project.ProjectStageID;
     PlanningDesignStartYear = project.PlanningDesignStartYear;
     ImplementationStartYear = project.ImplementationStartYear;
     CompletionYear          = project.CompletionYear;
     ProjectCategoryEnum     = project.ProjectCategory.ToEnum;
     Comments = project.BasicsComment;
 }
Exemple #22
0
 public EditProposalClassificationsViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Project project, List <ProjectFirmaModels.Models.ClassificationSystem> classificationSystems, string currentSectionDisplayName, ProposalSectionsStatus proposalSectionsStatus)
     : base(currentFirmaSession, project, currentSectionDisplayName, proposalSectionsStatus)
 {
     ProjectName                      = project.GetDisplayName();
     ClassificationSystems            = classificationSystems;
     FieldDefinitionForProject        = FieldDefinitionEnum.Project.ToType();
     FieldDefinitionForClassification = FieldDefinitionEnum.Classification.ToType();
     if (new SitkaAdminFeature().HasPermissionByFirmaSession(currentFirmaSession))
     {
         ConfigureClassificationSystemsUrl = SitkaRoute <TenantController> .BuildUrlFromExpression(tc => tc.Detail());
     }
     ShowCommentsSection = project.IsPendingApproval() || (project.ProposalClassificationsComment != null &&
                                                           project.ProjectApprovalStatus == ProjectApprovalStatus.Returned);
     CanEditComments = project.IsPendingApproval() && new ProjectEditAsAdminRegardlessOfStageFeature().HasPermission(currentFirmaSession, project).HasPermission;
 }
 public BasicsViewData(FirmaSession currentFirmaSession,
                       ProjectFirmaModels.Models.Project project,
                       ProposalSectionsStatus proposalSectionsStatus,
                       IEnumerable <ProjectFirmaModels.Models.TaxonomyLeaf> taxonomyLeafs,
                       IEnumerable <FundingType> fundingTypes,
                       TenantAttribute tenantAttribute)
     : base(currentFirmaSession, project, ProjectCreateSection.Basics.ProjectCreateSectionDisplayName, proposalSectionsStatus)
 {
     ShowCommentsSection = project.IsPendingApproval() || (project.BasicsComment != null &&
                                                           project.ProjectApprovalStatus == ProjectApprovalStatus.Returned);
     CanEditComments          = project.IsPendingApproval() && new ProjectEditAsAdminRegardlessOfStageFeature().HasPermission(currentFirmaSession, project).HasPermission;
     ShowProjectStageDropDown = project.ProjectStage != ProjectStage.Proposal;
     ProjectDisplayName       = project.GetDisplayName();
     AssignParameters(taxonomyLeafs, fundingTypes, tenantAttribute);
 }
Exemple #24
0
        public ProjectBasicsViewData(ProjectFirmaModels.Models.Project project,
                                     bool userHasProjectBudgetManagePermissions, TaxonomyLevel taxonomyLevel, TenantAttribute tenantAttribute)
        {
            Project = project;
            UserHasProjectBudgetManagePermissions = userHasProjectBudgetManagePermissions;
            IsNotTaxonomyLevelLeaf         = !MultiTenantHelpers.IsTaxonomyLevelLeaf();
            IsNotTaxonomyLevelLeafOrBranch = !MultiTenantHelpers.IsTaxonomyLevelBranch() && IsNotTaxonomyLevelLeaf;
            ProjectTaxonomyViewData        = new ProjectTaxonomyViewData(project, taxonomyLevel);
            TenantAttribute = tenantAttribute;

            if (tenantAttribute.EnableSecondaryProjectTaxonomyLeaf)
            {
                SecondaryTaxonomyLeaves = Project.SecondaryProjectTaxonomyLeafs.Select(x => x.TaxonomyLeaf).OrderBy(x => x.GetDisplayName());
            }
        }
Exemple #25
0
 public EditProjectFundingSourceBudgetByCostTypeViewDataForAngular(ProjectFirmaModels.Models.Project project,
                                                                   List <FundingSourceSimple> allFundingSources,
                                                                   List <CostTypeSimple> allCostTypes,
                                                                   List <int> requiredCalendarYearRange,
                                                                   IEnumerable <SelectListItem> fundingTypes)
 {
     RequiredCalendarYearRange = requiredCalendarYearRange;
     AllFundingSources         = allFundingSources;
     AllCostTypes   = allCostTypes;
     ProjectID      = project.ProjectID;
     FundingTypes   = fundingTypes;
     MaxYear        = FirmaDateUtilities.CalculateCurrentYearToUseForUpToAllowableInputInReporting();
     UseFiscalYears = MultiTenantHelpers.UseFiscalYears();
     ObligationItemBudgetRollUps  = project.GetObligationItemBudgetRollUpByYearAndCostTypeAndFundingSourceSimples();
     ObligationItemInvoiceRollUps = project.GetObligationItemInvoiceRollUpByYearAndCostTypeAndFundingSourceSimples();
 }
        public ProjectAgreementDetailViewData(FirmaSession currentFirmaSession,
                                              ProjectFirmaModels.Models.Project project,
                                              bool userHasProjectAgreementManagePermissions
                                              /*, List<IFundingSourceBudgetAmount> fundingSourceRequestAmounts*/) : base(currentFirmaSession)
        {
            Project = project;
            UserHasProjectAgreementManagePermissions = userHasProjectAgreementManagePermissions;
            AddNewAgreementUrl = "NO_URL_YET";

            var costAuthorities = project.CostAuthorityProjects.Select(x => x.CostAuthority)
                                  .ToList();

            ReclamationAgreements = costAuthorities.SelectMany(ca => ca.AgreementCostAuthorities.Select(rarca => rarca.Agreement)).ToList();

            SecondaryCostAuthorityWorkBreakdownStructures = project.CostAuthorityProjects.Where(x => !x.IsPrimaryProjectCawbs).Select(rcap => rcap.CostAuthority).ToList();
            PrimaryCostAuthorityWorkBreakdownStructure    = project.CostAuthorityProjects.SingleOrDefault(x => x.IsPrimaryProjectCawbs)?.CostAuthority;
        }
        public void UpdateModel(ProjectFirmaModels.Models.Project project,
                                List <ProjectFirmaModels.Models.ProjectFundingSourceBudget> currentProjectFundingSourceBudgets,
                                IList <ProjectFirmaModels.Models.ProjectFundingSourceBudget> allProjectFundingSourceBudgets,
                                List <ProjectFirmaModels.Models.ProjectNoFundingSourceIdentified> currentProjectNoFundingSourceIdentifieds,
                                IList <ProjectFirmaModels.Models.ProjectNoFundingSourceIdentified> allProjectNoFundingSourceIdentifieds)
        {
            project.FundingTypeID = ViewModelForAngular.FundingTypeID;

            var projectProjectNoFundingSourceIdentifiedsUpdated = new List <ProjectFirmaModels.Models.ProjectNoFundingSourceIdentified>();

            if (ViewModelForAngular?.NoFundingSourceIdentifiedYet != null)
            {
                // Completely rebuild the list
                projectProjectNoFundingSourceIdentifiedsUpdated.Add(new ProjectNoFundingSourceIdentified(project.ProjectID)
                {
                    NoFundingSourceIdentifiedYet = ViewModelForAngular.NoFundingSourceIdentifiedYet
                });
            }

            currentProjectNoFundingSourceIdentifieds.Merge(projectProjectNoFundingSourceIdentifiedsUpdated,
                                                           allProjectNoFundingSourceIdentifieds,
                                                           (x, y) => x.ProjectID == y.ProjectID && x.CalendarYear == y.CalendarYear,
                                                           (x, y) =>
            {
                x.NoFundingSourceIdentifiedYet = y.NoFundingSourceIdentifiedYet;
            }, HttpRequestStorage.DatabaseEntities);

            var projectFundingSourceBudgetsUpdated = new List <ProjectFirmaModels.Models.ProjectFundingSourceBudget>();

            if (ViewModelForAngular?.ProjectFundingSourceBudgets != null)
            {
                // Completely rebuild the list
                projectFundingSourceBudgetsUpdated = ViewModelForAngular?.ProjectFundingSourceBudgets
                                                     .Select(x => x.ToProjectFundingSourceBudget()).ToList();
            }

            currentProjectFundingSourceBudgets.Merge(projectFundingSourceBudgetsUpdated,
                                                     allProjectFundingSourceBudgets,
                                                     (x, y) => x.ProjectID == y.ProjectID && x.FundingSourceID == y.FundingSourceID,
                                                     (x, y) =>
            {
                x.SecuredAmount  = y.SecuredAmount;
                x.TargetedAmount = y.TargetedAmount;
            }, HttpRequestStorage.DatabaseEntities);
        }
Exemple #28
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());
        }
        public ExpendituresViewData(FirmaSession currentFirmaSession, ProjectFirmaModels.Models.Project project,
                                    ViewDataForAngularClass viewDataForAngularClass,
                                    ProposalSectionsStatus proposalSectionsStatus)
            : base(currentFirmaSession, project, "OBSOLETE Reported Expenditures", proposalSectionsStatus)
            //: base(currentFirmaSession, project, ProjectCreateSection.ReportedExpenditures.ProjectCreateSectionDisplayName, proposalSectionsStatus)
        {
            ProjectID          = project.ProjectID;
            ViewDataForAngular = viewDataForAngularClass;
            RefreshUrl         = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.RefreshExpenditures(project));

            DiffUrl = SitkaRoute <ProjectUpdateController> .BuildUrlFromExpression(x => x.DiffExpenditures(project));

            RequestFundingSourceUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(x => x.MissingFundingSource());

            ShowCommentsSection = project.IsPendingApproval() || (project.ExpendituresComment != null &&
                                                                  project.ProjectApprovalStatus == ProjectApprovalStatus.Returned);
            CanEditComments = project.IsPendingApproval() && new ProjectEditAsAdminRegardlessOfStageFeature().HasPermission(currentFirmaSession, project).HasPermission;
        }
Exemple #30
0
        public ExpectedFundingByCostTypeViewData(FirmaSession currentFirmaSession,
                                                 ProjectFirmaModels.Models.Project project,
                                                 ProposalSectionsStatus proposalSectionsStatus,
                                                 ViewDataForAngularClass viewDataForAngularClass
                                                 ) : base(currentFirmaSession, project, ProjectCreateSection.Budget.ProjectCreateSectionDisplayName, proposalSectionsStatus)
        {
            RequestFundingSourceUrl = SitkaRoute <HelpController> .BuildUrlFromExpression(x => x.MissingFundingSource());

            ViewDataForAngular                             = viewDataForAngularClass;
            FieldDefinitionForProject                      = FieldDefinitionEnum.Project.ToType();
            FieldDefinitionForFundingSource                = FieldDefinitionEnum.FundingSource.ToType();
            FieldDefinitionForCostType                     = FieldDefinitionEnum.CostType.ToType();
            FieldDefinitionForNoFundingSourceIdentified    = FieldDefinitionEnum.NoFundingSourceIdentified.ToType();
            FieldDefinitionForSecuredFunding               = FieldDefinitionEnum.SecuredFunding.ToType();
            FieldDefinitionForTargetedFunding              = FieldDefinitionEnum.TargetedFunding.ToType();
            FieldDefinitionForPlanningDesignStartYear      = FieldDefinitionEnum.PlanningDesignStartYear.ToType();
            FieldDefinitionForCompletionYear               = FieldDefinitionEnum.CompletionYear.ToType();
            FieldDefinitionForEstimatedTotalCost           = FieldDefinitionEnum.EstimatedTotalCost.ToType();
            FieldDefinitionForEstimatedAnnualOperatingCost = FieldDefinitionEnum.EstimatedAnnualOperatingCost.ToType();
        }