Example #1
0
        public PartialViewResult DeleteGeospatialArea(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey)
        {
            var geospatialArea = geospatialAreaPrimaryKey.EntityObject;
            var viewModel      = new ConfirmDialogFormViewModel(geospatialArea.GeospatialAreaID);

            return(ViewDeleteGeospatialArea(geospatialArea, viewModel));
        }
Example #2
0
        public PartialViewResult EditDescriptionInDialog(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey)
        {
            var geospatialArea = geospatialAreaPrimaryKey.EntityObject;
            var viewModel      = new EditGeospatialAreaDescriptionViewModel(geospatialArea);

            return(ViewEditDescriptionInDialog(viewModel, geospatialArea));
        }
        public ActionResult Edit(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, EditPerformanceMeasureTargetsViewModel viewModel)
        {
            var geospatialArea     = geospatialAreaPrimaryKey.EntityObject;
            var performanceMeasure = performanceMeasurePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEdit(geospatialArea, performanceMeasure, viewModel));
            }

            HttpRequestStorage.DatabaseEntities.PerformanceMeasureReportingPeriods.Load();
            HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureNoTargets.Load();
            HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureFixedTargets.Load();
            HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureReportingPeriodTargets.Load();

            viewModel.UpdateModel(
                geospatialArea,
                performanceMeasure,
                HttpRequestStorage.DatabaseEntities.AllPerformanceMeasureReportingPeriods.Local,
                HttpRequestStorage.DatabaseEntities.AllGeospatialAreaPerformanceMeasureNoTargets.Local,
                HttpRequestStorage.DatabaseEntities.AllGeospatialAreaPerformanceMeasureFixedTargets.Local,
                HttpRequestStorage.DatabaseEntities.AllGeospatialAreaPerformanceMeasureReportingPeriodTargets.Local
                );

            SetMessageForDisplay($"Successfully saved {FieldDefinitionEnum.PerformanceMeasure.ToType().GetFieldDefinitionLabel()} Targets");
            return(new ModalDialogFormJsonResult());
        }
        public ContentResult CkEditorUploadFileResourceForGeospatialAreaDescription(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, CkEditorImageUploadViewModel viewModel)
        {
            var fileResourceInfo = FileResourceModelExtensions.CreateNewFromHttpPostedFileAndSave(viewModel.upload, CurrentFirmaSession);
            var geospatialArea   = geospatialAreaPrimaryKey.EntityObject;
            var ppImage          = new GeospatialAreaImage(geospatialArea, fileResourceInfo);

            HttpRequestStorage.DatabaseEntities.AllGeospatialAreaImages.Add(ppImage);
            return(Content(viewModel.GetCkEditorJavascriptContentToReturn(fileResourceInfo)));
        }
        public PartialViewResult Delete(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey)
        {
            //throw new NotImplementedException("Delete is not implemented");
            var geospatialArea     = geospatialAreaPrimaryKey.EntityObject;
            var performanceMeasure = performanceMeasurePrimaryKey.EntityObject;
            var viewModel          = new ConfirmDialogFormViewModel(geospatialArea.GeospatialAreaID);

            return(ViewDelete(geospatialArea, performanceMeasure, viewModel));
        }
        public ActionResult Edit(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey)
        {
            //throw new NotImplementedException("Edit has not been implemented");
            var geospatialArea     = geospatialAreaPrimaryKey.EntityObject;
            var performanceMeasure = performanceMeasurePrimaryKey.EntityObject;
            var viewModel          = new EditPerformanceMeasureTargetsViewModel(geospatialArea, performanceMeasure);

            return(ViewEdit(geospatialArea, performanceMeasure, viewModel));
        }
Example #7
0
        public GridJsonNetJObjectResult <Project> GeospatialAreaProjectsGridJsonData(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey)
        {
            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 projectGeospatialAreas   = geospatialAreaPrimaryKey.EntityObject.GetAssociatedProjects(CurrentFirmaSession);
            var gridJsonNetJObjectResult = new GridJsonNetJObjectResult <Project>(projectGeospatialAreas, gridSpec);

            return(gridJsonNetJObjectResult);
        }
Example #8
0
        public ActionResult EditDescriptionInDialog(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, EditGeospatialAreaDescriptionViewModel viewModel)
        {
            var geospatialArea = geospatialAreaPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditDescriptionInDialog(viewModel, geospatialArea));
            }
            viewModel.UpdateModel(geospatialArea, HttpRequestStorage.DatabaseEntities);
            return(new ModalDialogFormJsonResult());
        }
Example #9
0
        public ActionResult DeleteGeospatialArea(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var geospatialArea = geospatialAreaPrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDeleteGeospatialArea(geospatialArea, viewModel));
            }
            geospatialArea.DeleteFull(HttpRequestStorage.DatabaseEntities);
            return(new ModalDialogFormJsonResult());
        }
        public ActionResult Delete(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey, PerformanceMeasurePrimaryKey performanceMeasurePrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var geospatialArea     = geospatialAreaPrimaryKey.EntityObject;
            var performanceMeasure = performanceMeasurePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewDelete(geospatialArea, performanceMeasure, viewModel));
            }

            // no target
            var geospatialAreaPerformanceMeasureNoTargets =
                HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureNoTargets.Where(x =>
                                                                                                    x.GeospatialAreaID == geospatialArea.GeospatialAreaID &&
                                                                                                    x.PerformanceMeasureID == performanceMeasure.PerformanceMeasureID);

            foreach (var noTarget in geospatialAreaPerformanceMeasureNoTargets)
            {
                noTarget.DeleteFull(HttpRequestStorage.DatabaseEntities);
            }

            // fixed target
            var areaPerformanceMeasureFixedTargets =
                HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureFixedTargets.Where(x =>
                                                                                                       x.GeospatialAreaID == geospatialArea.GeospatialAreaID &&
                                                                                                       x.PerformanceMeasureID == performanceMeasure.PerformanceMeasureID);

            foreach (var overallTarget in areaPerformanceMeasureFixedTargets)
            {
                overallTarget.DeleteFull(HttpRequestStorage.DatabaseEntities);
            }

            // target per year
            var geospatialAreaPerformanceMeasureTargets =
                HttpRequestStorage.DatabaseEntities.GeospatialAreaPerformanceMeasureReportingPeriodTargets.Where(x =>
                                                                                                                 x.GeospatialAreaID == geospatialArea.GeospatialAreaID &&
                                                                                                                 x.PerformanceMeasureID == performanceMeasure.PerformanceMeasureID);

            foreach (var geoTarget in geospatialAreaPerformanceMeasureTargets)
            {
                geoTarget.DeleteFull(HttpRequestStorage.DatabaseEntities);
            }

            return(new ModalDialogFormJsonResult());
        }
Example #11
0
        public ViewResult Detail(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey)
        {
            var geospatialArea = geospatialAreaPrimaryKey.EntityObject;
            var mapDivID       = $"geospatialArea_{geospatialArea.GeospatialAreaID}_Map";

            var          associatedProjects = geospatialArea.GetAssociatedProjects(CurrentFirmaSession);
            LayerGeoJson projectLayerGeoJson;
            var          layers      = geospatialArea.GetGeospatialAreaAndAssociatedProjectLayers(CurrentFirmaSession, associatedProjects, out projectLayerGeoJson);
            var          mapInitJson = new MapInitJson(mapDivID, 10, layers, MapInitJson.GetExternalMapLayers(), new BoundingBox(geospatialArea.GeospatialAreaFeature));

            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, geospatialArea, mapInitJson, projectLayerGeoJson, viewGoogleChartViewData, performanceMeasures, projectCustomDefaultGridConfigurations);

            return(RazorView <Detail, DetailViewData>(viewData));
        }
Example #12
0
        public PartialViewResult MapTooltip(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey)
        {
            var viewData = new MapTooltipViewData(CurrentFirmaSession, geospatialAreaPrimaryKey.EntityObject);

            return(RazorPartialView <MapTooltip, MapTooltipViewData>(viewData));
        }
 public ContentResult CkEditorUploadFileResourceForGeospatialAreaDescription(GeospatialAreaPrimaryKey geospatialAreaPrimaryKey)
 {
     return(Content(String.Empty));
 }