private FilterColumnProfile[] GetFilterProfile(IEnumerable <XElement> query, string filterObjectSchemaTypeName) { List <FilterColumnProfile> list = new List <FilterColumnProfile>(); foreach (XElement xelement in query) { string text = (string)xelement.Attribute("Name"); Type type = this.HasValue(xelement.Attribute("ColumnType")) ? ObjectSchemaLoader.GetTypeByString((string)xelement.Attribute("ColumnType")) : null; string text2 = (string)xelement.Attribute("Operators"); string value = (string)xelement.Attribute("FormatMode"); string text3 = this.HasValue(xelement.Attribute("ObjectSchemaField")) ? ((string)xelement.Attribute("ObjectSchemaField")) : text; ProviderPropertyDefinition providerPropertyDefinition = (type == null) ? ((ProviderPropertyDefinition)ObjectSchemaLoader.GetStaticField(filterObjectSchemaTypeName, text3)) : FilterControlHelper.GenerateEmptyPropertyDefinition(text3, type); List <FilterColumnProfile> list2 = list; FilterColumnProfile filterColumnProfile = new FilterColumnProfile(); filterColumnProfile.ColumnType = type; filterColumnProfile.FilterableListSource = this.GetFilterableListSource(providerPropertyDefinition.Type, (string)xelement.Attribute("FilterableListSource")); FilterColumnProfile filterColumnProfile2 = filterColumnProfile; PropertyFilterOperator[] operators; if (!string.IsNullOrEmpty(text2)) { operators = (from opera in text2.Split(new char[] { ',' }) select(PropertyFilterOperator) Enum.Parse(typeof(PropertyFilterOperator), opera)).ToArray <PropertyFilterOperator>(); } else { operators = FilterControlHelper.GetFilterOperators(providerPropertyDefinition.Type); } filterColumnProfile2.Operators = operators; filterColumnProfile.DisplayMember = (string)xelement.Attribute("DisplayMember"); filterColumnProfile.FormatMode = (string.IsNullOrEmpty(value) ? 0 : ((DisplayFormatMode)Enum.Parse(typeof(DisplayFormatMode), value))); filterColumnProfile.Name = text; filterColumnProfile.PickerProfile = (string)xelement.Attribute("PickerProfile"); filterColumnProfile.ValueMember = (string)xelement.Attribute("ValueMember"); filterColumnProfile.PropertyDefinition = ((providerPropertyDefinition.Name == text) ? providerPropertyDefinition : FilterControlHelper.CopyPropertyDefinition(text, providerPropertyDefinition)); filterColumnProfile.RefDisplayedColumn = (this.HasValue(xelement.Attribute("RefDisplayedColumn")) ? ((string)xelement.Attribute("RefDisplayedColumn")) : text); list2.Add(filterColumnProfile); } return(list.ToArray()); }
public static ProviderPropertyDefinition GenerateEmptyPropertyDefinition(string propertyName, Type type) { return(new SimpleProviderPropertyDefinition(propertyName, ExchangeObjectVersion.Exchange2003, FilterControlHelper.GetEffectiveType(type), FilterControlHelper.GetDefaultPropertyDefinitionFlagsForType(type), FilterControlHelper.GetDefaultValueForType(type), PropertyDefinitionConstraint.None, PropertyDefinitionConstraint.None)); }