Beispiel #1
0
        public DetailViewData(Person currentPerson, StormwaterJurisdiction stormwaterJurisdiction) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            StormwaterJurisdiction = stormwaterJurisdiction;
            PageTitle  = stormwaterJurisdiction.GetOrganizationDisplayName();
            EntityName = $"{FieldDefinitionType.Jurisdiction.GetFieldDefinitionLabelPluralized()}";
            EntityUrl  = SitkaRoute <JurisdictionController> .BuildUrlFromExpression(x => x.Index());



            TreatmentBMPGridSpec = new TreatmentBMPGridSpec(currentPerson, false, false)
            {
                ObjectNameSingular  = "Treatment BMP",
                ObjectNamePlural    = $"Treatment BMPs for {stormwaterJurisdiction.GetOrganizationDisplayName()}",
                SaveFiltersInCookie = true
            };
            TreatmentBMPGridName    = "jurisdictionTreatmentBMPGrid";
            TreatmentBMPGridDataUrl = SitkaRoute <JurisdictionController> .BuildUrlFromExpression(x => x.JurisdictionTreatmentBMPGridJsonData(stormwaterJurisdiction));

            UsersAssignedToJurisdiction        = StormwaterJurisdiction.PeopleWhoCanManageStormwaterJurisdictionExceptSitka().ToList();
            UserHasJurisdictionEditPermissions = new NeptuneAdminFeature().HasPermissionByPerson(CurrentPerson);

            EditStormwaterJurisdictionLink = UserHasJurisdictionEditPermissions
                ? ModalDialogFormHelper.MakeEditIconLink(SitkaRoute <JurisdictionController> .BuildUrlFromExpression(c => c.Edit(stormwaterJurisdiction)),
                                                         $"Edit Jurisdiction - {StormwaterJurisdiction.GetOrganizationDisplayName()}",
                                                         true)
                : new HtmlString(string.Empty);
        }
Beispiel #2
0
        // done
        public static double TargetLoadReduction(StormwaterJurisdiction jurisdiction)
        {
            var vTrashGeneratingUnitLoadStatistics = HttpRequestStorage.DatabaseEntities.vTrashGeneratingUnitLoadStatistics.Where(x =>
                                                                                                                                  x.StormwaterJurisdictionID == jurisdiction.StormwaterJurisdictionID && x.PriorityLandUseTypeID != PriorityLandUseType.ALU.PriorityLandUseTypeID);

            return(vTrashGeneratingUnitLoadStatistics.Any()
                ? vTrashGeneratingUnitLoadStatistics.Sum(x =>
                                                         x.Area * (double)(x.BaselineLoadingRate - FullTrashCaptureLoading) *
                                                         DbSpatialHelper.SquareMetersToAcres)
                : 0);
        }
Beispiel #3
0
        public static double LoadBasedPartialCapture(StormwaterJurisdiction jurisdiction)
        {
            var vTrashGeneratingUnitLoadStatistics = HttpRequestStorage.DatabaseEntities.vTrashGeneratingUnitLoadStatistics.Where(x =>
                                                                                                                                  x.StormwaterJurisdictionID == jurisdiction.StormwaterJurisdictionID && x.IsPartialTrashCapture);

            return(vTrashGeneratingUnitLoadStatistics.Any()
                ? vTrashGeneratingUnitLoadStatistics.Sum(x =>
                                                         x.Area * (double)(x.BaselineLoadingRate - x.CurrentLoadingRate) *
                                                         DbSpatialHelper.SquareMetersToAcres)
                : 0);
        }
Beispiel #4
0
        public static double LoadBasedOVTAProgressScores(StormwaterJurisdiction jurisdiction)
        {
            var vTrashGeneratingUnitLoadStatistics =
                HttpRequestStorage.DatabaseEntities.vTrashGeneratingUnitLoadStatistics.Where(x =>
                                                                                             x.StormwaterJurisdictionID == jurisdiction.StormwaterJurisdictionID &&
                                                                                             x.HasBaselineScore == true && x.HasProgressScore == true);

            return(vTrashGeneratingUnitLoadStatistics.Any()
                ? vTrashGeneratingUnitLoadStatistics.Sum(x =>
                                                         x.Area * (double)(x.BaselineLoadingRate - x.ProgressLoadingRate) *
                                                         DbSpatialHelper.SquareMetersToAcres)
                : 0);
        }
        public InitiateOVTAViewData(Person currentPerson,
                                    Models.OnlandVisualTrashAssessment ovta, List <StormwaterJurisdiction> jurisdictions,
                                    SelectOVTAAreaMapInitJson mapInitJson,
                                    IEnumerable <Models.OnlandVisualTrashAssessmentArea> onlandVisualTrashAssessmentAreas,
                                    StormwaterJurisdiction defaultJurisdiction, string geoServerUrl)
            : base(currentPerson, Models.OVTASection.InitiateOVTA, ovta)
        {
            Jurisdictions       = jurisdictions;
            MapInitJson         = mapInitJson;
            DefaultJurisdiction = defaultJurisdiction;
            var useDefaultJurisdiction = defaultJurisdiction != null;

            ViewDataForAngular = new ViewDataForAngularClass(mapInitJson, onlandVisualTrashAssessmentAreas, useDefaultJurisdiction, jurisdictions, geoServerUrl);
        }
Beispiel #6
0
        public ViewResult Index()
        {
            var stormwaterJurisdictionsPersonCanView = CurrentPerson.GetStormwaterJurisdictionsPersonCanView().ToList();

            if (!stormwaterJurisdictionsPersonCanView.Any())
            {
                throw new SitkaRecordNotAuthorizedException(
                          "You are not assigned to any Jurisdictions. Please log out and log in as a different user or request additional permissions");
            }

            var stormwaterJurisdictionIDsPersonCanView = stormwaterJurisdictionsPersonCanView.Select(x => x.StormwaterJurisdictionID);
            var treatmentBmps            = CurrentPerson.GetTreatmentBmpsPersonCanView();
            var treatmentBMPLayerGeoJson = new LayerGeoJson("Treatment BMPs", treatmentBmps.ToGeoJsonFeatureCollectionForTrashMap(), "blue", 1, LayerInitialVisibility.Show)
            {
                EnablePopups = false
            };

            var parcels = HttpRequestStorage.DatabaseEntities.Parcels.Include(x => x.WaterQualityManagementPlanParcels).Include(x => x.WaterQualityManagementPlanParcels.Select(y => y.WaterQualityManagementPlan)).Where(x => x.WaterQualityManagementPlanParcels.Any()).ToList();

            var parcelLayerGeoJson = new LayerGeoJson("Parcels", parcels.ToGeoJsonFeatureCollectionForTrashMap(), "blue", 1, LayerInitialVisibility.Show)
            {
                EnablePopups = false
            };

            var boundingBox = BoundingBox.GetBoundingBox(stormwaterJurisdictionsPersonCanView);
            var geoJsonForJurisdictions = StormwaterJurisdiction.ToGeoJsonFeatureCollection(stormwaterJurisdictionsPersonCanView);
            var jurisdictionLayersGeoJson = new List <LayerGeoJson> {
                new LayerGeoJson(MapInitJsonHelpers.CountyCityLayerName, geoJsonForJurisdictions, "#FF6C2D", 0m, LayerInitialVisibility.Hide)
            }.ToList(); var ovtaBasedMapInitJson = new TrashModuleMapInitJson("ovtaBasedResultsMap", treatmentBMPLayerGeoJson, parcelLayerGeoJson, boundingBox, jurisdictionLayersGeoJson)

            {
                LayerControlClass = "ovta-based-map-layer-control"
            };
            var areaBasedMapInitJson = new StormwaterMapInitJson("areaBasedResultsMap", boundingBox, jurisdictionLayersGeoJson)
            {
                LayerControlClass = "area-based-map-layer-control"
            };
            var loadBasedMapInitJson = new StormwaterMapInitJson("loadBasedResultsMap", boundingBox, jurisdictionLayersGeoJson)
            {
                LayerControlClass = "load-based-map-layer-control"
            };
            var neptunePage = NeptunePage.GetNeptunePageByPageType(NeptunePageType.TrashHomePage);
            var viewData    = new IndexViewData(CurrentPerson, neptunePage, ovtaBasedMapInitJson, areaBasedMapInitJson,
                                                loadBasedMapInitJson, treatmentBmps, TrashCaptureStatusType.All, parcels, stormwaterJurisdictionsPersonCanView, geoJsonForJurisdictions);

            return(RazorView <Index, IndexViewData>(viewData));
        }
            public static StormwaterJurisdiction Create()
            {
                var jurisdiction = new StormwaterJurisdiction(TestOrganization.Create(), null, StormwaterJurisdictionPublicBMPVisibilityType.VerifiedOnly, StormwaterJurisdictionPublicWQMPVisibilityType.ActiveAndInactive);

                return(jurisdiction);
            }
Beispiel #8
0
 private List <vTreatmentBMPDetailed> GetJurisdictionTreatmentBMPsAndGridSpec(out TreatmentBMPGridSpec gridSpec, Person currentPerson, StormwaterJurisdiction stormwaterJurisdiction)
 {
     gridSpec = new TreatmentBMPGridSpec(currentPerson, false, false);
     return(HttpRequestStorage.DatabaseEntities.vTreatmentBMPDetaileds.ToList()
            .Where(x => currentPerson.IsAssignedToStormwaterJurisdiction(x.StormwaterJurisdictionID) && x.StormwaterJurisdictionID == stormwaterJurisdiction.StormwaterJurisdictionID).ToList());
 }
 public StormwaterJurisdictionSimple(StormwaterJurisdiction stormwaterJurisdiction)
 {
     StormwaterJurisdictionID          = stormwaterJurisdiction.StormwaterJurisdictionID;
     StormwaterJurisdictionDisplayName = stormwaterJurisdiction.GetOrganizationDisplayName();
 }