internal void AddCustomColumns() { try { if (Properties.Settings.Default.CustomPropertyList == null) { return; } for (int i = 0; i < Properties.Settings.Default.CustomPropertyList.Count; i++) { CustomPropertyConfig cfg = Properties.Settings.Default.CustomPropertyList[i]; if (!this.Columns.Contains(cfg.LdapPropertyName)) { DataColumn col = new DataColumn(cfg.LdapPropertyName, typeof(string)); this.Columns.Add(col); } } } catch { } }
public IEnumerable <CustomPropertyTab> GetCustomProps(string type = "", string docTypeAlias = "") { var outProps = new List <CustomPropertyTab>(); // we need either param if (string.IsNullOrEmpty(docTypeAlias) && string.IsNullOrEmpty(type)) { return(outProps); } // get doc type from pipeline config if (string.IsNullOrEmpty(docTypeAlias) && !string.IsNullOrEmpty(type)) { var pipelineConfig = PipelineConfig.GetConfig().AppSettings; switch (type) { case "contact": docTypeAlias = pipelineConfig.ContactDocTypes; break; case "organisation": docTypeAlias = pipelineConfig.OrganisationDocTypes; break; case "segment": docTypeAlias = pipelineConfig.SegmentDocTypes; break; default: docTypeAlias = pipelineConfig.OpportunityDocTypes; break; } if (string.IsNullOrEmpty(docTypeAlias) || Services.ContentTypeService.GetContentType(docTypeAlias) == null) { return(outProps); } } // check there is such a doc type if (Services.ContentTypeService.GetContentType(docTypeAlias) == null) { return(outProps); } // construct shadow doc type definition var tabs = Services.ContentTypeService.GetContentType(docTypeAlias).PropertyGroups.OrderBy(x => x.SortOrder); foreach (var tab in tabs) { var tabProps = new CustomPropertyTab() { name = tab.Name.Contains('.') ? tab.Name.Split('.')[1] : tab.Name, items = new List <CustomProperty>() }; var props = tab.PropertyTypes.OrderBy(x => x.SortOrder); if (props.Any()) { foreach (var prop in props) { var config = new CustomPropertyConfig(); var prevalues = Services.DataTypeService.GetPreValuesCollectionByDataTypeId(prop.DataTypeDefinitionId).PreValuesAsDictionary; if (prevalues.Any()) { var items = new List <CustomPropertyPreValue>(); foreach (var preval in prevalues) { items.Add(new CustomPropertyPreValue() { id = preval.Value.Id, value = preval.Value.Value }); } config.items = items; } var newProp = new CustomProperty() { id = prop.Id, alias = prop.Alias, label = prop.Name, description = prop.Description, view = PropertyEditorResolver.Current.GetByAlias(prop.PropertyEditorAlias).ValueEditor.View, config = config }; tabProps.items.Add(newProp); } outProps.Add(tabProps); } } return(outProps); }