public FilterAtomEditor(CollectionVM collection, FltAtomExprData filter) { InitializeComponent(); var field = collection.AvailableProperties.FirstOrDefault(p => p.Path == filter.Field); Filter = filter; IsWithEntityIdFilter = false; setField(field); }
public FilterAtomEditor(PropertyDefinitionModel field) { InitializeComponent(); IsWithEntityIdFilter = false; Filter = new FltAtomExprData() { Operator = FilterFieldOperator.Equal, PropertyType = field.Type, Field = field.Path }; setField(field); }
/// <summary> /// clones the instance of this class and the relation data contained in it /// </summary> /// <returns></returns> public override FilterExpressionData Clone() { FltAtomExprData thisFa = this as FltAtomExprData; FltAtomExprData fa = new FltAtomExprData(); fa.Field = thisFa.Field; fa.Operator = thisFa.Operator; fa.IsActive = thisFa.IsActive; fa.PropertyType = thisFa.PropertyType; fa.Value = thisFa.Value; fa.Values = thisFa.Values; fa.Negate = this.Negate; return(fa); }
/// <summary> /// gets the filter for the given field name, if not existing creates a new not-active one with the default 'Contains' field operator /// </summary> /// <param name="fieldName"></param> /// <returns></returns> public FltAtomExprData GetFilter(string fieldName) { if (!FieldFilters.ContainsKey(fieldName)) { FieldFilters[fieldName] = new FltAtomExprData() { Field = fieldName, Operator = FilterFieldOperator.Equal, Value = "", IsActive = false }; } return(FieldFilters[fieldName]); }
public void SetFieldFilterPropertyType(string fieldName, PropertyType type) { if (!FieldFilters.ContainsKey(fieldName)) { FieldFilters[fieldName] = new FltAtomExprData() { Field = fieldName, Operator = FilterFieldOperator.Equal, IsActive = false }; } FltAtomExprData fa = FieldFilters[fieldName]; fa.PropertyType = type; }
public FilterElementEditor(CollectionVM collection, FltAtomExprData filter, bool isPopupMode) { this.IsPopupMode = isPopupMode; InitializeComponent(); this.propSelector.SelectedPropertyChanged += PropSelector_SelectedPropertyChanged; Filter = filter; this.propSelector.Properties = collection.AvailableProperties; this.propSelector.SelectedProperty = new PropertyDefinitionModel { Path = filter.Field, Name = filter.Field, Type = filter.PropertyType }; IsWithcollectionIdFilter = false; setField(this.propSelector.SelectedProperty); }
public FilterElementEditor(CollectionVM collection, PropertyDefinitionModel elementDef, bool isPopupMode) { this.IsPopupMode = isPopupMode; InitializeComponent(); this.propSelector.SelectedPropertyChanged += PropSelector_SelectedPropertyChanged; IsWithcollectionIdFilter = false; var field = elementDef; this.propSelector.Properties = collection.AvailableProperties; this.propSelector.SelectedProperty = elementDef; Filter = new FltAtomExprData() { Operator = FilterFieldOperator.Equal, PropertyType = field.Type, Field = field.Path }; setField(field); }
private static FilterExpressionData fromXmlAtom(XElement xml) { FltAtomExprData ret = xml.ToObject <FltAtomExprData> ( new a7MappingXElement2Property("Operator", "Operator", (s) => { FilterFieldOperator eOp = FilterFieldOperator.Equal; Enum.TryParse <FilterFieldOperator>(s, true, out eOp); return(eOp); } ), new a7MappingXElement2Property("Negate", "Negate", (s) => s.ToBool(false)) ); ret.IsActive = true; return(ret); }
public static FilterExpressionData FromXml(XElement xml) { if (xml != null && xml.Name.LocalName.Equals(XElementNames.FilterAtomExpressionNode)) { return(fromXmlAtom(xml)); } else if (xml.Name.LocalName.Equals(XElementNames.FilterGroupExpressionNode)) { return(fromXmlGroup(xml)); } else if (xml.Name.LocalName.Equals(XElementNames.FilterFalseExprNode)) { return(FltAtomExprData.AlwaysFalse()); } else if (xml.Name.LocalName.Equals(XElementNames.FilterTrueExprNode)) { return(FltAtomExprData.AlwaysTrue()); } return(null); }
/// <summary> /// sets the field filter, if not exist, creates it, with default 'Contains' operator. If value is empty string or null or white space, deactivates the filter /// </summary> /// <param name="fieldName"></param> /// <param name="value"></param> public void SetFieldFilter(string fieldName, string value) { if (!FieldFilters.ContainsKey(fieldName)) { FieldFilters[fieldName] = new FltAtomExprData() { Field = fieldName, Operator = FilterFieldOperator.Equal, }; } FltAtomExprData fa = FieldFilters[fieldName]; if (value.IsNotEmpty()) { fa.IsActive = true; fa.Value = value; } else { fa.IsActive = false; fa.Value = ""; } }
/// <summary> /// clones the instance of this class and the relation data contained in it /// </summary> /// <returns></returns> public override FilterExpressionData Clone() { FltAtomExprData thisFa = this as FltAtomExprData; FltAtomExprData fa = new FltAtomExprData(); fa.Field = thisFa.Field; fa.Operator = thisFa.Operator; fa.IsActive = thisFa.IsActive; fa.PropertyType = thisFa.PropertyType; fa.Value = thisFa.Value; fa.Values = thisFa.Values; fa.Negate = this.Negate; return fa; }
/// <summary> /// gets the filter for the given field name, if not existing creates a new not-active one with the default 'Contains' field operator /// </summary> /// <param name="fieldName"></param> /// <returns></returns> public FltAtomExprData GetFilter(string fieldName) { if (!FieldFilters.ContainsKey(fieldName)) { FieldFilters[fieldName] = new FltAtomExprData() { Field = fieldName, Operator = FilterFieldOperator.Equal, Value = "", IsActive = false }; } return FieldFilters[fieldName]; }