public CustomAttributeTypeSimple(CustomAttributeType customAttributeType) { CustomAttributeTypeID = customAttributeType.CustomAttributeTypeID; CustomAttributeTypeName = $"{customAttributeType.CustomAttributeTypeName}"; DataTypeDisplayName = customAttributeType.CustomAttributeDataType.CustomAttributeDataTypeDisplayName; MeasurementUnitDisplayName = customAttributeType.GetMeasurementUnitDisplayName(); IsRequired = customAttributeType.IsRequired; Description = customAttributeType.CustomAttributeTypeDescription; Purpose = customAttributeType.CustomAttributeTypePurpose .CustomAttributeTypePurposeDisplayName; }
public string GetObservationValueForAttributeType(CustomAttributeType customAttributeType) { if (customAttributeType.TreatmentBMPTypeCustomAttributeTypes.All(x => x.TreatmentBMPTypeID != TreatmentBMPTypeID)) { return(ViewUtilities.NaString); } var maintenanceRecordObservation = MaintenanceRecordObservations.SingleOrDefault(y => y.CustomAttributeTypeID == customAttributeType.CustomAttributeTypeID && y.MaintenanceRecordObservationValues.Any(z => !string.IsNullOrWhiteSpace(z.ObservationValue))); return(maintenanceRecordObservation?.GetObservationValueWithoutUnits() ?? ViewUtilities.NotProvidedString); }
public static string GetDetailUrl(this CustomAttributeType customAttributeType) { return(customAttributeType == null ? "" : DetailUrlTemplate.ParameterReplace(customAttributeType.CustomAttributeTypeID)); }
public static HtmlString GetDisplayNameAsUrl(this CustomAttributeType customAttributeType) { return(customAttributeType != null?UrlTemplate.MakeHrefString(customAttributeType.GetDetailUrl(), customAttributeType.CustomAttributeTypeName) : new HtmlString(null)); }
public static string GetEditUrl(this CustomAttributeType customAttributeType) { return(EditUrlTemplate.ParameterReplace(customAttributeType.CustomAttributeTypeID)); }
public static void DeleteCustomAttributeType(this IQueryable <CustomAttributeType> customAttributeTypes, CustomAttributeType customAttributeTypeToDelete) { DeleteCustomAttributeType(customAttributeTypes, new List <CustomAttributeType> { customAttributeTypeToDelete }); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static CustomAttribute CreateNewBlank(TreatmentBMP treatmentBMP, TreatmentBMPTypeCustomAttributeType treatmentBMPTypeCustomAttributeType, TreatmentBMPType treatmentBMPType, CustomAttributeType customAttributeType) { return(new CustomAttribute(treatmentBMP, treatmentBMPTypeCustomAttributeType, treatmentBMPType, customAttributeType)); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public CustomAttribute(TreatmentBMP treatmentBMP, TreatmentBMPTypeCustomAttributeType treatmentBMPTypeCustomAttributeType, TreatmentBMPType treatmentBMPType, CustomAttributeType customAttributeType) : this() { // Mark this as a new object by setting primary key with special value this.CustomAttributeID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.TreatmentBMPID = treatmentBMP.TreatmentBMPID; this.TreatmentBMP = treatmentBMP; treatmentBMP.CustomAttributes.Add(this); this.TreatmentBMPTypeCustomAttributeTypeID = treatmentBMPTypeCustomAttributeType.TreatmentBMPTypeCustomAttributeTypeID; this.TreatmentBMPTypeCustomAttributeType = treatmentBMPTypeCustomAttributeType; treatmentBMPTypeCustomAttributeType.CustomAttributes.Add(this); this.TreatmentBMPTypeID = treatmentBMPType.TreatmentBMPTypeID; this.TreatmentBMPType = treatmentBMPType; treatmentBMPType.CustomAttributes.Add(this); this.CustomAttributeTypeID = customAttributeType.CustomAttributeTypeID; this.CustomAttributeType = customAttributeType; customAttributeType.CustomAttributes.Add(this); }
/// <summary> /// Creates a "blank" object of this type and populates primitives with defaults /// </summary> public static MaintenanceRecordObservation CreateNewBlank(MaintenanceRecord maintenanceRecord, TreatmentBMPTypeCustomAttributeType treatmentBMPTypeCustomAttributeType, TreatmentBMPType treatmentBMPType, CustomAttributeType customAttributeType) { return(new MaintenanceRecordObservation(maintenanceRecord, treatmentBMPTypeCustomAttributeType, treatmentBMPType, customAttributeType)); }
/// <summary> /// Constructor for building a new object with MinimalConstructor required fields, using objects whenever possible /// </summary> public MaintenanceRecordObservation(MaintenanceRecord maintenanceRecord, TreatmentBMPTypeCustomAttributeType treatmentBMPTypeCustomAttributeType, TreatmentBMPType treatmentBMPType, CustomAttributeType customAttributeType) : this() { // Mark this as a new object by setting primary key with special value this.MaintenanceRecordObservationID = ModelObjectHelpers.MakeNextUnsavedPrimaryKeyValue(); this.MaintenanceRecordID = maintenanceRecord.MaintenanceRecordID; this.MaintenanceRecord = maintenanceRecord; maintenanceRecord.MaintenanceRecordObservations.Add(this); this.TreatmentBMPTypeCustomAttributeTypeID = treatmentBMPTypeCustomAttributeType.TreatmentBMPTypeCustomAttributeTypeID; this.TreatmentBMPTypeCustomAttributeType = treatmentBMPTypeCustomAttributeType; treatmentBMPTypeCustomAttributeType.MaintenanceRecordObservations.Add(this); this.TreatmentBMPTypeID = treatmentBMPType.TreatmentBMPTypeID; this.TreatmentBMPType = treatmentBMPType; treatmentBMPType.MaintenanceRecordObservations.Add(this); this.CustomAttributeTypeID = customAttributeType.CustomAttributeTypeID; this.CustomAttributeType = customAttributeType; customAttributeType.MaintenanceRecordObservations.Add(this); }