public void SetFindable(object control, Findable findable) { BinderCollectorItem item = bCollection.Find(p => p.Control == control); if (item != null) { item.Findable = findable; } }
private string CompareString(BinderCollectorItem item) { string sVal = string.Empty; // Controllo se Empty if (item.Control.GetType().BaseType == typeof(CodesControl) || item.Control.GetType() == typeof(CodesControl)) { CodesControl codes = (CodesControl)item.Control; sVal = codes.IsEmpty ? "" : codes.Findable; } //else if (item.Control.GetType() == typeof(CounterControl)) //{ // CounterControl counter = (CounterControl)item.Control; // sVal = counter.IsEmpty // ? "" // : counter.ToString(); //} else { object obj = item.Control; System.Reflection.PropertyInfo pInfo = obj.GetType().GetProperty(item.Property); sVal = (pInfo == null) ? "" : pInfo.GetValue(obj, null).ToString(); } if (item.Property == "Text") { if (sVal.Length > 0) { return(string.Format("[{0}].[{1}] LIKE '{2}%'", item.Table, item.Column, sVal)); } } else { if (sVal.Length > 0) { return(string.Format("[{0}].[{1}] = '{2}'", item.Table, item.Column, sVal)); } } return(string.Empty); }