private static string GetStringProperty(this DtObject dtObject, string group, string property) { DtoAttributesGroup table = PropertyTable(dtObject, group, false); if (table == null) { return(null); } else { return(GetStringProperty(table, property)); } }
private static string GetStringProperty(DtoAttributesGroup group, string name) { name = name.ToLowerInvariant(); Object value; group.TryGetValue(name, out value); if (value is string) { return(value.ToString()); } else if (value is DtoAttributDefinition) { DtoAttributDefinition definition = value as DtoAttributDefinition; if (definition != null && definition.Value is string) { return(definition.Value as string); } } return(null); }
public static DtoAttributesGroup PropertyTable(DtObject dtObject, string tableName, bool createIfNotExist) { DtoAttributesGroup group; tableName = tableName.ToLowerInvariant(); dtObject.AttributeGroups.TryGetValue(tableName, out group); if (group == null && (tableName == TableNames.tabAttribGeneral.ToLowerInvariant() || tableName == TableNames.tabAttribElement.ToLowerInvariant())) { string key = dtObject.AttributeGroups.Keys.FirstOrDefault(k => k.IndexOf(tableName) == 0); if (!string.IsNullOrEmpty(key)) { dtObject.AttributeGroups.TryGetValue(key, out group); } } if (group == null && createIfNotExist) { group = new DtoAttributesGroup(); dtObject.AttributeGroups.Add(tableName, group); } return(group); }