예제 #1
0
        public ProvisionalBMPDelineationsGridSpec(Person currentPerson, string gridName)
        {
            ObjectNameSingular = "Delineation";
            ObjectNamePlural   = "Delineations";

            ArbitraryHeaderHtml = new List <string>
            {
                DatabaseContextExtensions.GetCheckboxSelectingUrl($"Sitka.{gridName}.grid.checkAll()",
                                                                  "glyphicon-check", "Select All"),
                DatabaseContextExtensions.GetCheckboxSelectingUrl($"Sitka.{gridName}.grid.uncheckAll()",
                                                                  "glyphicon-unchecked", "Unselect All")
            };
            AddCheckBoxColumn();
            Add("EntityID", x => x.DelineationID, 0);
            Add(string.Empty,
                x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(),
                                                                          new DelineationDeleteFeature().HasPermission(currentPerson, x).HasPermission), 20,
                DhtmlxGridColumnFilterType.None);
            Add(string.Empty, x => x.GetDetailUrlForGrid(), 45, DhtmlxGridColumnFilterType.None);
            Add("BMP Name", x => x.TreatmentBMP.GetDisplayNameAsUrl(), 120, DhtmlxGridColumnFilterType.Html);
            Add("BMP Type", x => x.TreatmentBMP.TreatmentBMPType.TreatmentBMPTypeName, 125, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Delineation Type", x => x.TreatmentBMP.Delineation.DelineationType.DelineationTypeDisplayName, 80, DhtmlxGridColumnFilterType.SelectFilterStrict);
            Add("Delineation Area (ac)", x => x.TreatmentBMP.Delineation?.GetDelineationArea(), 75);
            Add("Date of Last Delineation Modification", x => x.TreatmentBMP.Delineation?.DateLastModified, 120,
                DhtmlxGridColumnFormatType.Date);
            Add("Date of Last Delineation Verification", x => x.TreatmentBMP.Delineation?.DateLastVerified, 120,
                DhtmlxGridColumnFormatType.Date);
            Add(FieldDefinitionType.Jurisdiction.ToGridHeaderString(),
                x => x.TreatmentBMP.StormwaterJurisdiction.GetDisplayNameAsDetailUrl(), 140,
                DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
        }
예제 #2
0
 public ProvisionalTreatmentBMPGridSpec(Person currentPerson, string gridName)
 {
     ArbitraryHeaderHtml = new List <string> {
         DatabaseContextExtensions.GetCheckboxSelectingUrl($"Sitka.{gridName}.grid.checkAll()", "glyphicon-check", "Select All"), DatabaseContextExtensions.GetCheckboxSelectingUrl($"Sitka.{gridName}.grid.uncheckAll()", "glyphicon-unchecked", "Unselect All")
     };
     AddCheckBoxColumn();
     Add("EntityID", x => x.TreatmentBMPID, 0);
     Add(string.Empty, x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(x.GetDeleteUrl(), x.CanDelete(currentPerson), x.CanDelete(currentPerson)), 30, DhtmlxGridColumnFilterType.None);
     Add(string.Empty, x => UrlTemplate.MakeHrefString(x.GetDetailUrl(), "View", new Dictionary <string, string> {
         { "class", "gridButton" }
     }), 50, DhtmlxGridColumnFilterType.None);
     Add("BMP Name", x => x.GetDisplayNameAsUrl(), 120, DhtmlxGridColumnFilterType.Html);
     Add(FieldDefinitionType.TreatmentBMPType.ToGridHeaderString(), x => x.TreatmentBMPType.TreatmentBMPTypeName, 180, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add("Date of Last BMP Record Verification", x => x.DateOfLastInventoryVerification, 125, DhtmlxGridColumnFormatType.Date);
     Add(FieldDefinitionType.DateOfLastInventoryChange.ToGridHeaderString(), x => x.InventoryLastChangedDate, 120, DhtmlxGridColumnFormatType.Date);
     Add("Has Photos?", x => x.TreatmentBMPImages.Any().ToYesNo(), 120, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add("Benchmark and Thresholds Set?", x => x.IsBenchmarkAndThresholdsComplete().ToYesNo(), 120, DhtmlxGridColumnFilterType.SelectFilterStrict);
     Add(FieldDefinitionType.Jurisdiction.ToGridHeaderString(), x => x.StormwaterJurisdiction.GetDisplayNameAsDetailUrl(), 140, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
 }
        public ProvisionalFieldVisitGridSpec(Person currentPerson, string gridName)
        {
            ObjectNameSingular = "Field Visit";
            ObjectNamePlural   = "Field Visits";

            ArbitraryHeaderHtml = new List <string>
            {
                DatabaseContextExtensions.GetCheckboxSelectingUrl($"Sitka.{gridName}.grid.checkAll()",
                                                                  "glyphicon-check", "Select All"),
                DatabaseContextExtensions.GetCheckboxSelectingUrl($"Sitka.{gridName}.grid.uncheckAll()",
                                                                  "glyphicon-unchecked", "Unselect All")
            };
            AddCheckBoxColumn();
            Add("EntityID", x => x.FieldVisitID, 0);
            Add(string.Empty,
                x => DhtmlxGridHtmlHelpers.MakeDeleteIconAndLinkBootstrap(FieldVisitModelExtensions.DeleteUrlTemplate.ParameterReplace(x.FieldVisitID),
                                                                          currentPerson.IsManagerOrAdmin()), 30,
                DhtmlxGridColumnFilterType.None);

            Add(string.Empty,
                x =>
            {
                // do this first because if the field visit is verified, fieldvisiteditfeature will fail
                if (x.IsFieldVisitVerified || x.FieldVisitStatusID == FieldVisitStatus.Complete.FieldVisitStatusID)
                {
                    return(UrlTemplate.MakeHrefString(FieldVisitModelExtensions.DetailUrlTemplate.ParameterReplace(x.FieldVisitID)
                                                      , "View", new Dictionary <string, string> {
                        { "class", "gridButton" }
                    }));
                }

                return(UrlTemplate.MakeHrefString(FieldVisitModelExtensions.WorkflowUrlTemplate.ParameterReplace(x.FieldVisitID)
                                                  , "Continue", new Dictionary <string, string> {
                    { "class", "gridButton" }
                }));
            }, 60,
                DhtmlxGridColumnFilterType.None);

            Add("BMP Name", x => UrlTemplate.MakeHrefString(TreatmentBMPModelExtensions.DetailUrlTemplate.ParameterReplace(x.TreatmentBMPID), x.TreatmentBMPName), 120, DhtmlxGridColumnFilterType.Html);
            Add("Visit Date", x => x.VisitDate, 130, DhtmlxGridColumnFormatType.Date);
            Add(FieldDefinitionType.Jurisdiction.ToGridHeaderString(), x => UrlTemplate.MakeHrefString(StormwaterJurisdictionModelExtensions.DetailUrlTemplate.ParameterReplace(x.StormwaterJurisdictionID), x.OrganizationName), 140, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
            Add("Performed By", x => UrlTemplate.MakeHrefString(PersonModelExtensions.DetailUrlTemplate.ParameterReplace(x.PerformedByPersonID), x.PerformedByPersonName), 105,
                DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
            Add(FieldDefinitionType.FieldVisitStatus.ToGridHeaderString(),
                x => x.FieldVisitStatusDisplayName, 85,
                DhtmlxGridColumnFilterType.SelectFilterHtmlStrict);
            Add("Field Visit Type", x => x.FieldVisitTypeDisplayName, 125,
                DhtmlxGridColumnFilterType.SelectFilterStrict);

            Add("Initial Assessment?",
                x => x.TreatmentBMPAssessmentIDInitial.HasValue
                    ? UrlTemplate.MakeHrefString(TreatmentBMPAssessmentModelExtensions.DetailUrlTemplate.ParameterReplace(x.TreatmentBMPAssessmentIDInitial.Value),
                                                 x.IsAssessmentCompleteInitial ? "Complete" : "In Progress")
                    : new HtmlString("Not Performed"), 95, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict, DhtmlxGridColumnAlignType.Center);
            Add("Initial Assessment Score", x => x.AssessmentScoreInitial?.ToString("0.0") ?? "-", 95,
                DhtmlxGridColumnFilterType.Numeric);
            Add("Maintenance Occurred?",
                x => x.MaintenanceRecordID.HasValue
                    ? UrlTemplate.MakeHrefString(MaintenanceRecordModelExtensions.DetailUrlTemplate.ParameterReplace(x.MaintenanceRecordID.Value), "Performed",
                                                 new Dictionary <string, string>())
                    : new HtmlString("Not Performed"), 95, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict, DhtmlxGridColumnAlignType.Center);
            Add("Post-Maintenance Assessment?",
                x =>
                x.TreatmentBMPAssessmentIDPM.HasValue
                        ? UrlTemplate.MakeHrefString(TreatmentBMPAssessmentModelExtensions.DetailUrlTemplate.ParameterReplace(x.TreatmentBMPAssessmentIDPM.Value),
                                                     x.IsAssessmentCompletePM ? "Complete" : "In Progress")
                        : new HtmlString("Not Performed"), 120, DhtmlxGridColumnFilterType.SelectFilterHtmlStrict, DhtmlxGridColumnAlignType.Center);
            Add("Post-Maintenance Assessment Score", x => x.AssessmentScorePM?.ToString("0.0") ?? "-", 95,
                DhtmlxGridColumnFilterType.Numeric);
        }