Beispiel #1
0
        public PartialViewResult DeleteTaxonomyLeaf(TaxonomyLeafPrimaryKey taxonomyLeafPrimaryKey)
        {
            var taxonomyLeaf = taxonomyLeafPrimaryKey.EntityObject;
            var viewModel    = new ConfirmDialogFormViewModel(taxonomyLeaf.TaxonomyLeafID);

            return(ViewDeleteTaxonomyLeaf(taxonomyLeaf, viewModel));
        }
Beispiel #2
0
        public PartialViewResult Edit(TaxonomyLeafPrimaryKey taxonomyLeafPrimaryKey)
        {
            var taxonomyLeaf = taxonomyLeafPrimaryKey.EntityObject;
            var viewModel    = new EditViewModel(taxonomyLeaf);

            return(ViewEdit(viewModel, taxonomyLeaf.TaxonomyBranch.GetDisplayName()));
        }
Beispiel #3
0
        public GridJsonNetJObjectResult <Project> SecondaryProjectsGridJsonData(TaxonomyLeafPrimaryKey taxonomyLeafPrimaryKey)
        {
            var taxonomyLeaf         = taxonomyLeafPrimaryKey.EntityObject;
            var projectTaxonomyLeafs = taxonomyLeaf.GetAssociatedPrimaryAndSecondaryProjects(CurrentFirmaSession);
            var gridSpec             = new ProjectForTaxonomyLeafGridSpec(CurrentFirmaSession, true, taxonomyLeaf);

            return(new GridJsonNetJObjectResult <Project>(projectTaxonomyLeafs, gridSpec));
        }
Beispiel #4
0
        public GridJsonNetJObjectResult <Project> TaxonomyLeafProjectsGridJsonData(TaxonomyLeafPrimaryKey taxonomyLeafPrimaryKey)
        {
            var projectCustomDefaultGridConfigurations = HttpRequestStorage.DatabaseEntities.ProjectCustomGridConfigurations.Where(x => x.IsEnabled && x.ProjectCustomGridTypeID == ProjectCustomGridType.Default.ProjectCustomGridTypeID).OrderBy(x => x.SortOrder).ToList();
            var projectDetails       = HttpRequestStorage.DatabaseEntities.vProjectDetails.ToDictionary(x => x.ProjectID);
            var gridSpec             = new ProjectCustomGridSpec(CurrentFirmaSession, projectCustomDefaultGridConfigurations, ProjectCustomGridType.Default.ToEnum, projectDetails, CurrentTenant);
            var taxonomyLeaf         = taxonomyLeafPrimaryKey.EntityObject;
            var taxonomyLeafProjects = taxonomyLeaf.GetAssociatedProjects(CurrentFirmaSession);

            return(new GridJsonNetJObjectResult <Project>(taxonomyLeafProjects, gridSpec));
        }
Beispiel #5
0
        public ActionResult Edit(TaxonomyLeafPrimaryKey taxonomyLeafPrimaryKey, EditViewModel viewModel)
        {
            var taxonomyLeaf = taxonomyLeafPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel, taxonomyLeaf.TaxonomyBranch.GetDisplayName()));
            }

            viewModel.UpdateModel(taxonomyLeaf, CurrentFirmaSession);
            return(new ModalDialogFormJsonResult());
        }
Beispiel #6
0
        public ActionResult DeleteTaxonomyLeaf(TaxonomyLeafPrimaryKey taxonomyLeafPrimaryKey,
                                               ConfirmDialogFormViewModel viewModel)
        {
            var taxonomyLeaf = taxonomyLeafPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDeleteTaxonomyLeaf(taxonomyLeaf, viewModel));
            }

            taxonomyLeaf.DeleteFull(HttpRequestStorage.DatabaseEntities);
            return(new ModalDialogFormJsonResult());
        }
Beispiel #7
0
        public ViewResult Detail(TaxonomyLeafPrimaryKey taxonomyLeafPrimaryKey)
        {
            var taxonomyLeaf = taxonomyLeafPrimaryKey.EntityObject;
            var currentPersonCanViewProposals = CurrentFirmaSession.CanViewProposals();

            var primaryTaxonomyLeafProjects = taxonomyLeaf.GetProjects().ToList()
                                              .GetActiveProjectsAndProposals(currentPersonCanViewProposals)
                                              .Where(x => x.ProjectStage.ShouldShowOnMap())
                                              .ToList();
            var secondaryTaxonomyLeafProjects = primaryTaxonomyLeafProjects.Union(
                taxonomyLeaf.SecondaryProjectTaxonomyLeafs.Select(x => x.Project)
                .ToList()
                .GetActiveProjectsAndProposals(currentPersonCanViewProposals)
                .Where(x => x.ProjectStage.ShouldShowOnMap()))
                                                .ToList();

            // This page supports two maps for cases where secondary taxonomy leafs are supported
            var primaryProjectMapCustomization = new ProjectMapCustomization(ProjectLocationFilterType.TaxonomyLeaf,
                                                                             new List <int> {
                taxonomyLeaf.TaxonomyLeafID
            }, ProjectColorByType.ProjectStage);
            var secondaryProjectMapCustomization = new ProjectMapCustomization(ProjectLocationFilterType.TaxonomyLeaf,
                                                                               secondaryTaxonomyLeafProjects.Select(x => x.GetTaxonomyLeaf().TaxonomyLeafID).Union(new List <int> {
                taxonomyLeaf.TaxonomyLeafID
            }).ToList(),
                                                                               ProjectColorByType.ProjectStage);
            var primaryProjectLocationsLayerGeoJson =
                new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()}",
                                 primaryTaxonomyLeafProjects.MappedPointsToGeoJsonFeatureCollection(false, true, false), "red", 1,
                                 LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var secondaryProjectLocationsLayerGeoJson =
                new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabel()}",
                                 secondaryTaxonomyLeafProjects.MappedPointsToGeoJsonFeatureCollection(false, true, false), "red", 1,
                                 LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            // Add Organization Type boundaries according to configuration
            var configuredOrganizationBoundariesMapInitJson = HttpRequestStorage.DatabaseEntities.Organizations.GetConfiguredBoundaryLayersGeoJson();

            var primaryProjectLocationsMapInitJson = new ProjectLocationsMapInitJson(primaryProjectLocationsLayerGeoJson,
                                                                                     primaryProjectMapCustomization, "TaxonomyLeafProjectMap", false);

            primaryProjectLocationsMapInitJson.Layers.AddRange(configuredOrganizationBoundariesMapInitJson);

            var secondaryProjectLocationsMapInitJson = new ProjectLocationsMapInitJson(secondaryProjectLocationsLayerGeoJson,
                                                                                       secondaryProjectMapCustomization, "SecondaryTaxonomyLeafProjectMap", false);

            secondaryProjectLocationsMapInitJson.Layers.AddRange(configuredOrganizationBoundariesMapInitJson);

            var primaryProjectLocationsMapViewData = new ProjectLocationsMapViewData(primaryProjectLocationsMapInitJson.MapDivID,
                                                                                     ProjectColorByType.ProjectStage.GetDisplayNameFieldDefinition(), MultiTenantHelpers.GetTopLevelTaxonomyTiers(),
                                                                                     CurrentFirmaSession.CanViewProposals());
            var secondaryProjectLocationsMapViewData = new ProjectLocationsMapViewData(secondaryProjectLocationsMapInitJson.MapDivID,
                                                                                       ProjectColorByType.ProjectStage.GetDisplayNameFieldDefinition(), MultiTenantHelpers.GetTopLevelTaxonomyTiers(),
                                                                                       CurrentFirmaSession.CanViewProposals());

            var associatePerformanceMeasureTaxonomyLevel =
                MultiTenantHelpers.GetAssociatePerformanceMeasureTaxonomyLevel();
            var canHaveAssociatedPerformanceMeasures = associatePerformanceMeasureTaxonomyLevel == TaxonomyLevel.Leaf;
            var taxonomyTierPerformanceMeasures      = taxonomyLeaf.GetTaxonomyTierPerformanceMeasures();
            var relatedPerformanceMeasuresViewData   = new RelatedPerformanceMeasuresViewData(
                associatePerformanceMeasureTaxonomyLevel, true, taxonomyTierPerformanceMeasures,
                canHaveAssociatedPerformanceMeasures);

            var taxonomyLevel   = MultiTenantHelpers.GetTaxonomyLevel();
            var tenantAttribute = MultiTenantHelpers.GetTenantAttributeFromCache();

            var performanceMeasures = taxonomyLeaf.TaxonomyLeafPerformanceMeasures.Select(x => x.PerformanceMeasure)
                                      .ToList();
            var primaryPerformanceMeasureChartViewDataByPerformanceMeasure = performanceMeasures.ToDictionary(
                x => x.PerformanceMeasureID,
                x => new PerformanceMeasureChartViewData(x, CurrentFirmaSession, false, primaryTaxonomyLeafProjects, $"primary{x.GetJavascriptSafeChartUniqueName()}"));
            var secondaryPerformanceMeasureChartViewDataByPerformanceMeasure = performanceMeasures.ToDictionary(
                x => x.PerformanceMeasureID,
                x => new PerformanceMeasureChartViewData(x, CurrentFirmaSession, false, secondaryTaxonomyLeafProjects, $"secondary{x.GetJavascriptSafeChartUniqueName()}"));

            var projectCustomDefaultGridConfigurations = HttpRequestStorage.DatabaseEntities.ProjectCustomGridConfigurations.Where(x => x.IsEnabled && x.ProjectCustomGridTypeID == ProjectCustomGridType.Default.ProjectCustomGridTypeID).OrderBy(x => x.SortOrder).ToList();

            var viewData = new DetailViewData(CurrentFirmaSession, taxonomyLeaf, primaryProjectLocationsMapInitJson,
                                              secondaryProjectLocationsMapInitJson, primaryProjectLocationsMapViewData,
                                              secondaryProjectLocationsMapViewData, canHaveAssociatedPerformanceMeasures,
                                              relatedPerformanceMeasuresViewData, taxonomyLevel, tenantAttribute, performanceMeasures,
                                              primaryPerformanceMeasureChartViewDataByPerformanceMeasure,
                                              secondaryPerformanceMeasureChartViewDataByPerformanceMeasure,
                                              projectCustomDefaultGridConfigurations);

            return(RazorView <Summary, DetailViewData>(viewData));
        }