Exemple #1
0
        public PartialViewResult EditInDialog(GeospatialAreaTypePrimaryKey customPagePrimaryKey)
        {
            var customPage = customPagePrimaryKey.EntityObject;
            var viewModel  = new EditGeospatialAreaTypeIntroTextViewModel(customPage);

            return(ViewEditInDialog(viewModel));
        }
Exemple #2
0
        public ActionResult SyncGeospatialAreaType(GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey, ConfirmDialogFormViewModel viewModel)
        {
            var geospatialAreaType = geospatialAreaTypePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewSyncGeospatialAreaType(geospatialAreaType, viewModel));
            }

            var syncResult = RestApiClient.SyncGeospatialAreaTypeFromService(geospatialAreaType);

            if (syncResult.IsError)
            {
                SetErrorForDisplay(syncResult.Message);
            }
            else if (syncResult.IsWarning)
            {
                SetWarningForDisplay(syncResult.Message);
            }
            else
            {
                SetMessageForDisplay(syncResult.Message);
            }
            return(new ModalDialogFormJsonResult());
        }
Exemple #3
0
        public PartialViewResult SyncGeospatialAreaType(GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey)
        {
            var geospatialAreaType = geospatialAreaTypePrimaryKey.EntityObject;
            var viewModel          = new ConfirmDialogFormViewModel(geospatialAreaType.GeospatialAreaTypeID);

            return(ViewSyncGeospatialAreaType(geospatialAreaType, viewModel));
        }
Exemple #4
0
        public PartialViewResult EditGeospatialAreaMapLayer(GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey)
        {
            var geospatialAreaType = geospatialAreaTypePrimaryKey.EntityObject;
            var viewModel          = new EditGeospatialAreaMapLayerViewModel(geospatialAreaType);

            return(ViewEditGeospatialAreaMapLayer(geospatialAreaType, viewModel));
        }
        public JsonResult FindGeospatialAreaByName(GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey, string term)
        {
            var geospatialAreaType = geospatialAreaTypePrimaryKey.EntityObject;
            var searchString       = term.Trim();

            return(Json(HttpRequestStorage.DatabaseEntities.GeospatialAreas
                        .Where(x => x.GeospatialAreaTypeID == geospatialAreaType.GeospatialAreaTypeID && x.GeospatialAreaShortName.Contains(searchString)).OrderBy(x => x.GeospatialAreaShortName).Take(20).ToList()
                        .Select(x => new { x.GeospatialAreaShortName, x.GeospatialAreaID }).ToList(), JsonRequestBehavior.AllowGet));
        }
Exemple #6
0
        public ActionResult EditInDialog(GeospatialAreaTypePrimaryKey customPagePrimaryKey, EditGeospatialAreaTypeIntroTextViewModel viewModel)
        {
            var customPage = customPagePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditInDialog(viewModel));
            }
            viewModel.UpdateModel(customPage);
            return(new ModalDialogFormJsonResult());
        }
Exemple #7
0
        public ActionResult EditGeospatialAreaMapLayer(GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey, EditGeospatialAreaMapLayerViewModel viewModel)
        {
            var geospatialAreaType = geospatialAreaTypePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditGeospatialAreaMapLayer(geospatialAreaType, viewModel));
            }
            viewModel.UpdateModel(geospatialAreaType);
            return(new ModalDialogFormJsonResult());
        }
Exemple #8
0
        public ViewResult Index(GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey)
        {
            var geospatialAreaType = geospatialAreaTypePrimaryKey.EntityObject;
            var layerGeoJsons      = new List <LayerGeoJson>
            {
                geospatialAreaType.GetGeospatialAreaWmsLayerGeoJson("#59ACFF", 0.2m, LayerInitialVisibility.LayerInitialVisibilityEnum.Show)
            };
            var currentPersonCanViewProposals = CurrentFirmaSession.CanViewProposals();
            var projectsToShow = ProjectMapCustomization.ProjectsForMap(currentPersonCanViewProposals, CurrentFirmaSession);
            var projectLocationsLayerGeoJson =
                new LayerGeoJson($"Mapped {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}",
                                 projectsToShow.MappedPointsToGeoJsonFeatureCollection(false, true, true), "#80b2ff", 1,
                                 LayerInitialVisibility.LayerInitialVisibilityEnum.Show);

            layerGeoJsons.Add(projectLocationsLayerGeoJson);

            var mapInitJson = new MapInitJson("geospatialAreaIndex", 10, layerGeoJsons, MapInitJson.GetExternalMapLayers(),
                                              BoundingBox.MakeNewDefaultBoundingBox());

            var viewData = new IndexViewData(CurrentFirmaSession, geospatialAreaType, mapInitJson);

            return(RazorView <Index, IndexViewData>(viewData));
        }
Exemple #9
0
        public GridJsonNetJObjectResult <GeospatialAreaIndexGridSimple> IndexGridJsonData(GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey)
        {
            var geospatialAreaType             = geospatialAreaTypePrimaryKey.EntityObject;
            var gridSpec                       = new IndexGridSpec(CurrentFirmaSession, geospatialAreaType);
            var projectIDsViewableByUser       = HttpRequestStorage.DatabaseEntities.Projects.ToList().GetActiveProjectsAndProposals(CurrentFirmaSession.CanViewProposals(), CurrentFirmaSession).Select(x => x.ProjectID).ToList();
            var geospatialAreaIndexGridSimples = GeospatialAreaModelExtensions.GetGeospatialAreaIndexGridSimples(geospatialAreaType, projectIDsViewableByUser).OrderByDescending(x => x.ProjectViewableByUserCount).ToList();
            var gridJsonNetJObjectResult       = new GridJsonNetJObjectResult <GeospatialAreaIndexGridSimple>(geospatialAreaIndexGridSimples, gridSpec);

            return(gridJsonNetJObjectResult);
        }
        public ActionResult EditProjectGeospatialAreas(ProjectPrimaryKey projectPrimaryKey, GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey, EditProjectGeospatialAreasViewModel viewModel)
        {
            var project            = projectPrimaryKey.EntityObject;
            var geospatialAreaType = geospatialAreaTypePrimaryKey.EntityObject;

            if (!ModelState.IsValid)
            {
                return(ViewEditProjectGeospatialAreas(viewModel, project, geospatialAreaType));
            }

            var currentProjectGeospatialAreas = project.ProjectGeospatialAreas.Where(x => x.GeospatialArea.GeospatialAreaTypeID == geospatialAreaType.GeospatialAreaTypeID).ToList();
            var allProjectGeospatialAreas     = HttpRequestStorage.DatabaseEntities.AllProjectGeospatialAreas.Local;

            viewModel.UpdateModel(project, currentProjectGeospatialAreas, allProjectGeospatialAreas);
            var projectGeospatialAreaTypeNote = project.ProjectGeospatialAreaTypeNotes.SingleOrDefault(x => x.GeospatialAreaTypeID == geospatialAreaType.GeospatialAreaTypeID);

            if (!string.IsNullOrWhiteSpace(viewModel.ProjectGeospatialAreaNotes))
            {
                if (projectGeospatialAreaTypeNote == null)
                {
                    projectGeospatialAreaTypeNote = new ProjectGeospatialAreaTypeNote(project, geospatialAreaType, viewModel.ProjectGeospatialAreaNotes);
                }
                projectGeospatialAreaTypeNote.Notes = viewModel.ProjectGeospatialAreaNotes;
            }
            else
            {
                projectGeospatialAreaTypeNote?.DeleteFull(HttpRequestStorage.DatabaseEntities);
            }
            SetMessageForDisplay($"{FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabel()} {geospatialAreaType.GeospatialAreaTypeNamePluralized} were successfully saved.");

            return(new ModalDialogFormJsonResult());
        }
        public PartialViewResult EditProjectGeospatialAreas(ProjectPrimaryKey projectPrimaryKey, GeospatialAreaTypePrimaryKey geospatialAreaTypePrimaryKey)
        {
            var project             = projectPrimaryKey.EntityObject;
            var geospatialAreaType  = geospatialAreaTypePrimaryKey.EntityObject;
            var geospatialAreaIDs   = project.ProjectGeospatialAreas.Where(x => x.GeospatialArea.GeospatialAreaType == geospatialAreaType).Select(x => x.GeospatialAreaID).ToList();
            var geospatialAreaNotes = project.ProjectGeospatialAreaTypeNotes.SingleOrDefault(x => x.GeospatialAreaTypeID == geospatialAreaType.GeospatialAreaTypeID)?.Notes;
            var viewModel           = new EditProjectGeospatialAreasViewModel(geospatialAreaIDs, geospatialAreaNotes);

            return(ViewEditProjectGeospatialAreas(viewModel, project, geospatialAreaType));
        }