public PartialViewResult DeleteClassification(ClassificationPrimaryKey classificationPrimaryKey)
        {
            var classification = classificationPrimaryKey.EntityObject;
            var viewModel      = new ConfirmDialogFormViewModel(classification.ClassificationID);

            return(ViewDeleteClassification(classification, viewModel));
        }
        public PartialViewResult Edit(ClassificationPrimaryKey classificationPrimaryKey)
        {
            var classification = classificationPrimaryKey.EntityObject;
            var viewModel      = new EditViewModel(classification);

            return(ViewEdit(viewModel, classification.ClassificationSystem, classification));
        }
        public ViewResult Detail(ClassificationPrimaryKey classificationPrimaryKey)
        {
            var classification = classificationPrimaryKey.EntityObject;
            var viewData       = new DetailViewData(CurrentPerson, classification);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
        public GridJsonNetJObjectResult <Project> ProjectsGridJsonData(ClassificationPrimaryKey classificationPrimaryKey)
        {
            var gridSpec = new BasicProjectInfoGridSpec(CurrentPerson, false);
            var projectClassifications   = classificationPrimaryKey.EntityObject.GetAssociatedProjects(CurrentPerson);
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Project>(projectClassifications, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Esempio n. 5
0
        public GridJsonNetJObjectResult <Project> ClassificationProjectsGridJsonData(ClassificationPrimaryKey classificationPrimaryKey)
        {
            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 projectClassifications   = classificationPrimaryKey.EntityObject.GetAssociatedProjects(CurrentFirmaSession);
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Project>(projectClassifications, gridSpec);

            return(gridJsonNetJObjectResult);
        }
        public ActionResult DeleteClassification(ClassificationPrimaryKey classificationPrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var classification = classificationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDeleteClassification(classification, viewModel));
            }
            classification.DeleteFull(HttpRequestStorage.DatabaseEntities);
            return(new ModalDialogFormJsonResult());
        }
        public ViewResult Detail(ClassificationPrimaryKey classificationPrimaryKey)
        {
            var classification                = classificationPrimaryKey.EntityObject;
            var mapDivID                      = $"classification_{classification.ClassificationID}_Map";
            var associatedProjects            = classification.GetAssociatedProjects(CurrentFirmaSession);
            var currentPersonCanViewProposals = CurrentFirmaSession.CanViewProposals();

            var projectMapCustomization      = ProjectMapCustomization.CreateDefaultCustomization(associatedProjects, currentPersonCanViewProposals);
            var projectLocationsLayerGeoJson = new LayerGeoJson($"{FieldDefinitionEnum.ProjectLocation.ToType().GetFieldDefinitionLabelPluralized()}",
                                                                associatedProjects.MappedPointsToGeoJsonFeatureCollection(false, true, false), "red", 1, LayerInitialVisibility.LayerInitialVisibilityEnum.Show);
            var projectLocationsMapInitJson = new ProjectLocationsMapInitJson(projectLocationsLayerGeoJson,
                                                                              projectMapCustomization, mapDivID, false)
            {
                AllowFullScreen = true,
            };

            // Add Organization Type boundaries according to configuration
            projectLocationsMapInitJson.Layers.AddRange(HttpRequestStorage.DatabaseEntities.Organizations.GetConfiguredBoundaryLayersGeoJson().
                                                        Where(x => x.LayerInitialVisibility == LayerInitialVisibility.LayerInitialVisibilityEnum.Show));
            var filteredProjectList = associatedProjects.Where(x1 => x1.HasProjectLocationPointViewableByUser(CurrentFirmaSession)).
                                      Where(x => x.ProjectStage.ShouldShowOnMap()).ToList();

            // filteredProjectList only contains project location points the user has permission to see
            projectLocationsMapInitJson.BoundingBox =
                new BoundingBox(filteredProjectList.Select(x => x.GetProjectLocationPoint(true)).ToList());
            var projectLocationsMapViewData = new ProjectLocationsMapViewData(projectLocationsMapInitJson.MapDivID,
                                                                              ProjectColorByType.ProjectStage.GetDisplayNameFieldDefinition(), MultiTenantHelpers.GetTopLevelTaxonomyTiers(), currentPersonCanViewProposals);

            var projectFundingSourceExpenditures = associatedProjects.SelectMany(x => x.ProjectFundingSourceExpenditures);
            var organizationTypes = HttpRequestStorage.DatabaseEntities.OrganizationTypes.ToList();

            const string chartTitle       = "Reported Expenditures By Organization Type";
            var          chartContainerID = chartTitle.Replace(" ", "");
            var          googleChart      = projectFundingSourceExpenditures.ToGoogleChart(x => x.FundingSource.Organization.OrganizationType.OrganizationTypeName,
                                                                                           organizationTypes.Select(x => x.OrganizationTypeName).ToList(),
                                                                                           x => x.FundingSource.Organization.OrganizationType.OrganizationTypeName,
                                                                                           chartContainerID,
                                                                                           chartTitle,
                                                                                           organizationTypes.ToDictionary(x => x.OrganizationTypeName, x => x.LegendColor));

            var viewGoogleChartViewData = new ViewGoogleChartViewData(googleChart, chartTitle, 405, true);

            var performanceMeasures = associatedProjects
                                      .SelectMany(x => x.PerformanceMeasureActuals)
                                      .Select(x => x.PerformanceMeasure).Distinct(new HavePrimaryKeyComparer <PerformanceMeasure>())
                                      .OrderBy(x => x.PerformanceMeasureDisplayName)
                                      .ToList();

            var projectCustomDefaultGridConfigurations = HttpRequestStorage.DatabaseEntities.ProjectCustomGridConfigurations.Where(x => x.IsEnabled && x.ProjectCustomGridTypeID == ProjectCustomGridType.Default.ProjectCustomGridTypeID).OrderBy(x => x.SortOrder).ToList();
            var viewData = new DetailViewData(CurrentFirmaSession, classification, projectLocationsMapViewData, projectLocationsMapInitJson, viewGoogleChartViewData, performanceMeasures, projectCustomDefaultGridConfigurations);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
        public ActionResult Edit(ClassificationPrimaryKey classificationPrimaryKey, EditViewModel viewModel)
        {
            var classification = classificationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel, classification.ClassificationSystem, classification));
            }

            viewModel.UpdateModel(classification, CurrentFirmaSession, HttpRequestStorage.DatabaseEntities);
            return(new ModalDialogFormJsonResult());
        }
        public ActionResult Edit(ClassificationPrimaryKey classificationPrimaryKey, EditViewModel viewModel)
        {
            var classification = classificationPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEdit(viewModel, classification.ClassificationSystem));
            }

            viewModel.UpdateModel(classification, CurrentPerson);
            return(new ModalDialogFormJsonResult());
        }