void IPulsarBinder.ApplyFilter(PulsarFilterConditions condition, IEnumerable variants)
		{
			throw new NotImplementedException();
		}
		void IPulsarBinder.ApplyFilter(string propName, PulsarFilterConditions condition, object variant)
		{
			throw new NotImplementedException();
		}
Exemple #3
0
		/// <summary>
		/// Устанавливает фильтрацию списка.
		/// </summary>
		/// <param name="propName">Наименование свойства, по которому устанавливается фильтрация.</param>
		/// <param name="condition">Условие фильтрации.</param>
		/// <param name="variants">Список вариантов значения свойства.</param>
		public void ApplyFilter(string propName, PulsarFilterConditions condition, IEnumerable variants)
		{
			if(variants is string)
				variants = new object[1] { variants };

			filterMethod = null;

				
			Type t = itemType;
			if(t == null)
			{
				t = List.GetType();
				if(t.IsGenericType == false)
					throw new Exception("Метод Sort по указанному свойству не поддерживается для не generic коллекций!");
				t = t.GetGenericArguments()[0];
			}

			PropertyDescriptor d = null;
			if(t.IsValueType || t == typeof(String))
				d = new PrimitiveValuePropertyDescriptor(t);
			else
			{
				PropertyDescriptorCollection props = TypeDescriptor.GetProperties(t);
				if(props.Count == 0)
					throw new Exception("Класс элемента списка не имеет публичных свойств!");
				d = props.Find(propName, false);
			}
			if(d == null)
				throw new ArgumentException(String.Format("У типа \"{1}\" отсутствует публичное свойство \"{0}\"!", propName,
																																															t.FullName), "propName");
			filter = new ValuesTrio<PropertyDescriptor, PulsarFilterConditions, IEnumerable>(d, condition,
				variants ?? new List<object>());
			Refresh();
		}
Exemple #4
0
		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Устанавливает фильтрацию списка.
		/// </summary>
		/// <param name="condition">Условие фильтрации.</param>
		/// <param name="variants">Список вариантов значений списка.</param>
		public void ApplyFilter(PulsarFilterConditions condition, IEnumerable variants)
		{
			filter = new ValuesTrio<PropertyDescriptor, PulsarFilterConditions, IEnumerable>(null, condition,
				variants ?? new List<object>());
			Refresh();
		}
Exemple #5
0
		//-------------------------------------------------------------------------------------
		/// <summary>
		/// Устанавливает фильтрацию списка.
		/// </summary>
		/// <param name="propName">Наименование свойства, по которому устанавливается фильтрация.</param>
		/// <param name="condition">Условие фильтрации.</param>
		/// <param name="variant">Вариант значения свойства.</param>
		public void ApplyFilter(string propName, PulsarFilterConditions condition, object variant)
		{
			if(variant is string == false &&  variant is IEnumerable)
				ApplyFilter(propName, condition, (IEnumerable)variant);
			else
			{ 
				object[] vars = new object[1] { variant };
				ApplyFilter(propName, condition, vars);
			} 
		}