Пример #1
0
        public DetailViewData(Person currentPerson, Models.RegionalSubbasin regionalSubbasin, HRUCharacteristicsViewData hruCharacteristicsViewData, StormwaterMapInitJson mapInitJson, bool hasAnyHRUCharacteristics) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            HasAnyHRUCharacteristics = hasAnyHRUCharacteristics;
            EntityName = "Regional Subbasin";
            EntityUrl  = SitkaRoute <RegionalSubbasinController> .BuildUrlFromExpression(x => x.Index());

            PageTitle = $"{regionalSubbasin.Watershed} {regionalSubbasin.DrainID}: {regionalSubbasin.RegionalSubbasinID}";

            RegionalSubbasin           = regionalSubbasin;
            HRUCharacteristicsViewData = hruCharacteristicsViewData;
            MapInitJson = mapInitJson;
        }
Пример #2
0
        public DetailViewData(Person currentPerson, Models.WaterQualityManagementPlan waterQualityManagementPlan,
                              WaterQualityManagementPlanVerify waterQualityManagementPlanVerifyDraft, MapInitJson mapInitJson,
                              List <Models.TreatmentBMP> treatmentBMPs,
                              ParcelGridSpec parcelGridSpec, List <WaterQualityManagementPlanVerify> waterQualityManagementPlanVerifies,
                              List <WaterQualityManagementPlanVerifyQuickBMP> waterQualityManagementPlanVerifyQuickBmPs,
                              List <WaterQualityManagementPlanVerifyTreatmentBMP> waterQualityManagementPlanVerifyTreatmentBmPs,
                              HRUCharacteristicsViewData hruCharacteristicsViewData, bool anyLspcBasins,
                              List <DryWeatherFlowOverride> dryWeatherFlowOverrides,
                              List <WaterQualityManagementPlanModelingApproach> waterQualityManagementPlanModelingApproaches, ModeledPerformanceViewData modeledPerformanceViewData)
            : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            WaterQualityManagementPlan = waterQualityManagementPlan;
            PageTitle  = WaterQualityManagementPlan.WaterQualityManagementPlanName;
            EntityName = $"{FieldDefinitionType.WaterQualityManagementPlan.GetFieldDefinitionLabelPluralized()}";
            EntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Index());

            CurrentPersonCanManageWaterQualityManagementPlans = new WaterQualityManagementPlanManageFeature()
                                                                .HasPermission(currentPerson, waterQualityManagementPlan)
                                                                .HasPermission;
            currentPerson.IsManagerOrAdmin();
            EditInventoriedBMPsUrl =
                SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c =>
                                                                                          c.EditWqmpBmps(WaterQualityManagementPlan));

            EditSimplifiedStructuralBMPsUrl =
                SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c =>
                                                                                          c.EditSimplifiedStructuralBMPs(WaterQualityManagementPlan));

            EditSourceControlBMPsUrl =
                SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c =>
                                                                                          c.EditSourceControlBMPs(WaterQualityManagementPlan));

            EditModelingApproachUrl =
                SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c =>
                                                                                          c.EditModelingApproach(WaterQualityManagementPlan));

            EditParcelsUrl =
                SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c =>
                                                                                          c.EditWqmpParcels(WaterQualityManagementPlan));

            NewDocumentUrl =
                SitkaRoute <WaterQualityManagementPlanDocumentController> .BuildUrlFromExpression(c =>
                                                                                                  c.New(waterQualityManagementPlan));

            MapInitJson = mapInitJson;

            ParameterizationErrors = CheckForParameterizationErrors(waterQualityManagementPlan);

            ParcelGridSpec    = parcelGridSpec;
            ParcelGridName    = "parcelGrid";
            ParcelGridDataUrl = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c =>
                                                                                                          c.ParcelsForWaterQualityManagementPlanGridData(waterQualityManagementPlan));

            HasSavedWqmpDraft = waterQualityManagementPlanVerifyDraft != null &&
                                waterQualityManagementPlanVerifyDraft.IsDraft;
            BeginOMVerificationRecordUrl = HasSavedWqmpDraft
                ? SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c =>
                                                                                            c.EditWqmpVerifyModal(waterQualityManagementPlanVerifyDraft))
                : SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c =>
                                                                                            c.NewWqmpVerify(waterQualityManagementPlan));

            SourceControlBMPs = waterQualityManagementPlan.SourceControlBMPs
                                .Where(x => x.IsPresent == true || x.SourceControlBMPNote != null)
                                .OrderBy(x => x.SourceControlBMPAttributeID)
                                .GroupBy(x => x.SourceControlBMPAttribute.SourceControlBMPAttributeCategoryID);
            WaterQualityManagementPlanVerifies            = waterQualityManagementPlanVerifies;
            WaterQualityManagementPlanVerifyQuickBMPs     = waterQualityManagementPlanVerifyQuickBmPs;
            WaterQualityManagementPlanVerifyTreatmentBMPs = waterQualityManagementPlanVerifyTreatmentBmPs;
            HRUCharacteristicsViewData = hruCharacteristicsViewData;

            TreatmentBMPs     = treatmentBMPs;
            QuickBMPs         = waterQualityManagementPlan.QuickBMPs.OrderBy(x => x.QuickBMPName).ToList();
            SourceControlBMPs = waterQualityManagementPlan.SourceControlBMPs
                                .Where(x => x.SourceControlBMPNote != null || (x.IsPresent != null && x.IsPresent == true))
                                .OrderBy(x => x.SourceControlBMPAttributeID)
                                .GroupBy(x => x.SourceControlBMPAttribute.SourceControlBMPAttributeCategoryID);
            var calculatedParcelAcres =
                WaterQualityManagementPlan
                .CalculateParcelAcreageTotal();     // This is 'calculated' by summing parcel recorded acres - not sure that's what's intended by calculated in this case

            // TODO: Never compare floating-point values to zero. We should establish an application-wide error tolerance and use that instead of the direct comparison
            CalculatedParcelArea = calculatedParcelAcres != 0
                ? $"{Math.Round(calculatedParcelAcres, 2).ToString(CultureInfo.InvariantCulture)} acres"
                : "No parcels have been associated with this WQMP";

            TrashCaptureEffectiveness = WaterQualityManagementPlan.TrashCaptureEffectiveness == null
                ? "Not Provided"
                : WaterQualityManagementPlan.TrashCaptureEffectiveness + "%";

            WaterQualityManagementPlanModelingApproaches = waterQualityManagementPlanModelingApproaches;
            ModeledPerformanceViewData = modeledPerformanceViewData;

            FieldDefinitionForPercentOfSiteTreated   = FieldDefinitionType.PercentOfSiteTreated;
            FieldDefinitionForPercentCaptured        = FieldDefinitionType.PercentCaptured;
            FieldDefinitionForPercentRetained        = FieldDefinitionType.PercentRetained;
            FieldDefinitionForFullyParameterized     = FieldDefinitionType.FullyParameterized;
            FieldDefinitionForDelineationStatus      = FieldDefinitionType.DelineationStatus;
            FieldDefinitionForDryWeatherFlowOverride = FieldDefinitionType.DryWeatherFlowOverride;

            AnyLSPCBasins = anyLspcBasins;

            UsesDetailedModelingApproach = WaterQualityManagementPlan.WaterQualityManagementPlanModelingApproachID ==
                                           WaterQualityManagementPlanModelingApproach.Detailed
                                           .WaterQualityManagementPlanModelingApproachID;

            if (UsesDetailedModelingApproach)
            {
                AnyDetailedBMPsNotFullyParameterized = TreatmentBMPs.Any(x => !(x.IsFullyParameterized() && (x.Delineation?.IsVerified ?? false)));
                AllDetailedBMPsNotFullyParameterized = TreatmentBMPs.All(x => !(x.IsFullyParameterized() && (x.Delineation?.IsVerified ?? false)));
                // this is redundant but I just want to make this perfectly clear.
                AnySimpleBMPsNotFullyParameterized = false;
                AllSimpleBMPsNotFullyParameterized = false;
            }
            else
            {
                AnySimpleBMPsNotFullyParameterized = QuickBMPs.Any(x => !x.IsFullyParameterized());
                AllSimpleBMPsNotFullyParameterized = QuickBMPs.All(x => !x.IsFullyParameterized());
                // this is redundant but I just want to make this perfectly clear.
                AnyDetailedBMPsNotFullyParameterized = false;
                AllDetailedBMPsNotFullyParameterized = false;
            }
        }
Пример #3
0
        public DetailViewData(Person currentPerson, Models.TreatmentBMP treatmentBMP,
                              TreatmentBMPDetailMapInitJson mapInitJson, ImageCarouselViewData imageCarouselViewData,
                              string verifiedUnverifiedUrl, HRUCharacteristicsViewData hruCharacteristicsViewData, string mapServiceUrl, ModeledPerformanceViewData modeledPerformanceViewData)
            : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            TreatmentBMP = treatmentBMP;
            PageTitle    = treatmentBMP.TreatmentBMPName;
            EntityName   = $"{FieldDefinitionType.TreatmentBMP.GetFieldDefinitionLabelPluralized()}";
            EntityUrl    = SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x => x.FindABMP());

            MapInitJson                 = mapInitJson;
            ImageCarouselViewData       = imageCarouselViewData;
            AddBenchmarkAndThresholdUrl = SitkaRoute <TreatmentBMPBenchmarkAndThresholdController> .BuildUrlFromExpression(x => x.Instructions(treatmentBMP.TreatmentBMPID));

            HasSettableBenchmarkAndThresholdValues = TreatmentBMP.HasSettableBenchmarkAndThresholdValues();
            CurrentPersonCanManage = new TreatmentBMPManageFeature().HasPermission(currentPerson, TreatmentBMP).HasPermission;
            CurrentPersonIsAnonymousOrUnassigned = currentPerson.IsAnonymousOrUnassigned();
            CanManageStormwaterJurisdiction      = currentPerson.CanManageStormwaterJurisdiction(treatmentBMP.StormwaterJurisdictionID);
            CanEditStormwaterJurisdiction        = currentPerson.IsAssignedToStormwaterJurisdiction(treatmentBMP.StormwaterJurisdictionID);
            UserIsAdmin = new NeptuneAdminFeature().HasPermissionByPerson(currentPerson);

            CanEditBenchmarkAndThresholds = CurrentPersonCanManage && HasSettableBenchmarkAndThresholdValues;

            FieldVisitGridSpec    = new FieldVisitGridSpec(CurrentPerson, true);
            FieldVisitGridName    = "FieldVisit";
            FieldVisitGridDataUrl = SitkaRoute <FieldVisitController> .BuildUrlFromExpression(x => x.FieldVisitGridJsonData(treatmentBMP));

            NewFieldVisitUrl = SitkaRoute <FieldVisitController> .BuildUrlFromExpression(x => x.New(treatmentBMP));

            NewTreatmentBMPDocumentUrl = SitkaRoute <TreatmentBMPDocumentController> .BuildUrlFromExpression(x => x.New(treatmentBMP));

            NewFundingSourcesUrl = SitkaRoute <FundingEventController> .BuildUrlFromExpression(x => x.NewFundingEvent(treatmentBMP));

            //This handles an extreme edge case, but a bmp came back without a regional subbasin
            OtherTreatmentBmpsExistInSubbasin = TreatmentBMP.GetRegionalSubbasin()?.GetTreatmentBMPs().Any(x => x.TreatmentBMPID != TreatmentBMP.TreatmentBMPID) ?? false;

            EditTreatmentBMPPerformanceAndModelingAttributesUrl = SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x => x.EditModelingAttributes(treatmentBMP));

            EditTreatmentBMPOtherDesignAttributesUrl = SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x => x.EditAttributes(treatmentBMP, CustomAttributeTypePurpose.OtherDesignAttributes));

            LocationEditUrl = SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x => x.EditLocation(treatmentBMP));

            ManageTreatmentBMPImagesUrl = SitkaRoute <TreatmentBMPImageController> .BuildUrlFromExpression(x => x.ManageTreatmentBMPImages(TreatmentBMP));

            VerifiedUnverifiedUrl      = verifiedUnverifiedUrl;
            HRUCharacteristicsViewData = hruCharacteristicsViewData;
            MapServiceUrl = mapServiceUrl;
            ModeledPerformanceViewData = modeledPerformanceViewData;

            DelineationArea   = (TreatmentBMP.Delineation?.DelineationGeometry.Area * DbSpatialHelper.SquareMetersToAcres)?.ToString("0.00") ?? "-";
            DelineationStatus = TreatmentBMP.GetDelineationStatus();

            DelineationErrors = CheckForDelineationErrors(treatmentBMP);

            DisplayTrashCaptureEffectiveness = TreatmentBMP.TrashCaptureStatusTypeID ==
                                               TrashCaptureStatusType.Partial.TrashCaptureStatusTypeID;

            TrashCaptureEffectiveness = TreatmentBMP.TrashCaptureEffectiveness == null ? "Not Provided" : TreatmentBMP.TrashCaptureEffectiveness + "%";

            DelineationMapUrl = treatmentBMP.GetDelineationMapUrl();

            ParameterizationErrors = CheckForParameterizationErrors(treatmentBMP);

            ChangeTreatmentBMPTypeUrl = SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x => x.ConvertTreatmentBMPType(treatmentBMP));

            HasModelingAttributes = TreatmentBMP.TreatmentBMPType.TreatmentBMPModelingType != null;

            FieldDefinitionForAverageDivertedFlowrate             = FieldDefinitionType.AverageDivertedFlowrate;
            FieldDefinitionForAverageTreatmentFlowrate            = FieldDefinitionType.AverageTreatmentFlowrate;
            FieldDefinitionForDesignDryWeatherTreatmentCapacity   = FieldDefinitionType.DesignDryWeatherTreatmentCapacity;
            FieldDefinitionForDesignLowFlowDiversionCapacity      = FieldDefinitionType.DesignLowFlowDiversionCapacity;
            FieldDefinitionForDesignMediaFiltrationRate           = FieldDefinitionType.DesignMediaFiltrationRate;
            FieldDefinitionForDesignResidenceTimeforPermanentPool = FieldDefinitionType.DesignResidenceTimeForPermanentPool;
            FieldDefinitionForDiversionRate = FieldDefinitionType.DiversionRate;
            FieldDefinitionForDrawdownTimeforWQDetentionVolume = FieldDefinitionType.DrawdownTimeForWQDetentionVolume;
            FieldDefinitionForEffectiveFootprint                      = FieldDefinitionType.EffectiveFootprint;
            FieldDefinitionForEffectiveRetentionDepth                 = FieldDefinitionType.EffectiveRetentionDepth;
            FieldDefinitionForInfiltrationDischargeRate               = FieldDefinitionType.InfiltrationDischargeRate;
            FieldDefinitionForInfiltrationSurfaceArea                 = FieldDefinitionType.InfiltrationSurfaceArea;
            FieldDefinitionForMediaBedFootprint                       = FieldDefinitionType.MediaBedFootprint;
            FieldDefinitionForMonthsofOperation                       = FieldDefinitionType.MonthsOperational;
            FieldDefinitionForPermanentPoolorWetlandVolume            = FieldDefinitionType.PermanentPoolOrWetlandVolume;
            FieldDefinitionForRoutingConfiguration                    = FieldDefinitionType.RoutingConfiguration;
            FieldDefinitionForStorageVolumeBelowLowestOutletElevation = FieldDefinitionType.StorageVolumeBelowLowestOutletElevation;
            FieldDefinitionForSummerHarvestedWaterDemand              = FieldDefinitionType.SummerHarvestedWaterDemand;
            FieldDefinitionForTimeofConcentration                     = FieldDefinitionType.TimeOfConcentration;
            FieldDefinitionForDrawdownTimeForDetentionVolume          = FieldDefinitionType.DrawdownTimeForDetentionVolume;
            FieldDefinitionForTotalEffectiveBMPVolume                 = FieldDefinitionType.TotalEffectiveBMPVolume;
            FieldDefinitionForTotalEffectiveDrywellBMPVolume          = FieldDefinitionType.TotalEffectiveDrywellBMPVolume;
            FieldDefinitionForTreatmentRate = FieldDefinitionType.TreatmentRate;
            FieldDefinitionForUnderlyingHydrologicSoilGroupHSG = FieldDefinitionType.UnderlyingHydrologicSoilGroupHSG;
            FieldDefinitionForUnderlyingInfiltrationRate       = FieldDefinitionType.UnderlyingInfiltrationRate;
            FieldDefinitionForUpstreamBMP = FieldDefinitionType.UpstreamBMP;
            FieldDefinitionForWaterQualityDetentionVolume = FieldDefinitionType.WaterQualityDetentionVolume;
            FieldDefinitionForWettedFootprint             = FieldDefinitionType.WettedFootprint;
            FieldDefinitionForWinterHarvestedWaterDemand  = FieldDefinitionType.WinterHarvestedWaterDemand;
            FieldDefinitionForWatershed              = FieldDefinitionType.Watershed;
            FieldDefinitionForDesignStormwaterDepth  = FieldDefinitionType.DesignStormwaterDepth;
            FieldDefinitionForDryWeatherFlowOverride = FieldDefinitionType.DryWeatherFlowOverride;

            OpenRevisionRequest = TreatmentBMP.RegionalSubbasinRevisionRequests.SingleOrDefault(x =>
                                                                                                x.RegionalSubbasinRevisionRequestStatus == RegionalSubbasinRevisionRequestStatus.Open);

            EditUpstreamBMPUrl =
                SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x => x.EditUpstreamBMP(treatmentBMP));

            RemoveUpstreamBMPUrl =
                SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x => x.RemoveUpstreamBMP(treatmentBMP));

            IsAnalyzedInModelingModule = treatmentBMP.TreatmentBMPType.IsAnalyzedInModelingModule;
            IsInSOC = treatmentBMP.LSPCBasinID != null;
            IsFullyParameterized = treatmentBMP.IsFullyParameterized();
        }