예제 #1
0
 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;
 }
예제 #2
0
        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));
 }
예제 #6
0
 public static void DeleteCustomAttributeType(this IQueryable <CustomAttributeType> customAttributeTypes, CustomAttributeType customAttributeTypeToDelete)
 {
     DeleteCustomAttributeType(customAttributeTypes, new List <CustomAttributeType> {
         customAttributeTypeToDelete
     });
 }
예제 #7
0
 /// <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));
 }
예제 #8
0
 /// <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);
 }
예제 #9
0
 /// <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));
 }
예제 #10
0
 /// <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);
 }