public static bool CheckWithSelector(System.Collections.Hashtable other, TQItemSelector selector) { object DVAL; bool nullable; foreach (KeyValuePair <string, TQItemSelectorParam> rule in selector.parameters) { if (other.ContainsKey(rule.Key)) { DVAL = other[rule.Key]; if (rule.Value.ValueSet == TQItemSelectorSet.Equals) { if (((IComparable)rule.Value.Value) .CompareTo(RepresentedModel.Convert(DVAL, RepresentedModel.GetRType(rule.Value.Value.GetType(), out nullable))) != 0) { return(false); } } else if (rule.Value.ValueSet == TQItemSelectorSet.NotEquals) { if (((IComparable)rule.Value.Value) .CompareTo(RepresentedModel.Convert(DVAL, RepresentedModel.GetRType(rule.Value.Value.GetType(), out nullable))) == 0) { return(false); } } } else { return(false); } } return(true); }
public static bool CheckWithSelector(Dictionary <string, object> other, TQItemSelector selector) { object DVAL; bool nullable; foreach (KeyValuePair <string, TQItemSelectorParam> rule in selector.parameters) { if (other.TryGetValue(rule.Key, out DVAL)) { if (rule.Value.ValueSet == TQItemSelectorSet.Equals) { if (((IComparable)rule.Value.Value) .CompareTo(RepresentedModel.Convert(DVAL, RepresentedModel.GetRType(rule.Value.Value.GetType(), out nullable))) != 0) { return(false); } } else if (rule.Value.ValueSet == TQItemSelectorSet.NotEquals) { if (((IComparable)rule.Value.Value) .CompareTo(RepresentedModel.Convert(DVAL, RepresentedModel.GetRType(rule.Value.Value.GetType(), out nullable))) == 0) { return(false); } } } else { return(false); } } return(true); }