/// <summary> /// Get the property value where the property name equals the passed in value. /// Always use SetAllPropertySingleValues before calling this method /// </summary> /// <param name="PropertyValueName">IfcPropertySingleValue name</param> /// <param name="containsString">Do Contains text match on PropertyValueName if true, exact match if false</param> /// <returns></returns> public string GetPropertySingleValueValue(string PropertyValueName, bool containsString) { IfcPropertySingleValue ifcPropertySingleValue = null; if (containsString) { ifcPropertySingleValue = ObjProperties.OfType <IfcPropertySingleValue>().Where(p => p.Name.ToString().Contains(PropertyValueName)).FirstOrDefault(); } else { ifcPropertySingleValue = ObjProperties.OfType <IfcPropertySingleValue>().Where(p => p.Name == PropertyValueName).FirstOrDefault(); } //return a string value if ((ifcPropertySingleValue != null) && (ifcPropertySingleValue.NominalValue != null) && (!string.IsNullOrEmpty(ifcPropertySingleValue.NominalValue.Value.ToString())) && (ifcPropertySingleValue.Name.ToString() != ifcPropertySingleValue.NominalValue.Value.ToString()) //name and value are not the same ) { return(ifcPropertySingleValue.NominalValue.Value.ToString()); } else { return(Constants.DEFAULT_STRING); } }
/// <summary> /// Get the property value where the property name equals the passed in value. /// Always use SetAllPropertyValues before calling this method /// </summary> /// <param name="propertyName">IfcProperty name</param> /// <param name="containsString">Do Contains text match on PropertyName if true, exact match if false</param> /// <returns></returns> public string GetPropertyValue(string propertyName, bool containsString) { IIfcSimpleProperty ifcProperty = null; if (containsString) { ifcProperty = ObjProperties.Where(p => p.Name.ToString().Contains(propertyName)).FirstOrDefault(); } else { ifcProperty = ObjProperties.Where(p => p.Name == propertyName).FirstOrDefault(); } if (ifcProperty == null) { return(Constants.DEFAULT_STRING); } //return a string value if (ifcProperty is IIfcPropertySingleValue singleValue) { if (singleValue.NominalValue != null && singleValue.NominalValue.Value != null) { return(singleValue.NominalValue.Value.ToString()); } } else if (ifcProperty is IIfcPropertyEnumeratedValue enumValue) { if (enumValue.EnumerationValues != null && enumValue.EnumerationValues.FirstOrDefault() != null && enumValue.EnumerationValues.FirstOrDefault().Value != null) { return(enumValue.EnumerationValues.FirstOrDefault().Value.ToString()); } } else if (ifcProperty is IfcPropertyReferenceValue propReference) //does not work with IFC4 interfaces! { IfcObjectReferenceSelect referenceSelect = propReference.PropertyReference; if (referenceSelect != null) { string value = referenceSelect.ToString(); return(value); } } else { logger.LogWarning("GetPropertyValue is not implemented for {propertyType}", ifcProperty.GetType().Name); } return(Constants.DEFAULT_STRING); }
public Task Delete(ObjProperties properties) { _context.ObjProperties.Remove(properties); return(_context.SaveChangesAsync()); }
public Task Update(ObjProperties properties) { //_context.ObjProperties.Update(properties); return(_context.SaveChangesAsync()); }
public Task Create(ObjProperties properties) { _context.ObjProperties.Add(properties); return(_context.SaveChangesAsync()); }
/// <summary> /// Get the property value where the property name equals the passed in value /// Always use SetAllPropertySingleValues before calling this method /// </summary> /// <param name="PropertyValueName"></param> /// <returns></returns> public IfcPropertySingleValue GetPropertySingleValue(string PropertyValueName) { return(ObjProperties.OfType <IfcPropertySingleValue>().Where(p => p.Name == PropertyValueName).FirstOrDefault()); }