Ejemplo n.º 1
0
        public AssessmentDetailViewData(Person currentPerson, Models.TreatmentBMPAssessment treatmentBMPAssessment, TreatmentBMPAssessmentTypeEnum fieldVisitAssessmentType)
        {
            FieldVisitAssessmentType = fieldVisitAssessmentType;
            if (treatmentBMPAssessment != null)
            {
                TreatmentBMPAssessment       = treatmentBMPAssessment;
                CurrentPersonCanManage       = currentPerson.IsAssignedToStormwaterJurisdiction(treatmentBMPAssessment.TreatmentBMP.StormwaterJurisdictionID);
                ScoreDetailViewData          = new ScoreDetailViewData(treatmentBMPAssessment);
                EditBenchmarkAndThresholdUrl =
                    SitkaRoute <TreatmentBMPBenchmarkAndThresholdController> .BuildUrlFromExpression(x =>
                                                                                                     x.Instructions(treatmentBMPAssessment.TreatmentBMP));

                CanEdit = CurrentPersonCanManage && treatmentBMPAssessment.CanEdit(currentPerson) &&
                          !treatmentBMPAssessment.IsAssessmentComplete;

                var carouselImages = TreatmentBMPAssessment.TreatmentBMPAssessmentPhotos;
                ImageCarouselViewData = new ImageCarouselViewData(carouselImages, 400);
            }
        }
Ejemplo n.º 2
0
        public DetailViewData(Person currentPerson, Models.TreatmentBMPAssessment treatmentBMPAssessment)
            : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            TreatmentBMPAssessment       = treatmentBMPAssessment;
            CurrentPersonCanManage       = CurrentPerson.IsAssignedToStormwaterJurisdiction(treatmentBMPAssessment.TreatmentBMP.StormwaterJurisdictionID);
            ScoreDetailViewData          = new ScoreDetailViewData(treatmentBMPAssessment);
            EditBenchmarkAndThresholdUrl =
                SitkaRoute <TreatmentBMPBenchmarkAndThresholdController> .BuildUrlFromExpression(x =>
                                                                                                 x.Instructions(treatmentBMPAssessment.TreatmentBMP));

            CanEdit = CurrentPersonCanManage && treatmentBMPAssessment.CanEdit(CurrentPerson) && !treatmentBMPAssessment.IsAssessmentComplete;

            EntityName = "Treatment BMP Assessments";
            EntityUrl  = SitkaRoute <AssessmentController> .BuildUrlFromExpression(x => x.Index());

            SubEntityName = treatmentBMPAssessment.TreatmentBMP.TreatmentBMPName;
            SubEntityUrl  = treatmentBMPAssessment.TreatmentBMP.GetDetailUrl();
            PageTitle     = treatmentBMPAssessment.GetAssessmentDate().ToStringDate();

            var carouselImages = TreatmentBMPAssessment.TreatmentBMPAssessmentPhotos;

            ImageCarouselViewData = new ImageCarouselViewData(carouselImages, 400);
        }
Ejemplo n.º 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();
        }