public static void SubmitToReviewer(this ProjectUpdateBatch projectUpdateBatch, FirmaSession currentFirmaSession, DateTime transitionDate)
 {
     Check.Require(projectUpdateBatch.IsReadyToSubmit(), $"You cannot submit a {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} update that is not ready to be submitted!");
     projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Submitted, currentFirmaSession, transitionDate);
 }
Example #2
0
 public void UpdateModel(ProjectFirmaModels.Models.TaxonomyBranch taxonomyBranch, FirmaSession currentFirmaSession)
 {
     Check.Ensure(HttpRequestStorage.DatabaseEntities.TaxonomyTrunks.Any(), "No entries in TaxonomyTrunks; is something wrong with db?");
     taxonomyBranch.TaxonomyBranchName = TaxonomyBranchName;
     taxonomyBranch.TaxonomyBranchDescriptionHtmlString = TaxonomyBranchDescription;
     taxonomyBranch.TaxonomyTrunkID = MultiTenantHelpers.IsTaxonomyLevelTrunk()
         ? TaxonomyTrunkID
         : HttpRequestStorage.DatabaseEntities.TaxonomyTrunks.First().TaxonomyTrunkID; // really should only be one
     taxonomyBranch.ThemeColor = ThemeColor;
     if (!ModelObjectHelpers.IsRealPrimaryKeyValue(taxonomyBranch.TaxonomyBranchID))
     {
         // for new branches, set the sort order to greater than the current max for this trunk (or null if no branches have a sort order set)
         var maxSortOrder = HttpRequestStorage.DatabaseEntities.TaxonomyBranches
                            .Where(x => x.TaxonomyTrunkID == taxonomyBranch.TaxonomyTrunkID).Max(x => x.TaxonomyBranchSortOrder);
         taxonomyBranch.TaxonomyBranchSortOrder = maxSortOrder + 1;
     }
 }
        public OrganizationDetailViewData(FirmaSession currentFirmaSession,
                                          ProjectFirmaModels.Models.Organization organization,
                                          MapInitJson mapInitJson,
                                          LayerGeoJson projectLocationsLayerGeoJson,
                                          bool hasSpatialData,
                                          List <ProjectFirmaModels.Models.PerformanceMeasure> performanceMeasures,
                                          ViewGoogleChartViewData expendituresDirectlyFromOrganizationViewGoogleChartViewData,
                                          ViewGoogleChartViewData expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData,
                                          List <MatchmakerTaxonomyTier> topLevelMatchmakerTaxonomyTier,
                                          int maximumTaxonomyLeaves,
                                          OrganizationDetailTab activeTab, MapInitJson matchMakerAreaOfInterestInitJson,
                                          List <IGrouping <ProjectFirmaModels.Models.ClassificationSystem, MatchmakerOrganizationClassification> >
                                          matchmakerClassificationsGroupedByClassificationSystem,
                                          List <ProjectFirmaModels.Models.ClassificationSystem> allClassificationSystems) : base(currentFirmaSession)
        {
            Organization = organization;
            Check.EnsureNotNull(organization);
            PageTitle  = organization.GetDisplayName();
            EntityName = $"{FieldDefinitionEnum.Organization.ToType().GetFieldDefinitionLabel()}";
            UserHasOrganizationManagePermissions = new OrganizationManageFeature().HasPermissionByFirmaSession(currentFirmaSession);
            UserHasOrganizationManagePrimaryContactPermissions = new OrganizationPrimaryContactManageFeature().HasPermissionByFirmaSession(currentFirmaSession);

            EditOrganizationUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Edit(organization));

            EditBoundaryUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditBoundary(organization));

            DeleteOrganizationBoundaryUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    c => c.DeleteOrganizationBoundary(organization));

            EditOrganizationPrimaryContactUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditPrimaryContact(organization));

            AgreementsGridSpec = new AgreementGridSpec(currentFirmaSession)
            {
                ObjectNameSingular  = MultiTenantHelpers.GetAgreementName(),
                ObjectNamePlural    = MultiTenantHelpers.GetAgreementNamePluralized(),
                SaveFiltersInCookie = true
            };

            AgreementsGridName    = "OrganizationAgreementsGrid";
            AgreementsGridDataUrl = SitkaRoute <AgreementController> .BuildUrlFromExpression(c => c.AgreementGridForOrganizationJsonData(this.Organization.OrganizationID));

            ProjectsIncludingLeadImplementingGridSpec =
                new ProjectsIncludingLeadImplementingGridSpec(organization, currentFirmaSession, false)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with {organization.GetDisplayName()}",
                SaveFiltersInCookie = true
            };

            ProjectOrganizationsGridName    = "projectOrganizationsFromOrganizationGrid";
            ProjectOrganizationsGridDataUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    tc => tc.ProjectsIncludingLeadImplementingGridJsonData(organization));

            ProjectStewardOrLeadImplementorFieldDefinitionName = MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship()
                ? FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().GetFieldDefinitionLabel()
                : "Lead Implementer";

            ProjectFundingSourceExpendituresForOrganizationGridSpec =
                new ProjectFundingSourceExpendituresForOrganizationGridSpec(organization)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} {FieldDefinitionEnum.ReportedExpenditure.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} {FieldDefinitionEnum.ReportedExpenditure.ToType().GetFieldDefinitionLabelPluralized()}",
                SaveFiltersInCookie = true
            };

            ProjectFundingSourceExpendituresForOrganizationGridName    = "projectCalendarYearExpendituresForOrganizationGrid";
            ProjectFundingSourceExpendituresForOrganizationGridDataUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    tc => tc.ProjectFundingSourceExpendituresForOrganizationGridJsonData(organization));

            ManageFundingSourcesUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(c => c.Index());

            IndexUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.Index());

            MapInitJson = mapInitJson;
            ProjectLocationsLayerGeoJson = projectLocationsLayerGeoJson;
            HasSpatialData = hasSpatialData;
            ExpendituresDirectlyFromOrganizationViewGoogleChartViewData       = expendituresDirectlyFromOrganizationViewGoogleChartViewData;
            ExpendituresReceivedFromOtherOrganizationsViewGoogleChartViewData = expendituresReceivedFromOtherOrganizationsViewGoogleChartViewData;

            PerformanceMeasureChartViewDatas = performanceMeasures.Select(x => organization.GetPerformanceMeasureChartViewData(x, currentFirmaSession)).ToList();

            NewFundingSourceUrl = SitkaRoute <FundingSourceController> .BuildUrlFromExpression(c => c.New());

            CanCreateNewFundingSource = new FundingSourceCreateFeature().HasPermissionByFirmaSession(currentFirmaSession) &&
                                        (currentFirmaSession.Person.RoleID != ProjectFirmaModels.Models.Role.ProjectSteward.RoleID || // If person is project steward, they can only create funding sources for their organization
                                         currentFirmaSession.Person.OrganizationID == organization.OrganizationID);
            ShowProposals        = currentFirmaSession.CanViewProposals();
            ProposalsPanelHeader = MultiTenantHelpers.ShowProposalsToThePublic()
                ? FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()
                : $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()} (Not Visible to the Public)";

            ProposalsGridSpec =
                new ProjectsIncludingLeadImplementingGridSpec(organization, currentFirmaSession, true)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Proposal.ToType().GetFieldDefinitionLabelPluralized()} associated with {organization.GetDisplayName()}",
                SaveFiltersInCookie = true
            };

            ProposalsGridName    = "proposalsGrid";
            ProposalsGridDataUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    tc => tc.ProposalsGridJsonData(organization));

            ShowPendingProjects = currentFirmaSession.Person.CanViewPendingProjects();

            // If they have no permissions, just say "yes" or "no" if GUID set.
            // If they have manage permissions, show the GUID, otherwise "None".
            bool   hasKeystoneOrganizationGuid = (organization.KeystoneOrganizationGuid != null);
            string hasKeystoneOrganizationGuidBooleanAsString = hasKeystoneOrganizationGuid.ToYesNo();
            string organizationKeystoneGuidAsStringOrNone     = hasKeystoneOrganizationGuid ? organization.KeystoneOrganizationGuid.ToString() : "None";

            OrganizationKeystoneGuidDisplayString = UserHasOrganizationManagePermissions ? organizationKeystoneGuidAsStringOrNone : hasKeystoneOrganizationGuidBooleanAsString;

            PendingProjectsGridSpec =
                new ProjectsIncludingLeadImplementingGridSpec(organization, currentFirmaSession, true)
            {
                ObjectNameSingular  = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()}",
                ObjectNamePlural    = $"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()} associated with {organization.GetDisplayName()}",
                SaveFiltersInCookie = true
            };

            PendingProjectsGridName    = "pendingProjectsGrid";
            PendingProjectsGridDataUrl =
                SitkaRoute <OrganizationController> .BuildUrlFromExpression(
                    tc => tc.PendingProjectsGridJsonData(organization));

            TenantHasCanStewardProjectsOrganizationRelationship = MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship();
            var allAssociatedProjects = Organization.GetAllAssociatedProjects();

            NumberOfStewardedProjects       = allAssociatedProjects.Count(x => x.IsActiveProject() && x.GetCanStewardProjectsOrganization() == Organization);
            NumberOfLeadImplementedProjects = allAssociatedProjects.Count(x => x.IsActiveProject() && x.GetPrimaryContactOrganization() == Organization);
            NumberOfProjectsContributedTo   = allAssociatedProjects.ToList().GetActiveProjects().Count;
            DescriptionViewData             = new ViewPageContentViewData(organization, currentFirmaSession);

            UserHasViewEditProfilePermission = new OrganizationProfileViewEditFeature().HasPermission(currentFirmaSession, organization).HasPermission;

            bool matchmakerEnabledForTenant           = MultiTenantHelpers.GetTenantAttributeFromCache().EnableMatchmaker;
            bool matchmakerOptedInForThisOrganization = Organization.MatchmakerOptIn.HasValue && Organization.MatchmakerOptIn.Value;

            ShowMatchmakerProfileTab        = matchmakerEnabledForTenant;
            ShowMatchmakerProfileTabDetails = matchmakerEnabledForTenant && (UserHasViewEditProfilePermission || matchmakerOptedInForThisOrganization);

            FieldDefinitionForProject  = FieldDefinitionEnum.Project.ToType();
            EditProfileMatchmakerOptIn = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditProfileMatchmakerOptIn(organization));

            EditProfileSupplementalInformationUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditProfileSupplementalInformation(organization));

            EditProfileTaxonomyUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditProfileTaxonomy(organization));

            EditAreaOfInterestUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditMatchMakerAreaOfInterest(organization));

            EditAreaOfInterestDialogFormID = OrganizationController.GenerateEditOrganizationMatchMakerAreaOfInterestFormID(organization);
            HasAreaOfInterest         = (Organization.UseOrganizationBoundaryForMatchmaker && Organization.OrganizationBoundary != null) || (!Organization.UseOrganizationBoundaryForMatchmaker && Organization.MatchMakerAreaOfInterestLocations.Any());
            AreaOfInterestMapInitJson = matchMakerAreaOfInterestInitJson;

            OrganizationMatchmakerKeywordsViewData = new OrganizationMatchmakerKeywordsViewData(organization);
            EditMatchmakerKeywordsUrl = SitkaRoute <KeywordController> .BuildUrlFromExpression(c => c.EditMatchMakerKeywordsModal(organization));

            EditMatchmakerKeywordDialogFormID = OrganizationMatchmakerKeywordsViewData.EditMatchmakerKeywordDialogFormID;

            TopLevelMatchmakerTaxonomyTier = topLevelMatchmakerTaxonomyTier;
            TaxonomyTrunkDisplayName       = FieldDefinitionEnum.TaxonomyTrunk.ToType().GetFieldDefinitionLabel();
            TaxonomyBranchDisplayName      = FieldDefinitionEnum.TaxonomyBranch.ToType().GetFieldDefinitionLabel();
            TaxonomyLeafDisplayName        = FieldDefinitionEnum.TaxonomyLeaf.ToType().GetFieldDefinitionLabel();
            TaxonomyLevel         = MultiTenantHelpers.GetTaxonomyLevel();
            MaximumTaxonomyLeaves = maximumTaxonomyLeaves;
            ActiveTab             = activeTab;

            EditOrgClassificationsUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditMatchMakerClassifications(organization));

            MatchmakerClassificationsGroupedByClassificationSystem = matchmakerClassificationsGroupedByClassificationSystem;
            AllClassificationSystems = allClassificationSystems;

            EditOrgPerformanceMeasuresUrl = SitkaRoute <OrganizationController> .BuildUrlFromExpression(c => c.EditMatchMakerPerformanceMeasures(organization));

            ProjectFinderPageUrl = SitkaRoute <ProjectFinderController> .BuildUrlFromExpression(c => c.Organization(organization));

            MatchmakerProfileCompletionDictionary = organization.GetMatchmakerOrganizationProfileCompletionDictionary();

            MatchmakerProfileIncomplete           = !MatchmakerProfileCompletionDictionary.Values.Any(x => x);
            MatchmakerProjectFinderButtonDisabled = !organization.MatchmakerOptIn.HasValue || !organization.MatchmakerOptIn.Value || MatchmakerProfileIncomplete;
            ShouldShowBackgroundTab = DescriptionViewData.HasPageContent || new OrganizationBackgroundEditFeature().HasPermission(currentFirmaSession, organization).HasPermission;
            MatchmakerProjectFinderButtonContent = GetMatchmakerProjectFinderButtonContent(organization, MatchmakerProfileCompletionDictionary);
        }
        public static FeatureCollection SimpleLocationToGeoJsonFeatureCollection(this ProjectUpdate projectUpdate, FirmaSession firmaSession)
        {
            var featureCollection           = new FeatureCollection();
            var userCanViewPrivateLocations = firmaSession.UserCanViewPrivateLocations(projectUpdate);

            if ((projectUpdate.ProjectLocationSimpleType == ProjectLocationSimpleType.PointOnMap || projectUpdate.ProjectLocationSimpleType == ProjectLocationSimpleType.LatLngInput) &&
                projectUpdate.HasProjectLocationPoint(userCanViewPrivateLocations))
            {
                featureCollection.Features.Add(DbGeometryToGeoJsonHelper.FromDbGeometry(projectUpdate.GetProjectLocationPoint(userCanViewPrivateLocations)));
            }
            return(featureCollection);
        }
Example #5
0
 public ConfirmObligationRequestUnmatchViewData(FirmaSession currentFirmaSession,
                                                ProjectFirmaModels.Models.ObligationRequest obligationRequest) : base(currentFirmaSession)
 {
     this.ObligationRequest = obligationRequest;
 }
Example #6
0
 public static void AssertPersonCanBeImpersonated(FirmaSession firmaSession, Person personToImpersonate)
 {
     Check.RequireNotNull(personToImpersonate, "Can't impersonate a null/anonymous user");
     AssertNotAttemptingToImpersonateSelf(firmaSession, personToImpersonate.PersonID);
 }
Example #7
0
 public AddProjectEvaluationViewData(FirmaSession currentFirmaSession, AddProjectEvaluationViewDataForAngular viewDataForAngular, ProjectFirmaModels.Models.Evaluation evaluation, ProjectFirmaModels.Models.FirmaPage firmaPage) : base(currentFirmaSession, firmaPage)
 {
     Evaluation         = evaluation;
     ViewDataForAngular = viewDataForAngular;
 }
        public static List <PerformanceMeasureSubcategoriesTotalReportedValue> SubcategoriesTotalReportedValues(FirmaSession currentFirmaSession, PerformanceMeasure performanceMeasure)
        {
            var groupByProjectAndSubcategory =
                performanceMeasure.GetReportedPerformanceMeasureValues(currentFirmaSession)
                .Where(x => FirmaDateUtilities.DateIsInReportingRange(x.CalendarYear))
                .GroupBy(x => new { x.Project, PerformanceMeasureSubcategoriesAsString = x.GetPerformanceMeasureSubcategoriesAsString() })
                .ToList();

            return
                (groupByProjectAndSubcategory.Select(
                     reportedValuesGroup =>
                     new PerformanceMeasureSubcategoriesTotalReportedValue(reportedValuesGroup.Key.Project,
                                                                           reportedValuesGroup.First().GetPerformanceMeasureSubcategoryOptions(),
                                                                           performanceMeasure,
                                                                           reportedValuesGroup.Sum(x => x.GetReportedValue()))).ToList());
        }
        public static List <PerformanceMeasureReportedValue> GetReportedPerformanceMeasureValues(this PerformanceMeasure performanceMeasure, FirmaSession currentFirmaSession)
        {
            var projects = performanceMeasure.GetAssociatedProjectsWithReportedValues(currentFirmaSession);

            return(performanceMeasure.GetReportedPerformanceMeasureValues(projects));
        }
        public static List <ProjectSectionSimple> GetApplicableWizardSections(this ProjectUpdateBatch projectUpdateBatch, FirmaSession currentFirmaSession, bool ignoreStatus, bool hasEditableCustomAttributes)
        {
            var projectWorkflowSectionGroupings = ProjectWorkflowSectionGrouping.All;

            if (!MultiTenantHelpers.TrackAccomplishments())
            {
                projectWorkflowSectionGroupings = projectWorkflowSectionGroupings.Where(x => x != ProjectWorkflowSectionGrouping.Accomplishments).ToList();
            }
            return(projectWorkflowSectionGroupings.SelectMany(x => x.GetProjectUpdateSections(currentFirmaSession, projectUpdateBatch, null, ignoreStatus, hasEditableCustomAttributes)).OrderBy(x => x.ProjectWorkflowSectionGrouping.SortOrder).ThenBy(x => x.SortOrder).ToList());
        }
        public static ProjectUpdateBatch GetLatestNotApprovedProjectUpdateBatchOrCreateNewAndSaveToDatabase(Project project, FirmaSession currentFirmaSession, ILog logger)
        {
            var projectUpdateBatch = GetLatestNotApprovedProjectUpdateBatchOrCreateNew(project, currentFirmaSession);

            if (!ModelObjectHelpers.IsRealPrimaryKeyValue(projectUpdateBatch.ProjectUpdateBatchID))
            {
                try
                {
                    HttpRequestStorage.DatabaseEntities.SaveChanges();
                }
                catch (System.Data.Entity.Infrastructure.DbUpdateException e)
                {
                    logger.Warn(e.Message);
                }
            }
            return(projectUpdateBatch);
        }
        /// <summary>
        /// Note, the saving is done by the controller
        /// </summary>
        private static void CreateNewTransitionRecord(this ProjectUpdateBatch projectUpdateBatch, ProjectUpdateState projectUpdateState, FirmaSession currentFirmaSession, DateTime transitionDate)
        {
            var currentPerson        = currentFirmaSession.Person;
            var projectUpdateHistory = new ProjectUpdateHistory(projectUpdateBatch, projectUpdateState, currentPerson, transitionDate);

            HttpRequestStorage.DatabaseEntities.AllProjectUpdateHistories.Add(projectUpdateHistory);
            projectUpdateBatch.ProjectUpdateStateID = projectUpdateState.ProjectUpdateStateID;
            projectUpdateBatch.TickleLastUpdateDate(transitionDate, currentFirmaSession);
        }
 public static void RejectSubmission(this ProjectUpdateBatch projectUpdateBatch, FirmaSession currentFirmaSession, DateTime transitionDate)
 {
     Check.Require(projectUpdateBatch.IsSubmitted(), "You cannot reject a batch that has not been submitted!");
     projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Returned, currentFirmaSession, transitionDate);
 }
 public static void Return(this ProjectUpdateBatch projectUpdateBatch, FirmaSession currentFirmaSession, DateTime transitionDate)
 {
     Check.Require(projectUpdateBatch.IsSubmitted(), $"You cannot return a {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} update that has not been submitted!");
     projectUpdateBatch.CreateNewTransitionRecord(ProjectUpdateState.Returned, currentFirmaSession, transitionDate);
 }
Example #15
0
 public static void AssertNotAttemptingToImpersonateSelf(FirmaSession firmaSession, int personIDToImpersonate)
 {
     Check.RequireThrowNotAuthorized(firmaSession.PersonID != personIDToImpersonate, $"User {firmaSession.UserDisplayName} is not allowed to impersonate themselves. (This should not have happened, and may indicate a coding error).");
 }
 public static List <Project> GetAssociatedProjectsWithReportedValues(this PerformanceMeasure performanceMeasure, FirmaSession currentFirmaSession)
 {
     return(performanceMeasure.PerformanceMeasureActuals.Select(ptc => ptc.Project).Distinct().ToList().GetActiveProjectsAndProposals(currentFirmaSession.CanViewProposals()));
 }
Example #17
0
        public static void AssertFirmaSessionCanImpersonate(FirmaSession firmaSession)
        {
            bool currentFirmaSessionCanImpersonate = new FirmaImpersonateUserFeature().HasPermissionByFirmaSession(firmaSession);

            Check.RequireThrowNotAuthorized(currentFirmaSessionCanImpersonate, $"User {firmaSession.UserDisplayName} is not allowed to impersonate anyone else.");
        }
 public static List <Project> GetAssociatedProjectsWithExpectedValues(this PerformanceMeasure performanceMeasure, FirmaSession currentFirmaSession)
 {
     return(performanceMeasure.PerformanceMeasureExpecteds.Select(pme => pme.Project).Distinct().ToList());
 }
Example #19
0
        private PartialViewResult ViewChangePassword(ChangePasswordViewModel viewModel, FirmaSession currentFirmaSession)
        {
            var isSelfEdit = viewModel.PersonID == currentFirmaSession.PersonID;
            var viewData   = new ChangePasswordViewData(isSelfEdit);

            return(RazorPartialView <ChangePassword, ChangePasswordViewData, ChangePasswordViewModel>(viewData, viewModel));
        }
 public static int ExpectedProjectsCount(this PerformanceMeasure performanceMeasure, FirmaSession currentFirmaSession)
 {
     return(performanceMeasure.GetAssociatedProjectsWithExpectedValues(currentFirmaSession).Count);
 }
 public void DemandPermission(FirmaSession firmaSession, Project contextModelObject)
 {
     _firmaFeatureWithContextImpl.DemandPermission(firmaSession, contextModelObject);
 }
 public static decimal?TotalExpenditure(this PerformanceMeasure performanceMeasure, FirmaSession currentFirmaSession)
 {
     return(SubcategoriesTotalReportedValues(currentFirmaSession, performanceMeasure).Sum(x => x.CalculateWeightedTotalExpenditure()));
 }
Example #23
0
 /// <summary>
 /// Make a ProjectFirmaMenuItem from a route. A feature is required on the Route and will be used to check access for the menu item.
 /// If menu item is not accessible, it will not be shown.
 /// </summary>
 public static LtInfoMenuItem MakeItem <T>(SitkaRoute <T> route, FirmaSession currentFirmaSession, string menuItemName) where T : Controller
 {
     return(MakeItem(route, currentFirmaSession, menuItemName, null));
 }
        public static decimal?TotalExpenditurePerPerformanceMeasureUnit(this PerformanceMeasure performanceMeasure, FirmaSession currentFirmaSession)
        {
            var totalReportedValues = SubcategoriesTotalReportedValues(currentFirmaSession, performanceMeasure).Where(x => x.CalculateWeightedTotalExpenditure() > 0).Sum(x => x.TotalReportedValue ?? 0);

            if (Math.Abs(totalReportedValues) < Double.Epsilon)
            {
                return(null);
            }
            return(performanceMeasure.TotalExpenditure(currentFirmaSession) / (decimal)totalReportedValues);
        }
Example #25
0
 public EditBasicsViewData(FirmaSession currentFirmaSession) : base(currentFirmaSession)
 {
 }
 public static double?TotalReportedValueWithNonZeroExpenditures(this PerformanceMeasure performanceMeasure, FirmaSession currentFirmaSession)
 {
     return(SubcategoriesTotalReportedValues(currentFirmaSession, performanceMeasure).Where(x => x.CalculateWeightedTotalExpenditure() > 0).Sum(x => x.TotalReportedValue));
 }
Example #27
0
 public PartnerFinderProjectUpdateViewData(FirmaSession currentFirmaSession, ProjectUpdateBatch projectUpdateBatch, ProjectUpdateStatus projectUpdateStatus) :
     base(currentFirmaSession, projectUpdateBatch, projectUpdateStatus, new List <string>(), ProjectUpdateSection.PartnerFinder.ProjectUpdateSectionDisplayName)
 {
     // Our component's view data
     ProjectPotentialPartnerDetailViewData = new ProjectPotentialPartnerDetailViewData(CurrentFirmaSession, projectUpdateBatch.Project, ProjectPotentialPartnerListDisplayMode.ProjectDetailViewPartialList);
 }
Example #28
0
 public ExportSqlDataViewData(FirmaSession currentFirmaSession) : base(currentFirmaSession)
 {
     PageTitle = "Export Sql Data";
 }
 public EditProjectUpdateConfigurationViewData(FirmaSession currentFirmaSession) : base(currentFirmaSession)
 {
     FieldDefinitionForProject = FieldDefinitionEnum.Project.ToType();
 }
        public static ProjectUpdateBatch GetLatestNotApprovedProjectUpdateBatchOrCreateNew(Project project, FirmaSession currentFirmaSession)
        {
            ProjectUpdateBatch projectUpdateBatch;

            if (project.GetLatestNotApprovedUpdateBatch() != null)
            {
                projectUpdateBatch = project.GetLatestNotApprovedUpdateBatch();
            }
            else
            {
                projectUpdateBatch = CreateNewProjectUpdateBatchForProject(project, currentFirmaSession);
            }

            return(projectUpdateBatch);
        }