private PartialViewResult ViewEditProjectGeospatialAreas(EditProjectGeospatialAreasViewModel viewModel,
                                                                 Project project, GeospatialAreaType geospatialAreaType)
        {
            var userCanViewPrivateLocations = CurrentFirmaSession.UserCanViewPrivateLocations(project);
            var boundingBox = ProjectLocationSummaryMapInitJson.GetProjectBoundingBox(project, userCanViewPrivateLocations);
            var layers      = MapInitJson.GetGeospatialAreaMapLayersForGeospatialAreaType(geospatialAreaType);

            layers.AddRange(MapInitJson.GetProjectLocationSimpleAndDetailedMapLayers(project, CurrentFirmaSession));
            var mapInitJson = new MapInitJson("projectGeospatialAreaMap", 0, layers, MapInitJson.GetExternalMapLayers(), boundingBox)
            {
                AllowFullScreen = false, DisablePopups = true
            };
            var geospatialAreaIDs                 = viewModel.GeospatialAreaIDs ?? new List <int>();
            var geospatialAreasInViewModel        = HttpRequestStorage.DatabaseEntities.GeospatialAreas.Where(x => geospatialAreaIDs.Contains(x.GeospatialAreaID)).ToList();
            var editProjectGeospatialAreasPostUrl = SitkaRoute <ProjectGeospatialAreaController> .BuildUrlFromExpression(c => c.EditProjectGeospatialAreas(project, geospatialAreaType, null));

            var editProjectGeospatialAreasFormID = GetEditProjectGeospatialAreasFormID();

            var geospatialAreasContainingProjectSimpleLocation = GeospatialAreaModelExtensions.GetGeospatialAreasContainingProjectLocation(project, geospatialAreaType.GeospatialAreaTypeID).ToList();

            var viewData = new EditProjectGeospatialAreasViewData(CurrentFirmaSession, mapInitJson,
                                                                  geospatialAreasInViewModel, editProjectGeospatialAreasPostUrl, editProjectGeospatialAreasFormID,
                                                                  project.HasProjectLocationPoint(userCanViewPrivateLocations), project.HasProjectLocationDetailed(userCanViewPrivateLocations), geospatialAreaType,
                                                                  geospatialAreasContainingProjectSimpleLocation, null);

            return(RazorPartialView <EditProjectGeospatialAreas, EditProjectGeospatialAreasViewData, EditProjectGeospatialAreasViewModel>(viewData, viewModel));
        }
Ejemplo n.º 2
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);
        }
Ejemplo n.º 3
0
 public IndexGridSpec(FirmaSession currentFirmaSession, GeospatialAreaType geospatialAreaType)
 {
     Add(geospatialAreaType.GeospatialAreaTypeName, a => UrlTemplate.MakeHrefString(GeospatialAreaModelExtensions.GetDetailUrl(a.GeospatialAreaID), a.GetGeospatialAreaShortNameWithColor()), 300, DhtmlxGridColumnFilterType.Html);
     Add($"# of {FieldDefinitionEnum.Project.ToType().GetFieldDefinitionLabelPluralized()}", a => a.ProjectViewableByUserCount, 65);
 }