Example #1
0
        public EntityFilter(Type specType)
        {
            ColumnFilters = new Dictionary <string, ColumnFilter>();
            // заполняем словарь - имя свойства - натравленный фильтр на него ColumnFilter
            foreach (var property in specType.GetProperties())
            {
                foreach (var attr in property.GetCustomAttributes(true).Where(customAttribute =>
                                                                              customAttribute is EntityFilterAttribute != false).Cast <EntityFilterAttribute>())
                {
                    var crit = attr.EnabledCriterias;
                    if (attr.EnabledCriterias == ColumnFilterCriteria.Нет)
                    {
                        crit = EntityFilter.DeriveCriteriasFromType(property.PropertyType);
                    }

                    ColumnFilters.Add(property.Name, new ColumnFilter(attr.Title, attr.Category ?? String.Empty,
                                                                      property, crit,
                                                                      attr.EnabledValues.ToArray(), attr.CheckAuto));
                }
            }
        }
 public FilterPropertiesDlg(EntityFilter filter)
 {
     this.filter = filter;
     InitializeComponent();
 }
 public FilterPropertiesDlg()
 {
     filter = new EntityFilter(null);
     InitializeComponent();
 }
        private void ФильтрToolStripMenuItemClick(object sender, EventArgs e)
        {
            var dlg = new FilterPropertiesDlg(filterHistoryPos);
            if (dlg.ShowDialog() != DialogResult.OK) return;
            filterHistoryPos = dlg.filter;

            historyGrid.DataBind(ordersList.Where(filterHistoryPos.PredicateFunc).ToList());
            historyGrid.CheckSize(true);
        }
        public AccountHistoryControl()
        {
            filterHistoryPos = new EntityFilter(typeof(MarketOrder));

            InitializeComponent();

            SetupGrid();
        }