/// <summary> /// Formats a properties value in a human friendly manner. /// </summary> /// <param name="property"></param> /// <returns></returns> public static string FormatPropertyValue(this DgmTypeAttribute property) { if (property.ValueInt.HasValue) { return(property.ValueInt.ToString()); } // Is it actually an integer stored as a float? if (Math.Truncate(property.ValueFloat.Value) == property.ValueFloat.Value) { return(Convert.ToInt32(property.ValueFloat.Value).ToString()); } return(property.ValueFloat.ToString()); }
/// <summary> /// Type Attribes /// </summary> /// <returns><c>RelationSet</c> of attributes for types</returns> internal static RelationSet <DgmTypeAttribute> TypeAttributes() { var list = new List <DgmTypeAttribute>(); foreach (var typeAttribute in Context.dgmTypeAttributes) { var item = new DgmTypeAttribute { AttributeID = typeAttribute.attributeID, ItemID = typeAttribute.typeID, ValueFloat = typeAttribute.valueFloat, ValueInt = typeAttribute.valueInt }; list.Add(item); } return(new RelationSet <DgmTypeAttribute>(list)); }