Beispiel #1
0
        public DetailViewData(Person currentPerson, Models.MaintenanceRecord maintenanceRecord) : base(currentPerson, NeptuneArea.OCStormwaterTools)
        {
            EntityName = $"{FieldDefinitionType.TreatmentBMP.GetFieldDefinitionLabelPluralized()}";
            var treatmentBMPIndexUrl = SitkaRoute <TreatmentBMPController> .BuildUrlFromExpression(x => x.FindABMP());

            EntityUrl     = treatmentBMPIndexUrl;
            SubEntityName = maintenanceRecord.TreatmentBMP.TreatmentBMPName;
            SubEntityUrl  = maintenanceRecord.TreatmentBMP.GetDetailUrl();
            PageTitle     = maintenanceRecord.GetMaintenanceRecordDate().ToStringDate();
            EditUrl       = maintenanceRecord.FieldVisit != null ? SitkaRoute <FieldVisitController> .BuildUrlFromExpression(x => x.EditMaintenanceRecord(maintenanceRecord.FieldVisit)) : null;

            MaintenanceRecord          = maintenanceRecord;
            CurrentPersonCanManage     = new MaintenanceRecordManageFeature().HasPermissionByPerson(currentPerson);
            BMPTypeHasObservationTypes = maintenanceRecord.TreatmentBMP.TreatmentBMPType.TreatmentBMPTypeCustomAttributeTypes.Any(x => x.CustomAttributeType.CustomAttributeTypePurposeID == CustomAttributeTypePurpose.Maintenance.CustomAttributeTypePurposeID);
            UserHasCustomAttributeTypeManagePermissions = new NeptuneAdminFeature().HasPermissionByPerson(currentPerson);

            SortedMaintenanceRecordObservations = MaintenanceRecord.MaintenanceRecordObservations.ToList()
                                                  .OrderBy(x => x.TreatmentBMPTypeCustomAttributeType.SortOrder)
                                                  .ThenBy(x => x.TreatmentBMPTypeCustomAttributeType.GetDisplayName());
        }
 public EditMaintenanceRecordObservationsViewData(Person currentPerson, Models.TreatmentBMP treatmentBMP,
                                                  CustomAttributeTypePurpose customAttributeTypePurpose, Models.MaintenanceRecord maintenanceRecord,
                                                  bool isSubForm, bool missingRequiredAttributes) : base(currentPerson, treatmentBMP, customAttributeTypePurpose, isSubForm, missingRequiredAttributes)
 {
     PageTitle       = $"Edit Maintenance Record Observations";
     ParentDetailUrl = maintenanceRecord.GetDetailUrl();
 }
 public EditMaintenanceRecordViewModel(Models.MaintenanceRecord maintenanceRecord) : base(maintenanceRecord.TreatmentBMP, CustomAttributeTypePurpose.Maintenance)
 {
     MaintenanceRecordTypeID      = maintenanceRecord.MaintenanceRecordTypeID;
     MaintenanceRecordDescription = maintenanceRecord.MaintenanceRecordDescription;
     CustomAttributes             = maintenanceRecord.MaintenanceRecordObservations.Select(x => new CustomAttributeSimple(x)).ToList();
 }