Exemplo n.º 1
0
        private static string GetObjectTitle(DObject obj, MType type)
        {
            if (type.Id == MType.SMART_FOLDER_ID && obj.Attributes.ContainsKey(SystemAttributes.SMART_FOLDER_TITLE))
            {
                return(obj.Attributes[SystemAttributes.SMART_FOLDER_TITLE].ToString());
            }

            if (obj.Id == DObject.RootId)
            {
                return(type.Title);
            }

            var sb        = new StringBuilder();
            var attibutes = AttributeFormatter.Format(type, obj.Attributes);

            foreach (var displayableAttr in type.GetDisplayAttributes())
            {
                var attributeText = GetAttributeText(obj, attibutes, displayableAttr);
                if (sb.Length != 0 && !string.IsNullOrEmpty(attributeText))
                {
                    sb.Append(Constants.PROJECT_TITLE_ATTRIBUTES_DELIMITER);
                }
                sb.Append(attributeText);
            }
            return(sb.ToString());
        }
Exemplo n.º 2
0
        private static string GetObjectTitle(DObject obj, MType type)
        {
            var sb        = new StringBuilder();
            var attibutes = AttributeFormatter.Format(type, obj.Attributes.ToDictionary(attr => attr.Key, attr => (attr.Value)));

            foreach (var displayableAttr in type.GetDisplayAttributes())
            {
                DValue value;
                if (attibutes.TryGetValue(displayableAttr.Name, out value))
                {
                    var strValue = value.ToString();
                    if (sb.Length != 0)
                    {
                        sb.Append(Constants.PROJECT_TITLE_ATTRIBUTES_DELIMITER);
                    }

                    sb.Append(strValue);
                }
            }
            return(sb.ToString());
        }