public ViewResult Detail(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey)
        {
            var priorityLandscape = priorityLandscapePrimaryKey.EntityObject;
            var mapDivID          = $"priorityLandscape_{priorityLandscape.PriorityLandscapeID}_Map";

            var associatedProjects = priorityLandscape.GetAssociatedProjectsVisibleToUser(CurrentPerson);
            var layers             = PriorityLandscape.GetPriorityLandscapeAndAssociatedProjectLayers(priorityLandscape, associatedProjects);
            var mapInitJson        = new MapInitJson(mapDivID, 10, layers, new BoundingBox(priorityLandscape.PriorityLandscapeLocation));

            var projectGrantAllocationExpenditures = associatedProjects.SelectMany(x => x.ProjectGrantAllocationExpenditures);
            var organizationTypes = HttpRequestStorage.DatabaseEntities.OrganizationTypes.ToList();

            const string chartTitle       = "Reported Expenditures By Organization Type";
            var          chartContainerID = chartTitle.Replace(" ", "");
            var          googleChart      = projectGrantAllocationExpenditures.ToGoogleChart(x => x.GrantAllocation.BottommostOrganization.OrganizationType.OrganizationTypeName,
                                                                                             organizationTypes.Select(x => x.OrganizationTypeName).ToList(),
                                                                                             x => x.GrantAllocation.BottommostOrganization.OrganizationType.OrganizationTypeName,
                                                                                             chartContainerID,
                                                                                             chartTitle);

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

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

            var viewData = new DetailViewData(CurrentPerson, priorityLandscape, mapInitJson, viewGoogleChartViewData, performanceMeasures);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
        public PartialViewResult DeletePriorityLandscape(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey)
        {
            var priorityLandscape = priorityLandscapePrimaryKey.EntityObject;
            var viewModel         = new ConfirmDialogFormViewModel(priorityLandscape.PriorityLandscapeID);

            return(ViewDeletePriorityLandscape(priorityLandscape, viewModel));
        }
        public PartialViewResult NewPriorityLandscapeFiles(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey)
        {
            Check.EnsureNotNull(priorityLandscapePrimaryKey.EntityObject);
            var viewModel = new NewFileViewModel();

            return(ViewNewPriorityLandscapeFiles(viewModel));
        }
        public PartialViewResult EditPriorityLandscape(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey)
        {
            var priorityLandscape = priorityLandscapePrimaryKey.EntityObject;
            var viewModel         = new EditPriorityLandscapeViewModel(priorityLandscape);

            return(ViewEditPriorityLandscape(viewModel));
        }
        public ActionResult DeletePriorityLandscape(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var priorityLandscape = priorityLandscapePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDeletePriorityLandscape(priorityLandscape, viewModel));
            }
            priorityLandscape.DeleteFull(HttpRequestStorage.DatabaseEntities);
            return(new ModalDialogFormJsonResult());
        }
        public GridJsonNetJObjectResult <Project> ProjectsGridJsonData(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey)
        {
            var treatmentTotals           = HttpRequestStorage.DatabaseEntities.vTotalTreatedAcresByProjects.ToList();
            var treatmentDictionary       = treatmentTotals.ToDictionary(x => x.ProjectID, y => y);
            var gridSpec                  = new ProjectIndexGridSpec(CurrentPerson, false, false, treatmentDictionary);
            var priorityLandscape         = priorityLandscapePrimaryKey.EntityObject;
            var projectPriorityLandscapes = priorityLandscape.GetAssociatedProjectsVisibleToUser(CurrentPerson);
            var gridJsonNetJObjectResult  = new GridJsonNetJObjectResult <Project>(projectPriorityLandscapes, gridSpec);

            return(gridJsonNetJObjectResult);
        }
        public ActionResult NewPriorityLandscapeFiles(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey, NewFileViewModel viewModel)
        {
            var priorityLandscape = priorityLandscapePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewNewPriorityLandscapeFiles(new NewFileViewModel()));
            }

            viewModel.UpdateModel(priorityLandscape, CurrentPerson);
            SetMessageForDisplay($"Successfully created {viewModel.FileResourcesData.Count} new files(s) for {FieldDefinition.PriorityLandscape.GetFieldDefinitionLabel()} \"{priorityLandscape.PriorityLandscapeName}\".");
            return(new ModalDialogFormJsonResult());
        }
        public ActionResult EditPriorityLandscape(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey, EditPriorityLandscapeViewModel viewModel)
        {
            var priorityLandscape = priorityLandscapePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditPriorityLandscape(viewModel));
            }

            viewModel.UpdateModel(priorityLandscape);
            SetMessageForDisplay($"{FieldDefinition.PriorityLandscape.GetFieldDefinitionLabel()} \"{priorityLandscape.PriorityLandscapeName}\" has been updated.");
            return(new ModalDialogFormJsonResult());
        }
        public PartialViewResult MapTooltip(PriorityLandscapePrimaryKey priorityLandscapePrimaryKey)
        {
            var viewData = new MapTooltipViewData(CurrentPerson, priorityLandscapePrimaryKey.EntityObject);

            return(RazorPartialView <MapTooltip, MapTooltipViewData>(viewData));
        }