Exemplo n.º 1
0
 public EditViewModel(Models.WaterQualityManagementPlan waterQualityManagementPlan)
 {
     WaterQualityManagementPlanID                = waterQualityManagementPlan.WaterQualityManagementPlanID;
     WaterQualityManagementPlanName              = waterQualityManagementPlan.WaterQualityManagementPlanName;
     WaterQualityManagementPlanPriorityID        = waterQualityManagementPlan.WaterQualityManagementPlanPriorityID;
     WaterQualityManagementPlanStatusID          = waterQualityManagementPlan.WaterQualityManagementPlanStatusID;
     WaterQualityManagementPlanDevelopmentTypeID = waterQualityManagementPlan.WaterQualityManagementPlanDevelopmentTypeID;
     WaterQualityManagementPlanLandUseID         = waterQualityManagementPlan.WaterQualityManagementPlanLandUseID;
     ApprovalDate                           = waterQualityManagementPlan.ApprovalDate;
     MaintenanceContactName                 = waterQualityManagementPlan.MaintenanceContactName;
     MaintenanceContactOrganization         = waterQualityManagementPlan.MaintenanceContactOrganization;
     MaintenanceContactAddress1             = waterQualityManagementPlan.MaintenanceContactAddress1;
     MaintenanceContactAddress2             = waterQualityManagementPlan.MaintenanceContactAddress2;
     MaintenanceContactCity                 = waterQualityManagementPlan.MaintenanceContactCity;
     MaintenanceContactState                = waterQualityManagementPlan.MaintenanceContactState;
     MaintenanceContactZip                  = waterQualityManagementPlan.MaintenanceContactZip;
     MaintenanceContactPhone                = waterQualityManagementPlan.MaintenanceContactPhone;
     DateOfContruction                      = waterQualityManagementPlan.DateOfContruction;
     HydromodificationAppliesTypeID         = waterQualityManagementPlan.HydromodificationAppliesTypeID;
     WaterQualityManagementPlanPermitTermID = waterQualityManagementPlan.WaterQualityManagementPlanPermitTermID;
     HydrologicSubareaID                    = waterQualityManagementPlan.HydrologicSubareaID;
     RecordNumber                           = waterQualityManagementPlan.RecordNumber;
     RecordedWQMPAreaInAcres                = waterQualityManagementPlan.RecordedWQMPAreaInAcres;
     TrashCaptureStatusTypeID               = waterQualityManagementPlan.TrashCaptureStatusTypeID;
     TrashCaptureEffectiveness              = waterQualityManagementPlan.TrashCaptureEffectiveness;
 }
Exemplo n.º 2
0
        public NewWqmpVerifyViewData(Person currentPerson,
                                     Models.WaterQualityManagementPlan waterQualityManagementPlan,
                                     List <WaterQualityManagementPlanVerifyType> waterQualityManagementPlanVerifyTypes,
                                     List <WaterQualityManagementPlanVisitStatus> waterQualityManagementPlanVisitStatuses,
                                     List <WaterQualityManagementPlanVerifyStatus> waterQualityManagementPlanVerifyStatuses)
            : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            WaterQualityManagementPlan = waterQualityManagementPlan;
            PageTitle = "New Water Quality Management Plan O&M Verification";

            SubEntityName = WaterQualityManagementPlan.WaterQualityManagementPlanName;
            SubEntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Detail(waterQualityManagementPlan.WaterQualityManagementPlanID));

            EntityName = $"{FieldDefinitionType.WaterQualityManagementPlan.GetFieldDefinitionLabelPluralized()}";
            EntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Index());

            WaterQualityManagementPlanVerifyTypes    = waterQualityManagementPlanVerifyTypes;
            WaterQualityManagementPlanVisitStatuses  = waterQualityManagementPlanVisitStatuses;
            WaterQualityManagementPlanVerifyStatuses = waterQualityManagementPlanVerifyStatuses.OrderBy(x => x.WaterQualityManagementPlanVerifyStatusName)
                                                       .ToSelectListWithEmptyFirstRow(x => x.WaterQualityManagementPlanVerifyStatusID.ToString(), x => x.WaterQualityManagementPlanVerifyStatusName, "Status Not Set");

            WaterQualityManagementPlanUrl =
                SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c =>
                                                                                          c.Detail(waterQualityManagementPlan.WaterQualityManagementPlanID));
        }
Exemplo n.º 3
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;
 }
Exemplo n.º 4
0
        public void UpdateModels(Models.WaterQualityManagementPlan waterQualityManagementPlan)
        {
            waterQualityManagementPlan.TreatmentBMPs.ToList().ForEach(x => { x.WaterQualityManagementPlan = null; });
            TreatmentBmpIDs = TreatmentBmpIDs ?? new List <int>();


            HttpRequestStorage.DatabaseEntities.TreatmentBMPs.Where(x => TreatmentBmpIDs.Contains(x.TreatmentBMPID))
            .ToList()
            .ForEach(x => { x.WaterQualityManagementPlan = waterQualityManagementPlan; });
        }
Exemplo n.º 5
0
        public ModeledPerformanceViewData(Models.WaterQualityManagementPlan waterQualityManagementPlan, Person currentPerson) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            WaterQualityManagementPlan = waterQualityManagementPlan;
            InflowLabel = "Site Runoff";
            AboutModelingBMPPerformanceURL =
                SitkaRoute <HomeController> .BuildUrlFromExpression(x => x.AboutModelingBMPPerformance());

            ModelingResultsUrl =
                SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x =>
                                                                                          x.GetModelResults(waterQualityManagementPlan));
        }
Exemplo n.º 6
0
        //There are more errors to come I believe, that's why this is producing a list
        public List <HtmlString> CheckForParameterizationErrors(Models.WaterQualityManagementPlan waterQualityManagement)
        {
            var parameterizationErrors = new List <HtmlString>();

            if (!waterQualityManagement.TreatmentBMPs.Any() && !waterQualityManagement.QuickBMPs.Any())
            {
                parameterizationErrors.Add(new HtmlString("This WQMP is not associated with any inventoried Treatment BMPs and does not have any other treatment area assigned.No load reduction will be calculated for this WQMP."));
            }

            return(parameterizationErrors);
        }
        public void UpdateModels(Models.WaterQualityManagementPlan waterQualityManagementPlan, List <SourceControlBMPSimple> sourceControlBMPSimple)
        {
            var sourceControlBMPsInDatabase = HttpRequestStorage.DatabaseEntities.SourceControlBMPs.Local;
            var sourceControlBMPsToUpdate   = sourceControlBMPSimple?.Select(x => new SourceControlBMP(x, waterQualityManagementPlan.WaterQualityManagementPlanID)).ToList();

            waterQualityManagementPlan.SourceControlBMPs.ToList().Merge(sourceControlBMPsToUpdate, sourceControlBMPsInDatabase, (x, y) => x.SourceControlBMPID == y.SourceControlBMPID,
                                                                        (x, y) =>
            {
                x.IsPresent            = y.IsPresent;
                x.SourceControlBMPNote = y.SourceControlBMPNote;
            });
        }
        public EditSourceControlBMPsViewData(Person currentPerson, Models.WaterQualityManagementPlan waterQualityManagementPlan) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            EntityName = $"{FieldDefinitionType.WaterQualityManagementPlan.GetFieldDefinitionLabelPluralized()}";
            EntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Index());

            SubEntityName = waterQualityManagementPlan.WaterQualityManagementPlanName;
            SubEntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Detail(waterQualityManagementPlan.WaterQualityManagementPlanID));

            PageTitle = "Edit Source Control BMPs";

            WaterQualityManagementPlanDetailUrl = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Detail(waterQualityManagementPlan.WaterQualityManagementPlanID));
        }
Exemplo n.º 9
0
        public void UpdateModels(Models.WaterQualityManagementPlan waterQualityManagementPlan,
                                 WaterQualityManagementPlanVerify waterQualityManagementPlanVerify, List <WaterQualityManagementPlanVerifyQuickBMPSimple> waterQualityManagementPlanVerifyQuickBMPSimples, List <WaterQualityManagementPlanVerifyTreatmentBMPSimple> waterQualityManagementPlanVerifyTreatmentBMPSimples, Person currentPerson)
        {
            if (waterQualityManagementPlanVerify.FileResource == null && StructuralDocumentFile != null)
            {
                var fileResource = FileResource.CreateNewFromHttpPostedFile(StructuralDocumentFile, currentPerson);
                waterQualityManagementPlanVerify.FileResource = fileResource;
                HttpRequestStorage.DatabaseEntities.FileResources.Add(fileResource);
            }
            else if (StructuralDocumentFile != null)
            {
                HttpRequestStorage.DatabaseEntities.FileResources.DeleteFileResource(waterQualityManagementPlanVerify.FileResource);
                var fileResource = FileResource.CreateNewFromHttpPostedFile(StructuralDocumentFile, currentPerson);
                waterQualityManagementPlanVerify.FileResource = fileResource;
                HttpRequestStorage.DatabaseEntities.FileResources.Add(fileResource);
            }


            waterQualityManagementPlanVerify.WaterQualityManagementPlanVerifyID       = WaterQualityManagementPlanVerifyID ?? ModelObjectHelpers.NotYetAssignedID;
            waterQualityManagementPlanVerify.EnforcementOrFollowupActions             = EnforcementOrFollowupActions;
            waterQualityManagementPlanVerify.SourceControlCondition                   = SourceControlCondition;
            waterQualityManagementPlanVerify.WaterQualityManagementPlanVerifyStatusID = WaterQualityManagementPlanVerifyStatusID;
            waterQualityManagementPlanVerify.LastEditedByPerson = currentPerson;
            waterQualityManagementPlanVerify.LastEditedDate     = DateTime.Now;
            waterQualityManagementPlanVerify.VerificationDate   = VerificationDate;


            var allWaterQualityManagementPlanVerifyQuickBMPsInDatabase       = HttpRequestStorage.DatabaseEntities.WaterQualityManagementPlanVerifyQuickBMPs.Local;
            var waterQualityManagementPlanVerifyQuickBmpsForThisVerification = waterQualityManagementPlanVerify.WaterQualityManagementPlanVerifyQuickBMPs.ToList();
            var waterQualityManagementPlanVerifyQuickBMPsToUpdate            = waterQualityManagementPlanVerifyQuickBMPSimples?.Select(x => new WaterQualityManagementPlanVerifyQuickBMP(x, waterQualityManagementPlanVerify.WaterQualityManagementPlanVerifyID)).ToList() ?? new List <WaterQualityManagementPlanVerifyQuickBMP>();

            waterQualityManagementPlanVerifyQuickBmpsForThisVerification.Merge(waterQualityManagementPlanVerifyQuickBMPsToUpdate, allWaterQualityManagementPlanVerifyQuickBMPsInDatabase, (x, y) => x.WaterQualityManagementPlanVerifyQuickBMPID == y.WaterQualityManagementPlanVerifyQuickBMPID,
                                                                               (x, y) =>
            {
                x.IsAdequate = y.IsAdequate;
                x.WaterQualityManagementPlanVerifyQuickBMPNote = y.WaterQualityManagementPlanVerifyQuickBMPNote;
            });


            var allWaterQualityManagementPlanVerifyTreatmentBMPsInDatabase       = HttpRequestStorage.DatabaseEntities.WaterQualityManagementPlanVerifyTreatmentBMPs.Local;
            var waterQualityManagementPlanVerifyTreatmentBmpsForThisVerification = waterQualityManagementPlanVerify.WaterQualityManagementPlanVerifyTreatmentBMPs.ToList();
            var waterQualityManagementPlanVerifyTreatmentBMPsToUpdate            = waterQualityManagementPlanVerifyTreatmentBMPSimples?.Select(x => new WaterQualityManagementPlanVerifyTreatmentBMP(x, waterQualityManagementPlanVerify.WaterQualityManagementPlanVerifyID)).ToList() ?? new List <WaterQualityManagementPlanVerifyTreatmentBMP>();


            waterQualityManagementPlanVerifyTreatmentBmpsForThisVerification.Merge(waterQualityManagementPlanVerifyTreatmentBMPsToUpdate, allWaterQualityManagementPlanVerifyTreatmentBMPsInDatabase, (x, y) => x.WaterQualityManagementPlanVerifyTreatmentBMPID == y.WaterQualityManagementPlanVerifyTreatmentBMPID,
                                                                                   (x, y) =>
            {
                x.IsAdequate = y.IsAdequate;
                x.WaterQualityManagementPlanVerifyTreatmentBMPNote = y.WaterQualityManagementPlanVerifyTreatmentBMPNote;
            });
        }
Exemplo n.º 10
0
        public void UpdateModels(Models.WaterQualityManagementPlan waterQualityManagementPlan)
        {
            var newWaterQualityManagementPlanParcels = ParcelIDs?.Select(x => new WaterQualityManagementPlanParcel(waterQualityManagementPlan.WaterQualityManagementPlanID, x)).ToList() ?? new List <WaterQualityManagementPlanParcel>();

            waterQualityManagementPlan.WaterQualityManagementPlanParcels.Merge(
                newWaterQualityManagementPlanParcels,
                HttpRequestStorage.DatabaseEntities.WaterQualityManagementPlanParcels.Local,
                (x, y) => x.WaterQualityManagementPlanParcelID == y.WaterQualityManagementPlanParcelID);

            // update the cached total boundary
            waterQualityManagementPlan.WaterQualityManagementPlanBoundary = (ParcelIDs != null ? HttpRequestStorage.DatabaseEntities.Parcels
                                                                             .Where(x => ParcelIDs.Contains(x.ParcelID)).Select(x => x.ParcelGeometry).ToList() : new List <DbGeometry>())
                                                                            .UnionListGeometries().FixSrid(CoordinateSystemHelper.NAD_83_HARN_CA_ZONE_VI_SRID);
        }
        public EditSourceControlBMPsViewModel(Models.WaterQualityManagementPlan waterQualityManagementPlan, List <SourceControlBMPAttribute> sourceControlBMPAttributes)
        {
            SourceControlBMPSimples = waterQualityManagementPlan.SourceControlBMPs.Select(x => new SourceControlBMPSimple(x)).ToList();

            if (!SourceControlBMPSimples.Any())
            {
                foreach (var sourceControlBMPAttribute in sourceControlBMPAttributes)
                {
                    SourceControlBMPSimples.Add(new SourceControlBMPSimple(sourceControlBMPAttribute));
                }
            }

            SourceControlBMPSimples = SourceControlBMPSimples.OrderBy(x => x.SourceControlBMPAttributeID).ToList();
        }
Exemplo n.º 12
0
        public NewWqmpVerifyViewModel(Models.WaterQualityManagementPlan waterQualityManagementPlan, WaterQualityManagementPlanVerify waterQualityManagementPlanVerify, List <QuickBMP> quickBMPs, List <Models.TreatmentBMP> treatmentBMPs)
        {
            WaterQualityManagementPlanID             = waterQualityManagementPlan.WaterQualityManagementPlanID;
            WaterQualityManagementPlanVerifyID       = waterQualityManagementPlanVerify.WaterQualityManagementPlanVerifyID;
            WaterQualityManagementPlanVerifyTypeID   = waterQualityManagementPlanVerify.WaterQualityManagementPlanVerifyTypeID;
            WaterQualityManagementPlanVisitStatusID  = waterQualityManagementPlanVerify.WaterQualityManagementPlanVisitStatusID;
            WaterQualityManagementPlanVerifyStatusID = waterQualityManagementPlanVerify.WaterQualityManagementPlanVerifyStatusID;
            VerificationDate             = waterQualityManagementPlanVerify.VerificationDate;
            EnforcementOrFollowupActions = waterQualityManagementPlanVerify.EnforcementOrFollowupActions;
            SourceControlCondition       = waterQualityManagementPlanVerify.SourceControlCondition;

            WaterQualityManagementPlanVerifyQuickBMPSimples     = quickBMPs?.Select(x => new WaterQualityManagementPlanVerifyQuickBMPSimple(x)).OrderBy(x => x.QuickBMPName).ToList();
            WaterQualityManagementPlanVerifyTreatmentBMPSimples = treatmentBMPs?.Select(x => new WaterQualityManagementPlanVerifyTreatmentBMPSimple(x)).OrderBy(x => x.TreatmentBMPName).ToList();
        }
Exemplo n.º 13
0
        public void UpdateModel(Models.WaterQualityManagementPlan waterQualityManagementPlan, Person currentPerson)
        {
            var fileResource = FileResource.CreateNewFromHttpPostedFile(File, currentPerson);

            HttpRequestStorage.DatabaseEntities.FileResources.Add(fileResource);
            var waterQualityManagementPlanDocumentType = WaterQualityManagementPlanDocumentType.AllLookupDictionary[WaterQualityManagementPlanDocumentTypeID.GetValueOrDefault()]; // will never default due to RequiredAttribute
            var waterQualityManagementPlanDocument     =
                new Models.WaterQualityManagementPlanDocument(waterQualityManagementPlan, fileResource, DisplayName,
                                                              DateTime.Now, waterQualityManagementPlanDocumentType)
            {
                Description = Description
            };

            HttpRequestStorage.DatabaseEntities.WaterQualityManagementPlanDocuments.Add(waterQualityManagementPlanDocument);
        }
Exemplo n.º 14
0
        public EditWqmpVerifyViewData(Person currentPerson,
                                      Models.WaterQualityManagementPlan waterQualityManagementPlan,
                                      List <WaterQualityManagementPlanVerifyType> waterQualityManagementPlanVerifyTypes,
                                      List <WaterQualityManagementPlanVisitStatus> waterQualityManagementPlanVisitStatuses,
                                      List <WaterQualityManagementPlanVerifyStatus> waterQualityManagementPlanVerifyStatuses)
            : base(currentPerson, waterQualityManagementPlan, waterQualityManagementPlanVerifyTypes, waterQualityManagementPlanVisitStatuses, waterQualityManagementPlanVerifyStatuses)
        {
            PageTitle = "Edit Water Quality Management Plan O&M Verification";

            SubEntityName = WaterQualityManagementPlan.WaterQualityManagementPlanName;
            SubEntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Detail(waterQualityManagementPlan.WaterQualityManagementPlanID));

            EntityName = $"{FieldDefinitionType.WaterQualityManagementPlan.GetFieldDefinitionLabelPluralized()}";
            EntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Index());
        }
Exemplo n.º 15
0
        public EditWqmpParcelsViewData(Person currentPerson,
                                       Models.WaterQualityManagementPlan waterQualityManagementPlan,
                                       MapInitJson mapInitJson)
            : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            WaterQualityManagementPlan = waterQualityManagementPlan;
            EntityName = $"{FieldDefinitionType.WaterQualityManagementPlan.GetFieldDefinitionLabelPluralized()}";
            EntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(c => c.Index());

            SubEntityName           = waterQualityManagementPlan.WaterQualityManagementPlanName;
            SubEntityUrl            = waterQualityManagementPlan.GetDetailUrl();
            PageTitle               = "Edit Associated Parcels";
            RecordedWQMPAreaInAcres = waterQualityManagementPlan.RecordedWQMPAreaInAcres;
            ViewDataForAngular      = new EditWqmpParcelsViewDataForAngular(mapInitJson,
                                                                            waterQualityManagementPlan.WaterQualityManagementPlanParcels.Select(x => x.Parcel).ToList());
        }
Exemplo n.º 16
0
        public void UpdateModels(Models.WaterQualityManagementPlan waterQualityManagementPlan, List <QuickBMPSimple> quickBMPSimples)
        {
            var quickBMPsInDatabase = HttpRequestStorage.DatabaseEntities.QuickBMPs.Local;
            var quickBMPsToUpdate   = quickBMPSimples != null?quickBMPSimples.Select(x => new QuickBMP(x, waterQualityManagementPlan.WaterQualityManagementPlanID)).ToList() : new List <QuickBMP>();

            waterQualityManagementPlan.QuickBMPs.ToList().Merge(quickBMPsToUpdate, quickBMPsInDatabase,
                                                                (x, y) => x.WaterQualityManagementPlanID == y.WaterQualityManagementPlanID &&
                                                                x.QuickBMPID == y.QuickBMPID, (x, y) =>
            {
                x.QuickBMPName             = y.QuickBMPName;
                x.QuickBMPNote             = y.QuickBMPNote;
                x.DryWeatherFlowOverrideID = y.DryWeatherFlowOverrideID;
                x.TreatmentBMPTypeID       = y.TreatmentBMPTypeID;
                x.PercentOfSiteTreated     = y.PercentOfSiteTreated;
                x.PercentCaptured          = y.PercentCaptured;
                x.PercentRetained          = y.PercentRetained;
            });
        }
Exemplo n.º 17
0
        public EditSimplifiedStructuralBMPsViewData(Person currentPerson,
                                                    Models.WaterQualityManagementPlan waterQualityManagementPlan,
                                                    IEnumerable <TreatmentBMPTypeSimple> treatmentBMPTypes, List <DryWeatherFlowOverride> dryWeatherFlowOverrides,
                                                    int dryWeatherFlowOverrideDefaultID,
                                                    int dryWeatherFlowOverrideYesID) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            EntityName = $"{FieldDefinitionType.WaterQualityManagementPlan.GetFieldDefinitionLabelPluralized()}";
            EntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Index());

            SubEntityName = waterQualityManagementPlan.WaterQualityManagementPlanName;
            SubEntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Detail(waterQualityManagementPlan.WaterQualityManagementPlanID));

            PageTitle = "Edit Simplified Structural BMPs";
            FieldDefinitionForPercentOfSiteTreated   = FieldDefinitionType.PercentOfSiteTreated;
            FieldDefinitionForPercentCaptured        = FieldDefinitionType.PercentCaptured;
            FieldDefinitionForPercentRetained        = FieldDefinitionType.PercentRetained;
            FieldDefinitionForDryWeatherFlowOverride = FieldDefinitionType.DryWeatherFlowOverride;

            ViewDataForAngular = new EditWaterQualityManagementPlanTreatmentBmpsViewDataForAngular(treatmentBMPTypes, dryWeatherFlowOverrides, dryWeatherFlowOverrideDefaultID, dryWeatherFlowOverrideYesID);

            WaterQualityManagementPlanDetailUrl = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Detail(waterQualityManagementPlan.WaterQualityManagementPlanID));
        }
Exemplo n.º 18
0
        public EditWqmpBmpsViewData(Person currentPerson, Models.WaterQualityManagementPlan waterQualityManagementPlan) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            EntityName = $"{FieldDefinitionType.WaterQualityManagementPlan.GetFieldDefinitionLabelPluralized()}";
            EntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Index());

            SubEntityName = waterQualityManagementPlan.WaterQualityManagementPlanName;
            SubEntityUrl  = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Detail(waterQualityManagementPlan.WaterQualityManagementPlanID));

            PageTitle = "Edit Inventoried BMPs";

            var treatmentBMPSimples = waterQualityManagementPlan.StormwaterJurisdiction.TreatmentBMPs
                                      .Where(x => x.WaterQualityManagementPlanID == null ||
                                             x.WaterQualityManagementPlanID == waterQualityManagementPlan.WaterQualityManagementPlanID)
                                      .Select(x => new TreatmentBMPSimple(x))
                                      .OrderBy(x => x.DisplayName)
                                      .ToList();

            ViewDataForAngular = new EditWaterQualityManagementPlanTreatmentBmpsViewDataForAngular(treatmentBMPSimples);

            WaterQualityManagementPlanDetailUrl = SitkaRoute <WaterQualityManagementPlanController> .BuildUrlFromExpression(x => x.Detail(waterQualityManagementPlan.WaterQualityManagementPlanID));

            NewTreatmentBMPUrl = SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x => x.New());
        }
Exemplo n.º 19
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;
            }
        }
Exemplo n.º 20
0
 public EditWqmpBmpsViewModel(Models.WaterQualityManagementPlan waterQualityManagementPlan)
 {
     TreatmentBmpIDs = waterQualityManagementPlan.TreatmentBMPs.Select(x => x.TreatmentBMPID).ToList();
 }
Exemplo n.º 21
0
 public EditSimplifiedStructuralBMPsViewModel(Models.WaterQualityManagementPlan waterQualityManagementPlan)
 {
     QuickBmpSimples = waterQualityManagementPlan.QuickBMPs.Select(x => new QuickBMPSimple(x)).ToList();
 }
 public EditModelingApproachViewModel(Models.WaterQualityManagementPlan waterQualityManagementPlan)
 {
     WaterQualityManagementPlanModelingApproachID = waterQualityManagementPlan.WaterQualityManagementPlanModelingApproachID;
 }
 public void UpdateModel(Models.WaterQualityManagementPlan waterQualityManagementPlan)
 {
     waterQualityManagementPlan.WaterQualityManagementPlanModelingApproachID =
         WaterQualityManagementPlanModelingApproachID;
 }
Exemplo n.º 24
0
 public override void UpdateModels(Models.WaterQualityManagementPlan waterQualityManagementPlan)
 {
     waterQualityManagementPlan.StormwaterJurisdictionID =
         StormwaterJurisdictionID ?? ModelObjectHelpers.NotYetAssignedID;
     base.UpdateModels(waterQualityManagementPlan);
 }
Exemplo n.º 25
0
 public NewViewModel(Models.WaterQualityManagementPlan waterQualityManagementPlan) : base(waterQualityManagementPlan)
 {
     StormwaterJurisdictionID = waterQualityManagementPlan.StormwaterJurisdictionID;
 }
Exemplo n.º 26
0
 public NewViewModel(Models.WaterQualityManagementPlan waterQualityManagementPlan)
 {
     WaterQualityManagementPlanID = waterQualityManagementPlan.WaterQualityManagementPlanID;
 }
Exemplo n.º 27
0
 public void UpdateModels(Models.WaterQualityManagementPlan waterQualityManagementPlan, WaterQualityManagementPlanVerify waterQualityManagementPlanVerify, bool deleteStructuralDocumentFile, List <WaterQualityManagementPlanVerifyQuickBMPSimple> waterQualityManagementPlanVerifyQuickBMPSimples, List <WaterQualityManagementPlanVerifyTreatmentBMPSimple> waterQualityManagementPlanVerifyTreatmentBMPSimples, Person currentPerson)
 {
     base.UpdateModels(waterQualityManagementPlan,
                       waterQualityManagementPlanVerify, waterQualityManagementPlanVerifyQuickBMPSimples, waterQualityManagementPlanVerifyTreatmentBMPSimples, currentPerson);
 }
Exemplo n.º 28
0
 public EditWqmpParcelsViewModel(Models.WaterQualityManagementPlan waterQualityManagementPlan)
 {
     ParcelIDs = waterQualityManagementPlan.WaterQualityManagementPlanParcels.Select(x => x.ParcelID).ToList();
 }