public string GetCustomAttributeValue(TreatmentBMPTypeCustomAttributeType treatmentBMPTypeCustomAttributeType) { if (CustomAttributes.Any()) { var customAttribute = CustomAttributes.FirstOrDefault(x => x.CustomAttributeTypeID == treatmentBMPTypeCustomAttributeType.CustomAttributeTypeID); if (customAttribute != null) { return(string.Join(", ", customAttribute.CustomAttributeValues.OrderBy(x => x.AttributeValue).Select(x => x.AttributeValue))); } } return(string.Empty); }
/// <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> /// 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); }
public string GetCustomAttributeValueWithUnits(TreatmentBMPTypeCustomAttributeType treatmentBMPTypeCustomAttributeType) { if (CustomAttributes.Any()) { var customAttribute = CustomAttributes.SingleOrDefault(x => x.CustomAttributeTypeID == treatmentBMPTypeCustomAttributeType.CustomAttributeTypeID); if (customAttribute != null) { var measurementUnit = ""; if (customAttribute.CustomAttributeType.MeasurementUnitTypeID.HasValue) { measurementUnit = $" {customAttribute.CustomAttributeType.MeasurementUnitType.LegendDisplayName}"; } var value = string.Join(", ", customAttribute.CustomAttributeValues.OrderBy(x => x.AttributeValue).Select(x => x.AttributeValue)); return($"{value}{measurementUnit}"); } } return(string.Empty); }
public static void DeleteTreatmentBMPTypeCustomAttributeType(this IQueryable <TreatmentBMPTypeCustomAttributeType> treatmentBMPTypeCustomAttributeTypes, TreatmentBMPTypeCustomAttributeType treatmentBMPTypeCustomAttributeTypeToDelete) { DeleteTreatmentBMPTypeCustomAttributeType(treatmentBMPTypeCustomAttributeTypes, new List <TreatmentBMPTypeCustomAttributeType> { treatmentBMPTypeCustomAttributeTypeToDelete }); }
/// <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> /// 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)); }