public EditModelingAttributesViewModel(TreatmentBMPModelingAttribute treatmentBMPModelingAttribute, int?treatmentBMPModelingTypeID)
 {
     TreatmentBMPModelingTypeID = treatmentBMPModelingTypeID;
     if (treatmentBMPModelingAttribute != null)
     {
         //UpstreamTreatmentBMPID = treatmentBMPModelingAttribute.UpstreamTreatmentBMPID;
         AverageDivertedFlowrate             = treatmentBMPModelingAttribute.AverageDivertedFlowrate;
         AverageTreatmentFlowrate            = treatmentBMPModelingAttribute.AverageTreatmentFlowrate;
         DesignDryWeatherTreatmentCapacity   = treatmentBMPModelingAttribute.DesignDryWeatherTreatmentCapacity;
         DesignLowFlowDiversionCapacity      = treatmentBMPModelingAttribute.DesignLowFlowDiversionCapacity;
         DesignMediaFiltrationRate           = treatmentBMPModelingAttribute.DesignMediaFiltrationRate;
         DesignResidenceTimeforPermanentPool = treatmentBMPModelingAttribute.DesignResidenceTimeforPermanentPool;
         DiversionRate = treatmentBMPModelingAttribute.DiversionRate;
         DrawdownTimeforWQDetentionVolume = treatmentBMPModelingAttribute.DrawdownTimeforWQDetentionVolume;
         EffectiveFootprint                      = treatmentBMPModelingAttribute.EffectiveFootprint;
         EffectiveRetentionDepth                 = treatmentBMPModelingAttribute.EffectiveRetentionDepth;
         InfiltrationDischargeRate               = treatmentBMPModelingAttribute.InfiltrationDischargeRate;
         InfiltrationSurfaceArea                 = treatmentBMPModelingAttribute.InfiltrationSurfaceArea;
         MediaBedFootprint                       = treatmentBMPModelingAttribute.MediaBedFootprint;
         PermanentPoolorWetlandVolume            = treatmentBMPModelingAttribute.PermanentPoolorWetlandVolume;
         RoutingConfigurationID                  = treatmentBMPModelingAttribute.RoutingConfigurationID;
         StorageVolumeBelowLowestOutletElevation = treatmentBMPModelingAttribute.StorageVolumeBelowLowestOutletElevation;
         SummerHarvestedWaterDemand              = treatmentBMPModelingAttribute.SummerHarvestedWaterDemand;
         TimeOfConcentrationID                   = treatmentBMPModelingAttribute.TimeOfConcentrationID;
         DrawdownTimeForDetentionVolume          = treatmentBMPModelingAttribute.DrawdownTimeForDetentionVolume;
         TotalEffectiveBMPVolume                 = treatmentBMPModelingAttribute.TotalEffectiveBMPVolume;
         TotalEffectiveDrywellBMPVolume          = treatmentBMPModelingAttribute.TotalEffectiveDrywellBMPVolume;
         TreatmentRate = treatmentBMPModelingAttribute.TreatmentRate;
         UnderlyingHydrologicSoilGroupID = treatmentBMPModelingAttribute.UnderlyingHydrologicSoilGroupID;
         UnderlyingInfiltrationRate      = treatmentBMPModelingAttribute.UnderlyingInfiltrationRate;
         WaterQualityDetentionVolume     = treatmentBMPModelingAttribute.WaterQualityDetentionVolume;
         WettedFootprint            = treatmentBMPModelingAttribute.WettedFootprint;
         WinterHarvestedWaterDemand = treatmentBMPModelingAttribute.WinterHarvestedWaterDemand;
         MonthsOfOperationID        = treatmentBMPModelingAttribute.MonthsOfOperationID;
         DryWeatherFlowOverrideID   = treatmentBMPModelingAttribute.DryWeatherFlowOverrideID;
     }
 }
 public void UpdateModel(TreatmentBMPModelingAttribute treatmentBMPModelingAttribute,
                         Person currentPerson)
 {
     //treatmentBMPModelingAttribute.UpstreamTreatmentBMPID = UpstreamTreatmentBMPID;
     treatmentBMPModelingAttribute.TotalEffectiveBMPVolume             = TotalEffectiveBMPVolume;
     treatmentBMPModelingAttribute.AverageDivertedFlowrate             = AverageDivertedFlowrate;
     treatmentBMPModelingAttribute.AverageTreatmentFlowrate            = AverageTreatmentFlowrate;
     treatmentBMPModelingAttribute.DesignDryWeatherTreatmentCapacity   = DesignDryWeatherTreatmentCapacity;
     treatmentBMPModelingAttribute.DesignLowFlowDiversionCapacity      = DesignLowFlowDiversionCapacity;
     treatmentBMPModelingAttribute.DesignMediaFiltrationRate           = DesignMediaFiltrationRate;
     treatmentBMPModelingAttribute.DesignResidenceTimeforPermanentPool = DesignResidenceTimeforPermanentPool;
     treatmentBMPModelingAttribute.DiversionRate = null;
     treatmentBMPModelingAttribute.DrawdownTimeforWQDetentionVolume = DrawdownTimeforWQDetentionVolume;
     treatmentBMPModelingAttribute.EffectiveFootprint                      = EffectiveFootprint;
     treatmentBMPModelingAttribute.EffectiveRetentionDepth                 = EffectiveRetentionDepth;
     treatmentBMPModelingAttribute.InfiltrationDischargeRate               = InfiltrationDischargeRate;
     treatmentBMPModelingAttribute.InfiltrationSurfaceArea                 = InfiltrationSurfaceArea;
     treatmentBMPModelingAttribute.MediaBedFootprint                       = MediaBedFootprint;
     treatmentBMPModelingAttribute.PermanentPoolorWetlandVolume            = PermanentPoolorWetlandVolume;
     treatmentBMPModelingAttribute.RoutingConfigurationID                  = (int)RoutingConfigurationEnum.Online;
     treatmentBMPModelingAttribute.StorageVolumeBelowLowestOutletElevation = StorageVolumeBelowLowestOutletElevation;
     treatmentBMPModelingAttribute.SummerHarvestedWaterDemand              = SummerHarvestedWaterDemand;
     //Because some TreatmentBMPTypes see this, but others don't, check for null and then default to 5 minutes
     treatmentBMPModelingAttribute.TimeOfConcentrationID          = TimeOfConcentrationID ?? (int)TimeOfConcentrationEnum.FiveMinutes;
     treatmentBMPModelingAttribute.DrawdownTimeForDetentionVolume = DrawdownTimeForDetentionVolume;
     treatmentBMPModelingAttribute.TotalEffectiveBMPVolume        = TotalEffectiveBMPVolume;
     treatmentBMPModelingAttribute.TotalEffectiveDrywellBMPVolume = TotalEffectiveDrywellBMPVolume;
     treatmentBMPModelingAttribute.TreatmentRate = TreatmentRate;
     treatmentBMPModelingAttribute.UnderlyingHydrologicSoilGroupID = UnderlyingHydrologicSoilGroupID;
     treatmentBMPModelingAttribute.UnderlyingInfiltrationRate      = UnderlyingInfiltrationRate;
     treatmentBMPModelingAttribute.WaterQualityDetentionVolume     = WaterQualityDetentionVolume;
     treatmentBMPModelingAttribute.WettedFootprint            = WettedFootprint;
     treatmentBMPModelingAttribute.WinterHarvestedWaterDemand = WinterHarvestedWaterDemand;
     treatmentBMPModelingAttribute.MonthsOfOperationID        = MonthsOfOperationID;
     treatmentBMPModelingAttribute.DryWeatherFlowOverrideID   = DryWeatherFlowOverrideID;
 }
        private static void SetModelingAttributeLookupValue <T>(int rowCount, List <string> currentErrorList, string value, PropertyInfo propertyToChange, TreatmentBMPModelingAttribute treatmentBMPModelingAttribute, string attribute, List <T> lookupValues, Func <T, string> funcDisplayName) where T : IHavePrimaryKey
        {
            var lookupValue = lookupValues.SingleOrDefault(x => funcDisplayName.Invoke(x) == value);

            if (lookupValue != null)
            {
                propertyToChange.SetValue(treatmentBMPModelingAttribute, lookupValue.PrimaryKey);
            }
            else
            {
                currentErrorList.Add($"{value} is not a valid {attribute} entry at row: {rowCount}. Acceptable values are:{string.Join(", ", lookupValues.Select(funcDisplayName.Invoke))}");
            }
        }