Exemplo n.º 1
0
 public TreatmentBMPDocument(TreatmentBMP treatmentBMP)
     : this(ModelObjectHelpers.NotYetAssignedID, treatmentBMP.TreatmentBMPID, string.Empty, DateTime.Now)
 {
     // ReSharper disable DoNotCallOverridableMethodsInConstructor
     TreatmentBMP = treatmentBMP;
     // ReSharper restore DoNotCallOverridableMethodsInConstructor
 }
        public double?GetThresholdValue(TreatmentBMP treatmentBMP)
        {
            var treatmentBMPBenchmarkAndThreshold = treatmentBMP.TreatmentBMPBenchmarkAndThresholds
                                                    .SingleOrDefault(x => x.TreatmentBMPAssessmentObservationType == this);

            return(treatmentBMPBenchmarkAndThreshold?.ThresholdValue);
        }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public TreatmentBMPModelingAttribute(TreatmentBMP treatmentBMP) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.TreatmentBMPModelingAttributeID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP   = treatmentBMP;
 }
Exemplo n.º 4
0
        public static void UpdatedCentralizedBMPDelineationIfPresent(this TreatmentBMP treatmentBMP)
        {
            if (treatmentBMP.Delineation == null || treatmentBMP.Delineation.DelineationTypeID != (int)DelineationTypeEnum.Centralized)
            {
                return;
            }

            var updated4326Geometry =
                treatmentBMP.GetCentralizedDelineationGeometry4326(HttpRequestStorage.DatabaseEntities);

            if (updated4326Geometry == null || !updated4326Geometry.SpatialEquals(treatmentBMP.Delineation.DelineationGeometry4326))
            {
                var oldShape = treatmentBMP.Delineation.DelineationGeometry;
                var newShape = treatmentBMP.GetCentralizedDelineationGeometry2771(HttpRequestStorage.DatabaseEntities);
                if (updated4326Geometry != null)
                {
                    treatmentBMP.Delineation.DelineationGeometry     = newShape;
                    treatmentBMP.Delineation.DelineationGeometry4326 = updated4326Geometry;
                    treatmentBMP.Delineation.IsVerified       = false;
                    treatmentBMP.Delineation.DateLastModified = DateTime.Now;
                }
                else
                {
                    treatmentBMP.Delineation.DeleteDelineation(HttpRequestStorage.DatabaseEntities);
                }
            }
        }
Exemplo n.º 5
0
 public static string GetDetailUrl(this TreatmentBMP treatmentBMP)
 {
     if (treatmentBMP == null)
     {
         return("");
     }
     return(DetailUrlTemplate.ParameterReplace(treatmentBMP.TreatmentBMPID));
 }
Exemplo n.º 6
0
 public static string GetJurisdictionSummaryUrl(this TreatmentBMP treatmentBMP)
 {
     if (treatmentBMP == null)
     {
         return("");
     }
     return(DetailJurisdictionUrlTemplate.ParameterReplace(treatmentBMP.StormwaterJurisdictionID));
 }
Exemplo n.º 7
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public FundingEvent(TreatmentBMP treatmentBMP, FundingEventType fundingEventType, int year) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.FundingEventID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP   = treatmentBMP;
     treatmentBMP.FundingEvents.Add(this);
     this.FundingEventTypeID = fundingEventType.FundingEventTypeID;
     this.Year = year;
 }
Exemplo n.º 8
0
 public static void SetTreatmentBMPPointInPolygonDataByLocationPoint(this TreatmentBMP treatmentBMP,
                                                                     DbGeometry locationPoint)
 {
     treatmentBMP.WatershedID = HttpRequestStorage.DatabaseEntities.Watersheds
                                .FirstOrDefault(x => locationPoint.Intersects(x.WatershedGeometry))?.WatershedID;
     treatmentBMP.LSPCBasinID = HttpRequestStorage.DatabaseEntities.LSPCBasins
                                .FirstOrDefault(x => locationPoint.Intersects(x.LSPCBasinGeometry))?.LSPCBasinID;
     treatmentBMP.PrecipitationZoneID = HttpRequestStorage.DatabaseEntities.PrecipitationZones
                                        .FirstOrDefault(x => locationPoint.Intersects(x.PrecipitationZoneGeometry))?.PrecipitationZoneID;
     treatmentBMP.RegionalSubbasinID = HttpRequestStorage.DatabaseEntities.RegionalSubbasins
                                       .FirstOrDefault(x => locationPoint.Intersects(x.CatchmentGeometry))?.RegionalSubbasinID;
 }
Exemplo n.º 9
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public TreatmentBMPImage(FileResource fileResource, TreatmentBMP treatmentBMP, DateTime uploadDate) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.TreatmentBMPImageID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.FileResourceID      = fileResource.FileResourceID;
     this.FileResource        = fileResource;
     fileResource.TreatmentBMPImages.Add(this);
     this.TreatmentBMPID = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP   = treatmentBMP;
     treatmentBMP.TreatmentBMPImages.Add(this);
     this.UploadDate = uploadDate;
 }
Exemplo n.º 10
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public MaintenanceRecord(TreatmentBMP treatmentBMP, TreatmentBMPType treatmentBMPType, FieldVisit fieldVisit) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.MaintenanceRecordID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID      = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP        = treatmentBMP;
     treatmentBMP.MaintenanceRecords.Add(this);
     this.TreatmentBMPTypeID = treatmentBMPType.TreatmentBMPTypeID;
     this.TreatmentBMPType   = treatmentBMPType;
     treatmentBMPType.MaintenanceRecords.Add(this);
     this.FieldVisitID = fieldVisit.FieldVisitID;
     this.FieldVisit   = fieldVisit;
 }
Exemplo n.º 11
0
        public static bool HasVerifiedDelineationForModelingPurposes(this TreatmentBMP treatmentBMP, List <int> treatmentBmpiDsTraversed)
        {
            if (treatmentBMP.UpstreamBMP != null)
            {
                if (treatmentBmpiDsTraversed.Contains(treatmentBMP.TreatmentBMPID))
                {
                    throw new OverflowException($"Infinite loop detected!  TreatmentBMPID {treatmentBMP.TreatmentBMPID} already in list of traversed TreatmentBMPIDs ({string.Join(", ", treatmentBmpiDsTraversed)})");
                }
                treatmentBmpiDsTraversed.Add(treatmentBMP.TreatmentBMPID);
                return(treatmentBMP.UpstreamBMP.HasVerifiedDelineationForModelingPurposes(treatmentBmpiDsTraversed));
            }

            return(treatmentBMP.Delineation?.IsVerified ?? false);
        }
Exemplo n.º 12
0
        public bool IsCompleteForTreatmentBMP(TreatmentBMP treatmentBMP)
        {
            Check.Assert(
                treatmentBMP.TreatmentBMPType.TreatmentBMPTypeCustomAttributeTypes.Select(x => x.CustomAttributeTypeID).Contains(CustomAttributeTypeID),
                "The Custom Attribute Type is not valid for this Treatment BMP");

            var customAttribute = treatmentBMP.CustomAttributes.SingleOrDefault(x => x.CustomAttributeTypeID == CustomAttributeTypeID);

            if (customAttribute == null)
            {
                return(false);
            }
            return(customAttribute.CustomAttributeValues.Any(x => !string.IsNullOrWhiteSpace(x.AttributeValue)));
        }
Exemplo n.º 13
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public RegionalSubbasinRevisionRequest(TreatmentBMP treatmentBMP, DbGeometry regionalSubbasinRevisionRequestGeometry, Person requestPerson, RegionalSubbasinRevisionRequestStatus regionalSubbasinRevisionRequestStatus, DateTime requestDate) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.RegionalSubbasinRevisionRequestID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP   = treatmentBMP;
     treatmentBMP.RegionalSubbasinRevisionRequests.Add(this);
     this.RegionalSubbasinRevisionRequestGeometry = regionalSubbasinRevisionRequestGeometry;
     this.RequestPersonID = requestPerson.PersonID;
     this.RequestPerson   = requestPerson;
     requestPerson.RegionalSubbasinRevisionRequestsWhereYouAreTheRequestPerson.Add(this);
     this.RegionalSubbasinRevisionRequestStatusID = regionalSubbasinRevisionRequestStatus.RegionalSubbasinRevisionRequestStatusID;
     this.RequestDate = requestDate;
 }
Exemplo n.º 14
0
        public static LayerGeoJson MakeTreatmentBMPDelineationLayerGeoJson(TreatmentBMP treatmentBMP)
        {
            Check.Require(treatmentBMP.Delineation?.DelineationGeometry != null, "Tried to build delineation layer when delineation was null");
            var featureCollection = new FeatureCollection();
            var feature           = DbGeometryToGeoJsonHelper.FromDbGeometryWithNoReproject(treatmentBMP.Delineation?.DelineationGeometry4326);

            featureCollection.Features.Add(feature);

            var treatmentBMPLayerGeoJson = new LayerGeoJson("Delineation", featureCollection, "blue", 1, LayerInitialVisibility.Show)
            {
                EnablePopups = false
            };

            return(treatmentBMPLayerGeoJson);
        }
Exemplo n.º 15
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public FieldVisit(TreatmentBMP treatmentBMP, FieldVisitStatus fieldVisitStatus, Person performedByPerson, DateTime visitDate, bool inventoryUpdated, FieldVisitType fieldVisitType, bool isFieldVisitVerified) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.FieldVisitID   = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP   = treatmentBMP;
     treatmentBMP.FieldVisits.Add(this);
     this.FieldVisitStatusID  = fieldVisitStatus.FieldVisitStatusID;
     this.PerformedByPersonID = performedByPerson.PersonID;
     this.PerformedByPerson   = performedByPerson;
     performedByPerson.FieldVisitsWhereYouAreThePerformedByPerson.Add(this);
     this.VisitDate            = visitDate;
     this.InventoryUpdated     = inventoryUpdated;
     this.FieldVisitTypeID     = fieldVisitType.FieldVisitTypeID;
     this.IsFieldVisitVerified = isFieldVisitVerified;
 }
Exemplo n.º 16
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public TreatmentBMPAssessment(TreatmentBMP treatmentBMP, TreatmentBMPType treatmentBMPType, FieldVisit fieldVisit, TreatmentBMPAssessmentType treatmentBMPAssessmentType, bool isAssessmentComplete) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.TreatmentBMPAssessmentID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID           = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP             = treatmentBMP;
     treatmentBMP.TreatmentBMPAssessments.Add(this);
     this.TreatmentBMPTypeID = treatmentBMPType.TreatmentBMPTypeID;
     this.TreatmentBMPType   = treatmentBMPType;
     treatmentBMPType.TreatmentBMPAssessments.Add(this);
     this.FieldVisitID = fieldVisit.FieldVisitID;
     this.FieldVisit   = fieldVisit;
     fieldVisit.TreatmentBMPAssessments.Add(this);
     this.TreatmentBMPAssessmentTypeID = treatmentBMPAssessmentType.TreatmentBMPAssessmentTypeID;
     this.IsAssessmentComplete         = isAssessmentComplete;
 }
Exemplo n.º 17
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public CustomAttribute(TreatmentBMP treatmentBMP, TreatmentBMPTypeCustomAttributeType treatmentBMPTypeCustomAttributeType, TreatmentBMPType treatmentBMPType, CustomAttributeType customAttributeType) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.CustomAttributeID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID    = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP      = treatmentBMP;
     treatmentBMP.CustomAttributes.Add(this);
     this.TreatmentBMPTypeCustomAttributeTypeID = treatmentBMPTypeCustomAttributeType.TreatmentBMPTypeCustomAttributeTypeID;
     this.TreatmentBMPTypeCustomAttributeType   = treatmentBMPTypeCustomAttributeType;
     treatmentBMPTypeCustomAttributeType.CustomAttributes.Add(this);
     this.TreatmentBMPTypeID = treatmentBMPType.TreatmentBMPTypeID;
     this.TreatmentBMPType   = treatmentBMPType;
     treatmentBMPType.CustomAttributes.Add(this);
     this.CustomAttributeTypeID = customAttributeType.CustomAttributeTypeID;
     this.CustomAttributeType   = customAttributeType;
     customAttributeType.CustomAttributes.Add(this);
 }
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public TreatmentBMPBenchmarkAndThreshold(TreatmentBMP treatmentBMP, TreatmentBMPTypeAssessmentObservationType treatmentBMPTypeAssessmentObservationType, TreatmentBMPType treatmentBMPType, TreatmentBMPAssessmentObservationType treatmentBMPAssessmentObservationType, double benchmarkValue, double thresholdValue) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.TreatmentBMPBenchmarkAndThresholdID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.TreatmentBMPID = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP   = treatmentBMP;
     treatmentBMP.TreatmentBMPBenchmarkAndThresholds.Add(this);
     this.TreatmentBMPTypeAssessmentObservationTypeID = treatmentBMPTypeAssessmentObservationType.TreatmentBMPTypeAssessmentObservationTypeID;
     this.TreatmentBMPTypeAssessmentObservationType   = treatmentBMPTypeAssessmentObservationType;
     treatmentBMPTypeAssessmentObservationType.TreatmentBMPBenchmarkAndThresholds.Add(this);
     this.TreatmentBMPTypeID = treatmentBMPType.TreatmentBMPTypeID;
     this.TreatmentBMPType   = treatmentBMPType;
     treatmentBMPType.TreatmentBMPBenchmarkAndThresholds.Add(this);
     this.TreatmentBMPAssessmentObservationTypeID = treatmentBMPAssessmentObservationType.TreatmentBMPAssessmentObservationTypeID;
     this.TreatmentBMPAssessmentObservationType   = treatmentBMPAssessmentObservationType;
     treatmentBMPAssessmentObservationType.TreatmentBMPBenchmarkAndThresholds.Add(this);
     this.BenchmarkValue = benchmarkValue;
     this.ThresholdValue = thresholdValue;
 }
Exemplo n.º 19
0
        /// <summary>
        /// Performs the RSB trace for a given Treatment BMP using the EPSG 2771 representation of the regional subbasin geometries
        /// </summary>
        /// <param name="treatmentBMP"></param>
        /// <param name="dbContext"></param>
        /// <returns></returns>
        public static DbGeometry GetCentralizedDelineationGeometry2771(this TreatmentBMP treatmentBMP,
                                                                       DatabaseEntities dbContext)
        {
            var regionalSubbasin =
                dbContext.RegionalSubbasins.SingleOrDefault(x =>
                                                            x.CatchmentGeometry.Contains(treatmentBMP.LocationPoint));

            var regionalSubbasinIDs = regionalSubbasin.TraceUpstreamCatchmentsReturnIDList(dbContext);

            regionalSubbasinIDs.Add(regionalSubbasin.RegionalSubbasinID);

            var unionOfUpstreamRegionalSubbasins = dbContext.RegionalSubbasins
                                                   .Where(x => regionalSubbasinIDs.Contains(x.RegionalSubbasinID)).Select(x => x.CatchmentGeometry)
                                                   .ToList().UnionListGeometries();

            // Remove interior slivers introduced in the case that the non-cascading union strategy is used (see UnionListGeometries for more info)
            var dbGeometry = unionOfUpstreamRegionalSubbasins.Buffer(0);

            return(dbGeometry);
        }
Exemplo n.º 20
0
        public static void UpdateUpstreamBMPReferencesIfNecessary(this TreatmentBMP treatmentBMP)
        {
            //If this BMP has an Upstream BMP, after the location change, can that Upstream BMP still fulfill its duty?
            if (treatmentBMP.UpstreamBMPID != null && !treatmentBMP.GetRegionalSubbasin().GetTreatmentBMPs().Contains(treatmentBMP.UpstreamBMP))
            {
                //Do we need to check ahead of time and warn them this will happen?
                //Do we need to return a message indicating that this has changed?
                treatmentBMP.UpstreamBMPID = null;
            }

            //If this BMP is an Upstream BMP for any other BMPs, after the location change, can this BMP still fulfill its duty?
            if (treatmentBMP.TreatmentBMPsWhereYouAreTheUpstreamBMP.Any())
            {
                treatmentBMP.TreatmentBMPsWhereYouAreTheUpstreamBMP.ToList().ForEach(x =>
                {
                    if (!x.GetRegionalSubbasin().CatchmentGeometry.Contains(treatmentBMP.LocationPoint))
                    {
                        x.UpstreamBMPID = null;
                    }
                });
            }
        }
Exemplo n.º 21
0
 public static string GetDelineationAreaString(this TreatmentBMP treatmentBMP)
 {
     return((treatmentBMP.Delineation?.DelineationGeometry.Area * DbSpatialHelper.SquareMetersToAcres)?.ToString("0.00") ?? "-");
 }
Exemplo n.º 22
0
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static Delineation CreateNewBlank(DelineationType delineationType, TreatmentBMP treatmentBMP)
 {
     return(new Delineation(default(DbGeometry), delineationType, default(bool), treatmentBMP, default(DateTime), default(bool)));
 }
Exemplo n.º 23
0
 /// <summary>
 /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible
 /// </summary>
 public Delineation(DbGeometry delineationGeometry, DelineationType delineationType, bool isVerified, TreatmentBMP treatmentBMP, DateTime dateLastModified, bool hasDiscrepancies) : this()
 {
     // Mark this as a new object by setting primary key with special value
     this.DelineationID       = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue();
     this.DelineationGeometry = delineationGeometry;
     this.DelineationTypeID   = delineationType.DelineationTypeID;
     this.IsVerified          = isVerified;
     this.TreatmentBMPID      = treatmentBMP.TreatmentBMPID;
     this.TreatmentBMP        = treatmentBMP;
     this.DateLastModified    = dateLastModified;
     this.HasDiscrepancies    = hasDiscrepancies;
 }
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static TreatmentBMPBenchmarkAndThreshold CreateNewBlank(TreatmentBMP treatmentBMP, TreatmentBMPTypeAssessmentObservationType treatmentBMPTypeAssessmentObservationType, TreatmentBMPType treatmentBMPType, TreatmentBMPAssessmentObservationType treatmentBMPAssessmentObservationType)
 {
     return(new TreatmentBMPBenchmarkAndThreshold(treatmentBMP, treatmentBMPTypeAssessmentObservationType, treatmentBMPType, treatmentBMPAssessmentObservationType, default(double), default(double)));
 }
Exemplo n.º 25
0
 /// <summary>
 /// Creates a "blank" object of this type and populates primitives with defaults
 /// </summary>
 public static TreatmentBMPImage CreateNewBlank(FileResource fileResource, TreatmentBMP treatmentBMP)
 {
     return(new TreatmentBMPImage(fileResource, treatmentBMP, default(DateTime)));
 }
 public ModeledPerformanceResultSimple(TreatmentBMP treatmentBMP) : this(new List <TreatmentBMP> {
     treatmentBMP
 })
 {
 }
Exemplo n.º 27
0
 public static string GetDeleteUrl(this TreatmentBMP treatmentBMP)
 {
     return(DeleteUrlTemplate.ParameterReplace(treatmentBMP.TreatmentBMPID));
 }
Exemplo n.º 28
0
 public static string GetDelineationStatus(this TreatmentBMP treatmentBMP)
 {
     return(treatmentBMP.Delineation != null ? treatmentBMP.Delineation.IsVerified ? "Verified" : "Provisional" : "None");
 }
Exemplo n.º 29
0
        public static bool IsFullyParameterized(this TreatmentBMP treatmentBMP)
        {
            if (!treatmentBMP.HasVerifiedDelineationForModelingPurposes(new List <int>()))
            {
                return(false);
            }

            if (treatmentBMP.TreatmentBMPType.TreatmentBMPModelingType == null)
            {
                return(false);
            }

            var bmpModelingType       = treatmentBMP.TreatmentBMPType.TreatmentBMPModelingType.ToEnum;
            var bmpModelingAttributes = treatmentBMP.TreatmentBMPModelingAttribute;

            if (bmpModelingAttributes != null)
            {
                if (bmpModelingType ==
                    TreatmentBMPModelingTypeEnum.BioinfiltrationBioretentionWithRaisedUnderdrain && (
                        !bmpModelingAttributes.RoutingConfigurationID.HasValue ||
                        (bmpModelingAttributes.RoutingConfigurationID == (int)RoutingConfigurationEnum.Offline &&
                         !bmpModelingAttributes.DiversionRate.HasValue) ||
                        !bmpModelingAttributes.TotalEffectiveBMPVolume.HasValue ||
                        !bmpModelingAttributes.StorageVolumeBelowLowestOutletElevation.HasValue ||
                        !bmpModelingAttributes.MediaBedFootprint.HasValue ||
                        !bmpModelingAttributes.DesignMediaFiltrationRate.HasValue))
                {
                    return(false);
                }
                else if ((bmpModelingType == TreatmentBMPModelingTypeEnum.BioretentionWithNoUnderdrain ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.InfiltrationBasin ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.InfiltrationTrench ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.PermeablePavement ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.UndergroundInfiltration) &&
                         (!bmpModelingAttributes.RoutingConfigurationID.HasValue ||
                          (bmpModelingAttributes.RoutingConfigurationID == (int)RoutingConfigurationEnum.Offline &&
                           !bmpModelingAttributes.DiversionRate.HasValue) ||
                          !bmpModelingAttributes.TotalEffectiveBMPVolume.HasValue ||
                          !bmpModelingAttributes.InfiltrationSurfaceArea.HasValue ||
                          !bmpModelingAttributes.UnderlyingInfiltrationRate.HasValue))
                {
                    return(false);
                }
                else if ((bmpModelingType ==
                          TreatmentBMPModelingTypeEnum.BioretentionWithUnderdrainAndImperviousLiner ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.SandFilters) &&
                         (!bmpModelingAttributes.RoutingConfigurationID.HasValue ||
                          (bmpModelingAttributes.RoutingConfigurationID == (int)RoutingConfigurationEnum.Offline &&
                           !bmpModelingAttributes.DiversionRate.HasValue) ||
                          !bmpModelingAttributes.TotalEffectiveBMPVolume.HasValue ||
                          !bmpModelingAttributes.MediaBedFootprint.HasValue ||
                          !bmpModelingAttributes.DesignMediaFiltrationRate.HasValue))
                {
                    return(false);
                }
                else if (bmpModelingType == TreatmentBMPModelingTypeEnum.CisternsForHarvestAndUse &&
                         (!bmpModelingAttributes.RoutingConfigurationID.HasValue ||
                          (bmpModelingAttributes.RoutingConfigurationID == (int)RoutingConfigurationEnum.Offline &&
                           !bmpModelingAttributes.DiversionRate.HasValue) ||
                          !bmpModelingAttributes.TotalEffectiveBMPVolume.HasValue ||
                          !bmpModelingAttributes.WinterHarvestedWaterDemand.HasValue ||
                          !bmpModelingAttributes.SummerHarvestedWaterDemand.HasValue))
                {
                    return(false);
                }
                else if ((bmpModelingType == TreatmentBMPModelingTypeEnum.ConstructedWetland ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.WetDetentionBasin) &&
                         (!bmpModelingAttributes.RoutingConfigurationID.HasValue ||
                          (bmpModelingAttributes.RoutingConfigurationID == (int)RoutingConfigurationEnum.Offline &&
                           !bmpModelingAttributes.DiversionRate.HasValue) ||
                          !bmpModelingAttributes.PermanentPoolorWetlandVolume.HasValue ||
                          !bmpModelingAttributes.DrawdownTimeforWQDetentionVolume.HasValue ||
                          !bmpModelingAttributes.WaterQualityDetentionVolume.HasValue ||
                          !bmpModelingAttributes.WinterHarvestedWaterDemand.HasValue ||
                          !bmpModelingAttributes.SummerHarvestedWaterDemand.HasValue))
                {
                    return(false);
                }
                else if ((bmpModelingType == TreatmentBMPModelingTypeEnum.DryExtendedDetentionBasin ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.FlowDurationControlBasin ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.FlowDurationControlTank) &&
                         (!bmpModelingAttributes.RoutingConfigurationID.HasValue ||
                          (bmpModelingAttributes.RoutingConfigurationID == (int)RoutingConfigurationEnum.Offline &&
                           !bmpModelingAttributes.DiversionRate.HasValue) ||
                          !bmpModelingAttributes.DrawdownTimeforWQDetentionVolume.HasValue ||
                          !bmpModelingAttributes.StorageVolumeBelowLowestOutletElevation.HasValue ||
                          !bmpModelingAttributes.EffectiveFootprint.HasValue))
                {
                    return(false);
                }
                else if (bmpModelingType == TreatmentBMPModelingTypeEnum.DryWeatherTreatmentSystems &&
                         (!bmpModelingAttributes.DesignDryWeatherTreatmentCapacity.HasValue &&
                          !bmpModelingAttributes.AverageTreatmentFlowrate.HasValue))
                {
                    return(false);
                }
                else if (bmpModelingType == TreatmentBMPModelingTypeEnum.Drywell &&
                         (!bmpModelingAttributes.RoutingConfigurationID.HasValue ||
                          (bmpModelingAttributes.RoutingConfigurationID == (int)RoutingConfigurationEnum.Offline &&
                           !bmpModelingAttributes.DiversionRate.HasValue) ||
                          !bmpModelingAttributes.TotalEffectiveDrywellBMPVolume.HasValue ||
                          !bmpModelingAttributes.InfiltrationDischargeRate.HasValue))
                {
                    return(false);
                }
                else if ((bmpModelingType == TreatmentBMPModelingTypeEnum.HydrodynamicSeparator ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.ProprietaryBiotreatment ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.ProprietaryTreatmentControl) &&
                         !bmpModelingAttributes.TreatmentRate.HasValue)
                {
                    return(false);
                }
                else if (bmpModelingType == TreatmentBMPModelingTypeEnum.LowFlowDiversions &&
                         (!bmpModelingAttributes.DesignLowFlowDiversionCapacity.HasValue &&
                          !bmpModelingAttributes.AverageDivertedFlowrate.HasValue))
                {
                    return(false);
                }
                else if ((bmpModelingType == TreatmentBMPModelingTypeEnum.VegetatedFilterStrip ||
                          bmpModelingType == TreatmentBMPModelingTypeEnum.VegetatedSwale) &&
                         (!bmpModelingAttributes.RoutingConfigurationID.HasValue ||
                          (bmpModelingAttributes.RoutingConfigurationID == (int)RoutingConfigurationEnum.Offline &&
                           !bmpModelingAttributes.DiversionRate.HasValue) ||
                          !bmpModelingAttributes.TreatmentRate.HasValue ||
                          !bmpModelingAttributes.WettedFootprint.HasValue ||
                          !bmpModelingAttributes.EffectiveRetentionDepth.HasValue))
                {
                    return(false);
                }
            }
            else
            {
                return(false);
            }

            return(true);
        }
Exemplo n.º 30
0
 public static RegionalSubbasin GetRegionalSubbasin(this TreatmentBMP treatmentBMP)
 {
     return(HttpRequestStorage.DatabaseEntities.RegionalSubbasins.SingleOrDefault(x =>
                                                                                  x.CatchmentGeometry.Contains(treatmentBMP.LocationPoint)));
 }