private string GetSubcategoryValue(auditeventpolicysubcategories_item itemType, AuditEventSubcategories subcategoryName) { var subCategoryField = itemType.GetType().GetProperty(subcategoryName.ToString()); var itemValueField = subCategoryField.GetValue(itemType, null); var itemValueFieldValue = itemValueField.GetType().GetProperty("Value"); return(itemValueFieldValue.GetValue(itemValueField, null).ToString()); }
private void MapAuditEventSubcategoriesDictionaryToItemType( Dictionary <AuditEventSubcategories, AuditEventStatus> auditEventPolicySubcategories, auditeventpolicysubcategories_item systemItem) { foreach (var entry in auditEventPolicySubcategories) { var field = systemItem.GetType().GetProperty(entry.Key.ToString()); var fieldValue = field.GetValue(systemItem, null); var childField = fieldValue.GetType().GetProperty("Value"); childField.SetValue(fieldValue, entry.Value.ToString(), null); } }