Beispiel #1
0
 public virtual void UpdateModels(Models.WaterQualityManagementPlan waterQualityManagementPlan)
 {
     waterQualityManagementPlan.TrashCaptureStatusTypeID             = TrashCaptureStatusTypeID.GetValueOrDefault(); // never null due to RequiredAttribute
     waterQualityManagementPlan.WaterQualityManagementPlanName       = WaterQualityManagementPlanName;
     waterQualityManagementPlan.WaterQualityManagementPlanPriorityID =
         WaterQualityManagementPlanPriorityID ?? ModelObjectHelpers.NotYetAssignedID;
     waterQualityManagementPlan.WaterQualityManagementPlanStatusID =
         WaterQualityManagementPlanStatusID ?? ModelObjectHelpers.NotYetAssignedID;
     waterQualityManagementPlan.WaterQualityManagementPlanDevelopmentTypeID =
         WaterQualityManagementPlanDevelopmentTypeID ?? ModelObjectHelpers.NotYetAssignedID;
     waterQualityManagementPlan.WaterQualityManagementPlanLandUseID =
         WaterQualityManagementPlanLandUseID ?? ModelObjectHelpers.NotYetAssignedID;
     waterQualityManagementPlan.ApprovalDate                           = ApprovalDate;
     waterQualityManagementPlan.MaintenanceContactName                 = MaintenanceContactName;
     waterQualityManagementPlan.MaintenanceContactOrganization         = MaintenanceContactOrganization;
     waterQualityManagementPlan.MaintenanceContactAddress1             = MaintenanceContactAddress1;
     waterQualityManagementPlan.MaintenanceContactAddress2             = MaintenanceContactAddress2;
     waterQualityManagementPlan.MaintenanceContactCity                 = MaintenanceContactCity;
     waterQualityManagementPlan.MaintenanceContactState                = MaintenanceContactState;
     waterQualityManagementPlan.MaintenanceContactZip                  = MaintenanceContactZip;
     waterQualityManagementPlan.MaintenanceContactPhone                = MaintenanceContactPhone;
     waterQualityManagementPlan.DateOfContruction                      = DateOfContruction;
     waterQualityManagementPlan.HydromodificationAppliesTypeID         = HydromodificationAppliesTypeID;
     waterQualityManagementPlan.WaterQualityManagementPlanPermitTermID = WaterQualityManagementPlanPermitTermID;
     waterQualityManagementPlan.HydrologicSubareaID                    = HydrologicSubareaID;
     waterQualityManagementPlan.RecordNumber                           = RecordNumber;
     waterQualityManagementPlan.RecordedWQMPAreaInAcres                = RecordedWQMPAreaInAcres;
     waterQualityManagementPlan.TrashCaptureEffectiveness              = TrashCaptureEffectiveness;
 }
Beispiel #2
0
        public void UpdateModel(Models.TreatmentBMP treatmentBMP, Person currentPerson)
        {
            treatmentBMP.TreatmentBMPName                    = TreatmentBMPName;
            treatmentBMP.Notes                               = Notes;
            treatmentBMP.RequiredFieldVisitsPerYear          = RequiredFieldVisitsPerYear;
            treatmentBMP.RequiredPostStormFieldVisitsPerYear = RequiredPostStormFieldVisitsPerYear;
            treatmentBMP.TrashCaptureStatusTypeID            = TrashCaptureStatusTypeID.GetValueOrDefault(); // will never be null due to RequiredAttribute
            treatmentBMP.SizingBasisTypeID                   = SizingBasisTypeID.GetValueOrDefault();        // will never be null due to RequiredAttribute

            if (!ModelObjectHelpers.IsRealPrimaryKeyValue(treatmentBMP.TreatmentBMPID))
            {
                treatmentBMP.StormwaterJurisdictionID = StormwaterJurisdictionID ?? ModelObjectHelpers.NotYetAssignedID;
                treatmentBMP.TreatmentBMPTypeID       = TreatmentBMPTypeID ?? ModelObjectHelpers.NotYetAssignedID;

                var treatmentBMPTypeAssessmentObservationTypes =
                    HttpRequestStorage.DatabaseEntities.TreatmentBMPTypes.Single(x =>
                                                                                 x.TreatmentBMPTypeID == TreatmentBMPTypeID).TreatmentBMPTypeAssessmentObservationTypes.Where(x =>
                                                                                                                                                                              x.TreatmentBMPAssessmentObservationType.GetHasBenchmarkAndThreshold() &&
                                                                                                                                                                              x.DefaultThresholdValue.HasValue && x.DefaultBenchmarkValue.HasValue);
                foreach (var a in treatmentBMPTypeAssessmentObservationTypes)
                {
                    treatmentBMP.TreatmentBMPBenchmarkAndThresholds.Add(new Models.TreatmentBMPBenchmarkAndThreshold(treatmentBMP,
                                                                                                                     a, HttpRequestStorage.DatabaseEntities.TreatmentBMPTypes.Single(x =>
                                                                                                                                                                                     x.TreatmentBMPTypeID == TreatmentBMPTypeID),
                                                                                                                     a.TreatmentBMPAssessmentObservationType,
                                                                                                                     a.DefaultBenchmarkValue ?? 0,
                                                                                                                     a.DefaultThresholdValue ?? 0));
                }
            }

            treatmentBMP.SystemOfRecordID = SystemOfRecordID;
            if (OwnerOrganizationID.HasValue)
            {
                treatmentBMP.OwnerOrganizationID = OwnerOrganizationID.Value;
            }
            else
            {
                var stormwaterJurisdiction =
                    HttpRequestStorage.DatabaseEntities.StormwaterJurisdictions.GetStormwaterJurisdiction(treatmentBMP
                                                                                                          .StormwaterJurisdictionID);
                treatmentBMP.OwnerOrganizationID = stormwaterJurisdiction.OrganizationID;
            }

            treatmentBMP.YearBuilt = YearBuilt;
            treatmentBMP.WaterQualityManagementPlanID = WaterQualityManagementPlanID;

            treatmentBMP.TreatmentBMPLifespanTypeID  = TreatmentBMPLifespanTypeID;
            treatmentBMP.TreatmentBMPLifespanEndDate = TreatmentBMPLifespanTypeID == TreatmentBMPLifespanType.FixedEndDate.TreatmentBMPLifespanTypeID ? TreatmentBMPLifespanEndDate : null;
            treatmentBMP.TrashCaptureEffectiveness   = TrashCaptureStatusTypeID == TrashCaptureStatusType.Partial.TrashCaptureStatusTypeID ? TrashCaptureEffectiveness : null;
        }