/// <summary> /// Создание глубокой копии фильтра. /// </summary> /// <returns></returns> public override object Clone() { EnumFilterValue clone = new EnumFilterValue(); clone.BCheckBoxNull = BCheckBoxNull; if (BCheckedListBox != null) { bool[] arr = new bool[BCheckedListBox.Length]; Array.Copy(bCheckedListBox, arr, bCheckedListBox.Length); clone.BCheckedListBox = arr; } else { clone.BCheckedListBox = null; } return clone; }
public static FilterValue CreateEmptyValue(FilterColumn column) { Type type = column.Type; if (type == typeof(string)) { return new StringFilterValue(); } if (type == typeof(bool) || type == typeof(bool?)) { return new BooleanFilterValue(); } if (type == typeof(int) || type == typeof(int?)) { return new NumberFilterValue() { DataType = typeof(int) }; } if (type == typeof(decimal) || type == typeof(decimal?)) { return new NumberFilterValue() { DataType = typeof(decimal) }; } if (type == typeof(DateTime) || type == typeof(DateTime?)) { return new DateFilterValue(); } if (type.IsEnum || (type.IsGenericType && type.GetGenericTypeDefinition().FullName == "System.Nullable`1" && type.GenericTypeArguments[0].IsEnum)) { var val = new EnumFilterValue(); Type t = type; if (type.IsGenericType && type.GetGenericTypeDefinition().FullName == "System.Nullable`1" && type.GenericTypeArguments[0].IsEnum) { t = type.GenericTypeArguments[0]; } val.HandleEnumTypeChanged(t); return val; } return null; }
/// <summary> /// Конструктор /// </summary> public QueryGridEnumFilter() { InitializeComponent(); value = new EnumFilterValue(); dataTypeChanged += new EventHandler(QueryGridEnumColumnFilter_dataTypeChanged); InternalValuesToExternalValues(); }