public SiteAuditableProperties(string DocTypeAlias) { this.PropsForDoctype = DocTypeAlias; List <AuditableProperty> propertiesList = new List <AuditableProperty>(); ContentType ct = AuditHelper.GetContentTypeByAlias(DocTypeAlias); foreach (var prop in ct.PropertyTypes) { //Add property AuditableProperty auditProp = new AuditableProperty(prop); var info = new PropertyDoctypeInfo(); info.DocTypeAlias = DocTypeAlias; info.GroupName = ""; auditProp.AllDocTypes.Add(info); propertiesList.Add(auditProp); } this.AllProperties = propertiesList; }
public SiteAuditableProperties() { this.PropsForDoctype = "[All]"; List <AuditableProperty> propertiesList = new List <AuditableProperty>(); var allDocTypes = AuditHelper.GetAllContentTypesAliases(); foreach (var docTypeAlias in allDocTypes) { ContentType ct = AuditHelper.GetContentTypeByAlias(docTypeAlias); foreach (var prop in ct.PropertyTypes) { //test for the same property already in list if (propertiesList.Exists(i => i.UmbPropertyType.Alias == prop.Alias & i.UmbPropertyType.Name == prop.Name & i.UmbPropertyType.DataTypeDefinitionId == prop.DataTypeDefinitionId)) { //Add current DocType to existing property var info = new PropertyDoctypeInfo(); info.DocTypeAlias = docTypeAlias; info.GroupName = ""; propertiesList.Find(i => i.UmbPropertyType.Alias == prop.Alias).AllDocTypes.Add(info); } else { //Add new property AuditableProperty auditProp = new AuditableProperty(prop); var info = new PropertyDoctypeInfo(); info.DocTypeAlias = docTypeAlias; info.GroupName = ""; auditProp.AllDocTypes.Add(info); propertiesList.Add(auditProp); } } } this.AllProperties = propertiesList; }