Example #1
0
 public ProposalsGridSpec(FirmaSession firmaSession)
 {
     Add(string.Empty, x =>
     {
         var userHasDeletePermission = new ProjectDeleteProposalFeature().HasPermission(firmaSession, x).HasPermission;
         return(DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteProposalUrl(),
                                                                     userHasDeletePermission, true));
     }, 30, DhtmlxGridColumnFilterType.None);
     Add(string.Empty,
         x => DhtmlxGridHtmlHelpers.MakeEditIconAsHyperlinkBootstrap(x.GetProjectCreateUrl(),
                                                                     new ProjectCreateFeature().HasPermission(firmaSession, x).HasPermission&&
                                                                     !(x.ProjectApprovalStatus == ProjectApprovalStatus.PendingApproval &&
                                                                       firmaSession.Role == ProjectFirmaModels.Models.Role.Normal)), 30,
         DhtmlxGridColumnFilterType.None);
     Add(FieldDefinitionEnum.ProjectName.ToType().ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 300, DhtmlxGridColumnFilterType.Html);
     Add("Submittal Status", a => a.ProjectApprovalStatus.ProjectApprovalStatusDisplayName, 110, DhtmlxGridColumnFilterType.SelectFilterStrict);
     if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship())
     {
         Add(FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().ToGridHeaderString(), x => x.GetCanStewardProjectsOrganization().GetShortNameAsUrl(), 150,
             DhtmlxGridColumnFilterType.Html);
     }
     Add(FieldDefinitionEnum.IsPrimaryContactOrganization.ToType().ToGridHeaderString(), x => x.GetPrimaryContactOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html);
     Add(FieldDefinitionEnum.TaxonomyLeaf.ToType().ToGridHeaderString(), x => x.GetTaxonomyLeaf() == null ? string.Empty : x.GetTaxonomyLeaf().GetDisplayName(), 300, DhtmlxGridColumnFilterType.Html);
     Add(FieldDefinitionEnum.PlanningDesignStartYear.ToType().ToGridHeaderString(), x => x.GetPlanningDesignStartYear(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionEnum.ImplementationStartYear.ToType().ToGridHeaderString(), x => x.GetImplementationStartYear(), 115, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionEnum.CompletionYear.ToType().ToGridHeaderString(), x => x.GetCompletionYear(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionEnum.EstimatedTotalCost.ToType().ToGridHeaderString(), x => x.GetEstimatedTotalRegardlessOfFundingType(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
     Add(FieldDefinitionEnum.ProjectedFunding.ToType().ToGridHeaderString(), x => x.GetProjectedFunding(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
     Add(FieldDefinitionEnum.NoFundingSourceIdentified.ToType().ToGridHeaderString(), x => x.GetNoFundingSourceIdentifiedAmount(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
     Add("Proposed By", a => a.ProposingPerson.GetFullNameFirstLastAndOrgShortNameAsUrl(firmaSession), 200);
     Add("Proposed Date", a => a.ProposingDate, 120);
     Add("Submitted Date", a => a.SubmissionDate, 120);
     Add("Last Updated", a => a.LastUpdatedDate, 120);
     Add(FieldDefinitionEnum.ProjectDescription.ToType().ToGridHeaderString(), x => x.ProjectDescription, 300);
 }
        public ProposalsGridSpec(Person currentPerson)
        {
            Add(string.Empty, x =>
            {
                var userHasDeletePermission = new ProjectDeleteProposalFeature().HasPermission(currentPerson, x).HasPermission;
                return(DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteProposalUrl(),
                                                                            userHasDeletePermission, true, true));
            }, 30, DhtmlxGridColumnFilterType.None);
            Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsHyperlinkBootstrap(x.GetProjectCreateUrl(), new ProjectCreateFeature().HasPermission(currentPerson, x).HasPermission), 30, DhtmlxGridColumnFilterType.None);

            Add(Models.FieldDefinition.FhtProjectNumber.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.FhtProjectNumber), 100, DhtmlxGridColumnFilterType.Text);
            Add(Models.FieldDefinition.ProjectName.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 300, DhtmlxGridColumnFilterType.Html);
            Add("Submittal Status", a => a.ProjectApprovalStatus.ProjectApprovalStatusDisplayName, 110, DhtmlxGridColumnFilterType.SelectFilterStrict);
            if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship())
            {
                Add(Models.FieldDefinition.ProjectsStewardOrganizationRelationshipToProject.ToGridHeaderString(), x => x.GetCanStewardProjectsOrganization().GetShortNameAsUrl(), 150,
                    DhtmlxGridColumnFilterType.Html);
            }
            Add(Models.FieldDefinition.PrimaryContactOrganization.ToGridHeaderString(), x => x.GetPrimaryContactOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html);
            Add(Models.FieldDefinition.ProjectType.ToGridHeaderString(), x => x.ProjectType == null ? string.Empty : x.ProjectType.DisplayName, 300, DhtmlxGridColumnFilterType.Html);
            Add(Models.FieldDefinition.ProjectInitiationDate.ToGridHeaderString(), x => x.GetPlannedDate(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.ExpirationDate.ToGridHeaderString(), x => x.GetExpirationDateFormatted(), 115, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.CompletionDate.ToGridHeaderString(), x => x.GetCompletionDateFormatted(), 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(Models.FieldDefinition.EstimatedTotalCost.ToGridHeaderString(), x => x.EstimatedTotalCost, 100, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add(Models.FieldDefinition.ProjectGrantAllocationRequestTotalAmount.ToGridHeaderString(), x => x.GetTotalFunding(), 100, DhtmlxGridColumnFormatType.CurrencyWithCents, DhtmlxGridColumnAggregationType.Total);
            Add("Proposed By", a => a.ProposingPerson.GetFullNameFirstLastAndOrgShortNameAsUrl(), 200);
            Add("Proposed Date", a => a.ProposingDate, 120);
            Add("Submitted Date", a => a.SubmissionDate, 120);
            Add("Last Updated", a => a.LastUpdateDate, 120);
            Add(Models.FieldDefinition.ProjectDescription.ToGridHeaderString(), x => x.ProjectDescription, 300);
        }
Example #3
0
 public PendingGridSpec(FirmaSession currentFirmaSession)
 {
     // todo: fulfill "Include standard project grid with columns for “Stage” and “Approval Status”
     Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteProposalUrl(), new ProjectDeleteProposalFeature().HasPermission(currentFirmaSession, x).HasPermission, true), 30, DhtmlxGridColumnFilterType.None);
     Add(string.Empty,
         x => DhtmlxGridHtmlHelpers.MakeEditIconAsHyperlinkBootstrap(x.GetProjectCreateUrl(),
                                                                     new ProjectCreateFeature().HasPermission(currentFirmaSession, x).HasPermission&&
                                                                     !(x.ProjectApprovalStatus == ProjectApprovalStatus.PendingApproval &&
                                                                       currentFirmaSession.Role == ProjectFirmaModels.Models.Role.Normal)), 30,
         DhtmlxGridColumnFilterType.None);
     Add(FieldDefinitionEnum.ProjectName.ToType().ToGridHeaderString(), x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), x.ProjectName), 300, DhtmlxGridColumnFilterType.Html);
     Add("Submittal Status", a => a.ProjectApprovalStatus.ProjectApprovalStatusDisplayName, 110, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionEnum.ProjectStage.ToType().ToGridHeaderString(), x => x.ProjectStage.ProjectStageDisplayName, 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
     if (MultiTenantHelpers.HasCanStewardProjectsOrganizationRelationship())
     {
         Add(FieldDefinitionEnum.ProjectsStewardOrganizationRelationshipToProject.ToType().ToGridHeaderString(), x => x.GetCanStewardProjectsOrganization().GetShortNameAsUrl(), 150,
             DhtmlxGridColumnFilterType.Html);
     }
     Add(FieldDefinitionEnum.IsPrimaryContactOrganization.ToType().ToGridHeaderString(), x => x.GetPrimaryContactOrganization().GetShortNameAsUrl(), 150, DhtmlxGridColumnFilterType.Html);
     Add(FieldDefinitionEnum.TaxonomyLeaf.ToType().ToGridHeaderString(), x => x.TaxonomyLeaf == null ? string.Empty : x.TaxonomyLeaf.GetDisplayName(), 300, DhtmlxGridColumnFilterType.Html);
     Add(FieldDefinitionEnum.PlanningDesignStartYear.ToType().ToGridHeaderString(), x => ProjectModelExtensions.GetPlanningDesignStartYear(x), 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionEnum.ImplementationStartYear.ToType().ToGridHeaderString(), x => ProjectModelExtensions.GetImplementationStartYear(x), 115, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionEnum.CompletionYear.ToType().ToGridHeaderString(), x => ProjectModelExtensions.GetCompletionYear(x), 90, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionEnum.EstimatedTotalCost.ToType().ToGridHeaderString(), x => x.GetEstimatedTotalRegardlessOfFundingType(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
     Add(FieldDefinitionEnum.SecuredFunding.ToType().ToGridHeaderString(), x => x.GetSecuredFunding(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
     Add(FieldDefinitionEnum.TargetedFunding.ToType().ToGridHeaderString(), x => x.GetTargetedFunding(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
     Add(FieldDefinitionEnum.NoFundingSourceIdentified.ToType().ToGridHeaderString(), x => x.GetNoFundingSourceIdentifiedAmount(), 100, DhtmlxGridColumnFormatType.Currency, DhtmlxGridColumnAggregationType.Total);
     Add("Submitted By", a => a.SubmittedByPerson != null ? a.SubmittedByPerson.GetFullNameFirstLastAndOrgShortNameAsUrl(currentFirmaSession) : new HtmlString(null), 200);
     Add("Submitted Date", a => a.SubmissionDate, 120);
     Add("Last Updated", a => a.LastUpdatedDate, 120);
     Add(FieldDefinitionEnum.ProjectDescription.ToType().ToGridHeaderString(), x => x.ProjectDescription, 300);
 }
 public TreatmentBMPTypeGridSpec(Person currentPerson)
 {
     Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), new NeptuneAdminFeature().HasPermissionByPerson(currentPerson)), 30, DhtmlxGridColumnFilterType.None);
     Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsHyperlinkBootstrap(x.GetEditUrl(), new NeptuneAdminFeature().HasPermissionByPerson(currentPerson)), 30, DhtmlxGridColumnFilterType.None);
     Add(FieldDefinitionType.TreatmentBMPType.ToGridHeaderString(), a => UrlTemplate.MakeHrefString(a.GetDetailUrl(), a.TreatmentBMPTypeName), 400, DhtmlxGridColumnFilterType.Html);
     Add($"Number of {FieldDefinitionType.TreatmentBMPAssessmentObservationType.ToGridHeaderStringPlural("Observation Types")}", a => a.TreatmentBMPTypeAssessmentObservationTypes.Select(x => x.TreatmentBMPAssessmentObservationType).Count(), 100);
     Add($"Number of {FieldDefinitionType.TreatmentBMP.ToGridHeaderStringPlural("Treatment BMPs")}", a => a.TreatmentBMPs.Count, 100, DhtmlxGridColumnAggregationType.Total);
 }
Example #5
0
 public TreatmentBMPAssessmentObservationTypeGridSpec(Person currentPerson)
 {
     Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), new NeptuneAdminFeature().HasPermissionByPerson(currentPerson), true), 30, DhtmlxGridColumnFilterType.None);
     Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsHyperlinkBootstrap(x.GetEditUrl(), new NeptuneAdminFeature().HasPermissionByPerson(currentPerson)), 30, DhtmlxGridColumnFilterType.None);
     Add(FieldDefinitionType.TreatmentBMPAssessmentObservationType.ToGridHeaderString(), a => UrlTemplate.MakeHrefString(a.GetDetailUrl(), a.TreatmentBMPAssessmentObservationTypeName), 200, DhtmlxGridColumnFilterType.Html);
     Add(FieldDefinitionType.ObservationCollectionMethod.ToGridHeaderString(), a => a.ObservationTypeSpecification.ObservationTypeCollectionMethod.ObservationTypeCollectionMethodDisplayName, 200, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionType.ObservationTargetType.ToGridHeaderString(), a => a.ObservationTypeSpecification.ObservationTargetType.ObservationTargetTypeDisplayName, 200, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionType.ObservationThresholdType.ToGridHeaderString(), a => a.ObservationTypeSpecification.ObservationThresholdType.ObservationThresholdTypeDisplayName, 200, DhtmlxGridColumnFilterType.SelectFilterStrict);
 }
 public CustomAttributeTypeGridSpec()
 {
     Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), true), 30, DhtmlxGridColumnFilterType.None);
     Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsHyperlinkBootstrap(x.GetEditUrl(), true), 30, DhtmlxGridColumnFilterType.None);
     Add(FieldDefinitionType.CustomAttributeType.ToGridHeaderString(), a => UrlTemplate.MakeHrefString(a.GetDetailUrl(), a.CustomAttributeTypeName), 200, DhtmlxGridColumnFilterType.Html);
     Add(FieldDefinitionType.CustomAttributeDataType.ToGridHeaderString(), a => a.CustomAttributeDataType.CustomAttributeDataTypeDisplayName, 100, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionType.MeasurementUnit.ToGridHeaderString(), a => a.GetMeasurementUnitDisplayName(), 100, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionType.AttributeTypePurpose.ToGridHeaderString(),
         a => a.CustomAttributeTypePurpose.CustomAttributeTypePurposeDisplayName, 200,
         DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add("Required?", a => a.IsRequired.ToYesNo(), 100, DhtmlxGridColumnFilterType.SelectFilterStrict);
 }
        public static HtmlString GetEditUrlForGrid(this OnlandVisualTrashAssessment onlandVisualTrashAssessment, Person currentPerson)
        {
            var userCanEdit = new OnlandVisualTrashAssessmentEditStatusFeature()
                              .HasPermission(currentPerson, onlandVisualTrashAssessment)
                              .HasPermission;

            if (!userCanEdit)
            {
                return(new HtmlString(Empty));
            }

            return(onlandVisualTrashAssessment.OnlandVisualTrashAssessmentStatus ==
                   OnlandVisualTrashAssessmentStatus.Complete
                ? ModalDialogFormHelper.ModalDialogFormLink("Return to Edit", GetEditStatusToAllowEditUrl(onlandVisualTrashAssessment),
                                                            $"Return to Edit On-land Visual Trash Assessment for {onlandVisualTrashAssessment.OnlandVisualTrashAssessmentArea.OnlandVisualTrashAssessmentAreaName}",
                                                            500, "Continue", "Cancel", new List <string> {
                "gridButton"
            },
                                                            null, null) : DhtmlxGridHtmlHelpers.MakeEditIconAsHyperlinkBootstrap(GetEditUrl(onlandVisualTrashAssessment)));
        }
        public TreatmentBMPGridSpec(Person currentPerson, bool showDelete, bool showEdit)
        {
            if (showDelete)
            {
                Add(string.Empty, x =>
                {
                    var userHasDeletePermission = currentPerson.IsManagerOrAdmin() && currentPerson.IsAssignedToStormwaterJurisdiction(x.StormwaterJurisdictionID);
                    return(DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(TreatmentBMPModelExtensions.DeleteUrlTemplate.ParameterReplace(x.TreatmentBMPID),
                                                                                userHasDeletePermission, userHasDeletePermission));
                }, 30, DhtmlxGridColumnFilterType.None);
            }
            if (showEdit)
            {
                Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeEditIconAsHyperlinkBootstrap(TreatmentBMPModelExtensions.EditUrlTemplate.ParameterReplace(x.TreatmentBMPID), currentPerson.IsAssignedToStormwaterJurisdiction(x.StormwaterJurisdictionID)), 30, DhtmlxGridColumnFilterType.None);
            }

            Add(string.Empty, x => UrlTemplate.MakeHrefString(TreatmentBMPModelExtensions.DetailUrlTemplate.ParameterReplace(x.TreatmentBMPID), "View", new Dictionary <string, string> {
                { "class", "gridButton" }
            }), 50, DhtmlxGridColumnFilterType.None);
            Add(FieldDefinitionType.TreatmentBMP.ToGridHeaderString("Name"), x => UrlTemplate.MakeHrefString(TreatmentBMPModelExtensions.DetailUrlTemplate.ParameterReplace(x.TreatmentBMPID), x.TreatmentBMPName), 170, DhtmlxGridColumnFilterType.Html);
            Add(FieldDefinitionType.Jurisdiction.ToGridHeaderString("Jurisdiction"), x => UrlTemplate.MakeHrefString(StormwaterJurisdictionModelExtensions.DetailUrlTemplate.ParameterReplace(x.StormwaterJurisdictionID), x.OrganizationName), 170);
            Add("Owner Organization", x => UrlTemplate.MakeHrefString(OrganizationModelExtensions.DetailUrlTemplate.ParameterReplace(x.OwnerOrganizationID), x.OwnerOrganizationName), 170);
            Add(FieldDefinitionType.TreatmentBMPType.ToGridHeaderString("Type"), x => x.TreatmentBMPTypeName, 100, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Year Built", x => x.YearBuilt, 100, DhtmlxGridColumnFormatType.Date);
            Add("Notes", x => x.Notes, 195);
            Add("Last Assessment Date", x => x.LatestAssessmentDate, 130);
            Add("Last Assessed Score", x => x.LatestAssessmentScore.HasValue ? x.LatestAssessmentScore.Value.ToString("0.0") : "-", 100, DhtmlxGridColumnFilterType.FormattedNumeric);
            Add("# of Assessments", x => x.NumberOfAssessments, 100, DhtmlxGridColumnFormatType.Integer, DhtmlxGridColumnAggregationType.Total);
            Add("Last Maintenance Date", x => x.LatestMaintenanceDate, 130, DhtmlxGridColumnFormatType.Date);
            Add("# of Maintenance Events", x => x.NumberOfMaintenanceRecords, 100, DhtmlxGridColumnFormatType.Integer, DhtmlxGridColumnAggregationType.Total);
            Add("Benchmark and Threshold Set?", x => (x.NumberOfBenchmarkAndThresholds == x.NumberOfBenchmarkAndThresholdsEntered).ToYesNo(), 80, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Required Lifespan of Installation", x => x.TreatmentBMPLifespanTypeDisplayName ?? "Unknown", 170, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Lifespan End Date (if Fixed End Date)", x => x.TreatmentBMPLifespanEndDate, 130, DhtmlxGridColumnFormatType.Date);
            Add(FieldDefinitionType.RequiredFieldVisitsPerYear.ToGridHeaderString(), x => x.RequiredFieldVisitsPerYear, 130, DhtmlxGridColumnFormatType.Integer);
            Add(FieldDefinitionType.RequiredPostStormFieldVisitsPerYear.ToGridHeaderString(), x => x.RequiredPostStormFieldVisitsPerYear, 130, DhtmlxGridColumnFormatType.Integer);
            Add(FieldDefinitionType.SizingBasis.ToGridHeaderString(), x => x.SizingBasisTypeDisplayName, 130, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionType.TrashCaptureStatus.ToGridHeaderString(), x => x.TrashCaptureStatusTypeDisplayName, 130, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionType.DelineationType.ToGridHeaderString(), x => string.IsNullOrWhiteSpace(x.DelineationTypeDisplayName) ? new HtmlString("<p class='systemText'>No Delineation Provided</p>") : new HtmlString(x.DelineationTypeDisplayName), 130,
                DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
        }
        public TreatmentBMPsInTreatmentBMPTypeGridSpec(Person currentPerson, bool showDelete, bool showEdit,
                                                       Models.TreatmentBMPType treatmentBMPType)
        {
            if (showDelete)
            {
                Add(string.Empty, x =>
                {
                    var userHasDeletePermission = currentPerson.IsManagerOrAdmin() &&
                                                  currentPerson.IsAssignedToStormwaterJurisdiction(x.TreatmentBMP
                                                                                                   .StormwaterJurisdictionID);
                    return(DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(
                               TreatmentBMPModelExtensions.DeleteUrlTemplate.ParameterReplace(x.TreatmentBMP.TreatmentBMPID),
                               userHasDeletePermission, userHasDeletePermission));
                }, 30, DhtmlxGridColumnFilterType.None);
            }

            if (showEdit)
            {
                Add(string.Empty,
                    x => DhtmlxGridHtmlHelpers.MakeEditIconAsHyperlinkBootstrap(
                        TreatmentBMPModelExtensions.EditUrlTemplate.ParameterReplace(x.TreatmentBMP.TreatmentBMPID),
                        currentPerson.IsAssignedToStormwaterJurisdiction(x.TreatmentBMP.StormwaterJurisdictionID)), 30,
                    DhtmlxGridColumnFilterType.None);
            }

            Add(string.Empty,
                x => UrlTemplate.MakeHrefString(
                    TreatmentBMPModelExtensions.DetailUrlTemplate.ParameterReplace(x.TreatmentBMP.TreatmentBMPID),
                    "View", new Dictionary <string, string> {
                { "class", "gridButton" }
            }), 50,
                DhtmlxGridColumnFilterType.None);
            Add(FieldDefinitionType.TreatmentBMP.ToGridHeaderString("Name"),
                x => UrlTemplate.MakeHrefString(
                    TreatmentBMPModelExtensions.DetailUrlTemplate.ParameterReplace(x.TreatmentBMP.TreatmentBMPID),
                    x.TreatmentBMP.TreatmentBMPName), 170, DhtmlxGridColumnFilterType.Html);
            Add(FieldDefinitionType.Jurisdiction.ToGridHeaderString("Jurisdiction"),
                x => UrlTemplate.MakeHrefString(
                    StormwaterJurisdictionModelExtensions.DetailUrlTemplate.ParameterReplace(x.TreatmentBMP
                                                                                             .StormwaterJurisdictionID), x.vTreatmentBmpDetailed.OrganizationName), 170);
            Add("Owner Organization",
                x => UrlTemplate.MakeHrefString(
                    OrganizationModelExtensions.DetailUrlTemplate.ParameterReplace(x.TreatmentBMP.OwnerOrganizationID),
                    x.vTreatmentBmpDetailed.OwnerOrganizationName), 170);
            Add(FieldDefinitionType.TreatmentBMPType.ToGridHeaderString("Type"),
                x => x.vTreatmentBmpDetailed.TreatmentBMPTypeName, 100, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Year Built", x => x.TreatmentBMP.YearBuilt, 100, DhtmlxGridColumnFormatType.Date);
            Add("ID in System of Record", x => x.TreatmentBMP.SystemOfRecordID, 100);
            Add("Water Quality Management Plan", x => x.TreatmentBMP.WaterQualityManagementPlanID.HasValue ?
                x.TreatmentBMP.WaterQualityManagementPlan.GetDisplayNameAsUrl():
                "<p></p>".ToHTMLFormattedString(), 170);
            Add("Notes", x => x.TreatmentBMP.Notes, 195);
            Add("Last Assessment Date", x => x.vTreatmentBmpDetailed.LatestAssessmentDate, 130);
            Add("Last Assessed Score",
                x => x.vTreatmentBmpDetailed.LatestAssessmentScore.HasValue
                    ? x.vTreatmentBmpDetailed.LatestAssessmentScore.Value.ToString("0.0")
                    : "-", 100, DhtmlxGridColumnFilterType.FormattedNumeric);
            Add("# of Assessments", x => x.vTreatmentBmpDetailed.NumberOfAssessments, 100,
                DhtmlxGridColumnFormatType.Integer, DhtmlxGridColumnAggregationType.Total);
            Add("Last Maintenance Date", x => x.vTreatmentBmpDetailed.LatestMaintenanceDate, 130,
                DhtmlxGridColumnFormatType.Date);
            Add("# of Maintenance Events", x => x.vTreatmentBmpDetailed.NumberOfMaintenanceRecords, 100,
                DhtmlxGridColumnFormatType.Integer, DhtmlxGridColumnAggregationType.Total);
            Add("Benchmark and Threshold Set?",
                x => (x.vTreatmentBmpDetailed.NumberOfBenchmarkAndThresholds ==
                      x.vTreatmentBmpDetailed.NumberOfBenchmarkAndThresholdsEntered).ToYesNo(), 80,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Required Lifespan of Installation",
                x => x.vTreatmentBmpDetailed.TreatmentBMPLifespanTypeDisplayName ?? "Unknown", 170,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Lifespan End Date (if Fixed End Date)", x => x.vTreatmentBmpDetailed.TreatmentBMPLifespanEndDate, 130,
                DhtmlxGridColumnFormatType.Date);
            Add(FieldDefinitionType.RequiredFieldVisitsPerYear.ToGridHeaderString(),
                x => x.vTreatmentBmpDetailed.RequiredFieldVisitsPerYear, 130, DhtmlxGridColumnFormatType.Integer);
            Add(FieldDefinitionType.RequiredPostStormFieldVisitsPerYear.ToGridHeaderString(),
                x => x.vTreatmentBmpDetailed.RequiredPostStormFieldVisitsPerYear, 130,
                DhtmlxGridColumnFormatType.Integer);
            Add(FieldDefinitionType.SizingBasis.ToGridHeaderString(),
                x => x.vTreatmentBmpDetailed.SizingBasisTypeDisplayName, 130,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionType.TrashCaptureStatus.ToGridHeaderString(),
                x => x.vTreatmentBmpDetailed.TrashCaptureStatusTypeDisplayName, 130,
                DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add(FieldDefinitionType.DelineationType.ToGridHeaderString(),
                x => string.IsNullOrWhiteSpace(x.vTreatmentBmpDetailed.DelineationTypeDisplayName)
                    ? new HtmlString("<p class='systemText'>No Delineation Provided</p>")
                    : new HtmlString(x.vTreatmentBmpDetailed.DelineationTypeDisplayName), 130,
                DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);

            foreach (var purpose in CustomAttributeTypePurpose.All)
            {
                if (purpose == CustomAttributeTypePurpose.Maintenance)
                {
                    continue;
                }

                var attributes = treatmentBMPType.TreatmentBMPTypeCustomAttributeTypes.Where(x =>
                                                                                             x.CustomAttributeType.CustomAttributeTypePurpose.CustomAttributeTypePurposeID ==
                                                                                             purpose.CustomAttributeTypePurposeID).ToList();

                if (!attributes.Any())
                {
                    continue;
                }

                foreach (var customAttributeType in attributes.SortByOrderThenName())
                {
                    switch (customAttributeType.CustomAttributeType.CustomAttributeDataTypeID)
                    {
                    case (int)CustomAttributeDataTypeEnum.Decimal:
                        Add(customAttributeType.GetDisplayNameWithUnits(),
                            x => Decimal.TryParse(x.TreatmentBMP.GetCustomAttributeValue(customAttributeType), out var decimalResult) ? decimalResult : (Decimal?)null, 130,
                            DhtmlxGridColumnFormatType.Decimal);
                        break;

                    case (int)CustomAttributeDataTypeEnum.Integer:
                        Add(customAttributeType.GetDisplayNameWithUnits(),
                            x => Int32.TryParse(x.TreatmentBMP.GetCustomAttributeValue(customAttributeType), out var intResult) ? intResult : (Int32?)null, 130);
                        break;

                    case (int)CustomAttributeDataTypeEnum.DateTime:
                        Add(customAttributeType.GetDisplayNameWithUnits(),
                            x => DateTime.TryParse(x.TreatmentBMP.GetCustomAttributeValue(customAttributeType), out var dateResult) ? dateResult : (DateTime?)null, 130);
                        break;

                    case (int)CustomAttributeDataTypeEnum.MultiSelect:
                        Add(customAttributeType.GetDisplayNameWithUnits(),
                            x => x.TreatmentBMP.GetCustomAttributeValue(customAttributeType), 130,
                            DhtmlxGridColumnFilterType.SelectFilterStrict);
                        break;

                    case (int)CustomAttributeDataTypeEnum.PickFromList:
                        Add(customAttributeType.GetDisplayNameWithUnits(),
                            x => x.TreatmentBMP.GetCustomAttributeValue(customAttributeType), 130,
                            DhtmlxGridColumnFilterType.SelectFilterStrict);
                        break;

                    case (int)CustomAttributeDataTypeEnum.String:
                        Add(customAttributeType.GetDisplayNameWithUnits(),
                            x => x.TreatmentBMP.GetCustomAttributeValue(customAttributeType), 130,
                            DhtmlxGridColumnFilterType.Text);
                        break;
                    }
                }
            }


            if (!treatmentBMPType.TreatmentBMPModelingTypeID.HasValue)
            {
                return;
            }

            Add(FieldDefinitionType.Watershed.ToGridHeaderString(),
                x => x.TreatmentBMP.Watershed?.WatershedName, 100);
            switch (treatmentBMPType.TreatmentBMPModelingType.ToEnum)
            {
            case TreatmentBMPModelingTypeEnum.BioinfiltrationBioretentionWithRaisedUnderdrain:
                Add(FieldDefinitionType.TotalEffectiveBMPVolume.ToGridHeaderString("Total Effective BMP Volume (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TotalEffectiveBMPVolume, 100);
                Add(FieldDefinitionType.StorageVolumeBelowLowestOutletElevation.ToGridHeaderString("Storage Volume Below Lowest Outlet Elevation (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.StorageVolumeBelowLowestOutletElevation, 100);
                Add(FieldDefinitionType.MediaBedFootprint.ToGridHeaderString("Media Bed Footprint (sq ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.MediaBedFootprint, 100);
                Add(FieldDefinitionType.DesignMediaFiltrationRate.ToGridHeaderString("Design Media Filtration Rate (in/hr)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.DesignMediaFiltrationRate, 100);
                Add(FieldDefinitionType.UnderlyingHydrologicSoilGroupHSG.ToGridHeaderString("Underlying Hydrologic Soil Group"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.UnderlyingHydrologicSoilGroup?
                    .UnderlyingHydrologicSoilGroupDisplayName, 100);
                break;

            case TreatmentBMPModelingTypeEnum.BioretentionWithNoUnderdrain:
            case TreatmentBMPModelingTypeEnum.InfiltrationBasin:
            case TreatmentBMPModelingTypeEnum.InfiltrationTrench:
            case TreatmentBMPModelingTypeEnum.PermeablePavement:
            case TreatmentBMPModelingTypeEnum.UndergroundInfiltration:
                Add(FieldDefinitionType.TotalEffectiveBMPVolume.ToGridHeaderString("Total Effective BMP Volume (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TotalEffectiveBMPVolume, 100);
                Add(FieldDefinitionType.InfiltrationSurfaceArea.ToGridHeaderString("Infiltration Surface Area (sq ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.InfiltrationSurfaceArea, 100);
                Add(FieldDefinitionType.UnderlyingInfiltrationRate.ToGridHeaderString("Underlying Infiltration Rate (in/hr)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.UnderlyingInfiltrationRate, 100);
                break;

            case TreatmentBMPModelingTypeEnum.BioretentionWithUnderdrainAndImperviousLiner:
            case TreatmentBMPModelingTypeEnum.SandFilters:
                Add(FieldDefinitionType.TotalEffectiveBMPVolume.ToGridHeaderString("Total Effective BMP Volume (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TotalEffectiveBMPVolume, 100);
                Add(FieldDefinitionType.MediaBedFootprint.ToGridHeaderString("Media Bed Footprint (sq ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.MediaBedFootprint, 100);
                Add(FieldDefinitionType.DesignMediaFiltrationRate.ToGridHeaderString("Design Media Filtration Rate (in/hr)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.DesignMediaFiltrationRate, 100);
                break;

            case TreatmentBMPModelingTypeEnum.CisternsForHarvestAndUse:
                Add(FieldDefinitionType.TotalEffectiveBMPVolume.ToGridHeaderString("Total Effective BMP Volume (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TotalEffectiveBMPVolume, 100);
                Add(FieldDefinitionType.WinterHarvestedWaterDemand.ToGridHeaderString("Winter Harvested Water Demand (gpd)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.WinterHarvestedWaterDemand, 100);
                Add(FieldDefinitionType.SummerHarvestedWaterDemand.ToGridHeaderString("Summer Harvested Water Demand (gpd)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.SummerHarvestedWaterDemand, 100);
                break;

            case TreatmentBMPModelingTypeEnum.ConstructedWetland:
            case TreatmentBMPModelingTypeEnum.WetDetentionBasin:
                Add(FieldDefinitionType.PermanentPoolOrWetlandVolume.ToGridHeaderString("Permanent Pool Or Wetland Volume (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.PermanentPoolorWetlandVolume, 100);
                Add(FieldDefinitionType.DesignResidenceTimeForPermanentPool.ToGridHeaderString("Design Residence Time for Permanent Pool (days)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.DesignResidenceTimeforPermanentPool, 100);
                Add(FieldDefinitionType.WaterQualityDetentionVolume.ToGridHeaderString("Water Quality Detention Volume (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.WaterQualityDetentionVolume, 100);
                Add(FieldDefinitionType.DrawdownTimeForWQDetentionVolume.ToGridHeaderString("Drawdown Time For WQ Detention Volume (hours)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.DrawdownTimeforWQDetentionVolume, 100);
                Add(FieldDefinitionType.WinterHarvestedWaterDemand.ToGridHeaderString("Winter Harvested Water Demand (gpd)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.WinterHarvestedWaterDemand, 100);
                Add(FieldDefinitionType.SummerHarvestedWaterDemand.ToGridHeaderString("Summer Harvested Water Demand (gpd)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.SummerHarvestedWaterDemand, 100);
                break;

            case TreatmentBMPModelingTypeEnum.DryExtendedDetentionBasin:
            case TreatmentBMPModelingTypeEnum.FlowDurationControlBasin:
            case TreatmentBMPModelingTypeEnum.FlowDurationControlTank:
                Add(FieldDefinitionType.TotalEffectiveBMPVolume.ToGridHeaderString("Total Effective BMP Volume (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TotalEffectiveBMPVolume, 100);
                Add(FieldDefinitionType.StorageVolumeBelowLowestOutletElevation.ToGridHeaderString("Storage Volume Below Lowest Outlet Elevation (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.StorageVolumeBelowLowestOutletElevation, 100);
                Add(FieldDefinitionType.EffectiveFootprint.ToGridHeaderString("Effective Footprint (sq ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.EffectiveFootprint, 100);
                Add(FieldDefinitionType.DrawdownTimeForWQDetentionVolume.ToGridHeaderString("Drawdown Time For WQ Detention Volume (hours)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.DrawdownTimeforWQDetentionVolume, 100);
                Add(FieldDefinitionType.UnderlyingHydrologicSoilGroupHSG.ToGridHeaderString("Underlying Hydrologic Soil Group"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.UnderlyingHydrologicSoilGroup?
                    .UnderlyingHydrologicSoilGroupDisplayName, 100);
                break;

            case TreatmentBMPModelingTypeEnum.DryWeatherTreatmentSystems:
                Add(FieldDefinitionType.DesignDryWeatherTreatmentCapacity.ToGridHeaderString("Design Dry Weather Treatment Capacity (cfs)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.DesignDryWeatherTreatmentCapacity, 100);
                Add(FieldDefinitionType.AverageTreatmentFlowrate.ToGridHeaderString("Average Treatment Flow Rate (cfs)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.AverageTreatmentFlowrate, 100);
                Add(FieldDefinitionType.MonthsOperational.ToGridHeaderString("Months Operational"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.MonthsOfOperation?
                    .MonthsOfOperationDisplayName, 100);
                break;

            case TreatmentBMPModelingTypeEnum.Drywell:
                Add(FieldDefinitionType.TotalEffectiveBMPVolume.ToGridHeaderString("Total Effective BMP Volume (cu ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TotalEffectiveBMPVolume, 100);
                Add(FieldDefinitionType.InfiltrationDischargeRate.ToGridHeaderString("Infiltration Discharge Rate (cfs)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.InfiltrationDischargeRate, 100);
                break;

            case TreatmentBMPModelingTypeEnum.HydrodynamicSeparator:
            case TreatmentBMPModelingTypeEnum.ProprietaryBiotreatment:
            case TreatmentBMPModelingTypeEnum.ProprietaryTreatmentControl:
                Add(FieldDefinitionType.TreatmentRate.ToGridHeaderString("Treatment Rate (cfs)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TreatmentRate, 100);
                Add(FieldDefinitionType.TimeOfConcentration.ToGridHeaderString("Time Of Concentration (mins)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TimeOfConcentration?
                    .TimeOfConcentrationDisplayName, 100);
                break;

            case TreatmentBMPModelingTypeEnum.LowFlowDiversions:
                Add(FieldDefinitionType.DesignLowFlowDiversionCapacity.ToGridHeaderString("Design Low Flow Diversion Capacity (gpd)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.DesignLowFlowDiversionCapacity, 100);
                Add(FieldDefinitionType.AverageDivertedFlowrate.ToGridHeaderString("Average Diverted Flow Rate (gpd)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.AverageDivertedFlowrate, 100);
                Add(FieldDefinitionType.MonthsOperational.ToGridHeaderString("Months Operational"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.MonthsOfOperation?
                    .MonthsOfOperationDisplayName, 100);
                break;

            case TreatmentBMPModelingTypeEnum.VegetatedFilterStrip:
            case TreatmentBMPModelingTypeEnum.VegetatedSwale:
                Add(FieldDefinitionType.TimeOfConcentration.ToGridHeaderString("Time Of Concentration (mins)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TimeOfConcentration?
                    .TimeOfConcentrationDisplayName, 100);
                Add(FieldDefinitionType.TreatmentRate.ToGridHeaderString("Treatment Rate (cfs)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.TreatmentRate, 100);
                Add(FieldDefinitionType.WettedFootprint.ToGridHeaderString("Wetted Footprint (sq ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.WettedFootprint, 100);
                Add(FieldDefinitionType.EffectiveRetentionDepth.ToGridHeaderString("Effective Retention Depth (ft)"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.EffectiveRetentionDepth, 100);
                Add(FieldDefinitionType.UnderlyingHydrologicSoilGroupHSG.ToGridHeaderString("Underlying Hydrologic Soil Group"),
                    x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.UnderlyingHydrologicSoilGroup?
                    .UnderlyingHydrologicSoilGroupDisplayName, 100);
                break;
            }

            Add(FieldDefinitionType.DryWeatherFlowOverride.ToGridHeaderString("Dry Weather Flow Override"),
                x => x.TreatmentBMP.TreatmentBMPModelingAttribute?.DryWeatherFlowOverride?.DryWeatherFlowOverrideDisplayName, 100);
        }