Пример #1
0
        //добавление нового
        private DateFromToFilter AddDateFromTo()
        {
            if (!fDateFromTo.CheckValues())
            {
                return(null);
            }

            DateFromToFilter dftf = new DateFromToFilter(_currentItem, fDateFromTo.FromValue, fDateFromTo.ToValue, _current);

            return(dftf);
        }
Пример #2
0
        //реакция на тычок по созданному фильтру
        private void lbFilters_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (lbFilters.SelectedIndex < 0)
            {
                btnChange.Enabled = false;
                return;
            }
            else
            {
                btnChange.Enabled = true;
            }

            //если жмут по стрелкам, ничего не происходит
            if (flag)
            {
                flag = false;
                return;
            }

            object obj = lbFilters.SelectedItem;

            if (obj is Bracket)
            {
                btnUp.Enabled = btnDown.Enabled = false;
            }
            else
            {
                btnUp.Enabled = btnDown.Enabled = true;
            }

            if (!(obj is Filter))
            {
                return;
            }

            Filter filter = obj as Filter;

            //проставили в комбик нужный фильтр
            cmbFilters.SelectedIndex = filter.NumInList;

            if (filter is BoolFilter)
            {
                BoolFilter bf = filter as BoolFilter;
                fBool.Value = bf.Value;
            }
            else if (filter is DateFromToFilter)
            {
                DateFromToFilter dftf = filter as DateFromToFilter;

                fDateFromTo.FromValue = dftf.FromValue;
                fDateFromTo.ToValue   = dftf.ToValue;
            }
            else if (filter is FromToFilter)
            {
                FromToFilter ftf = filter as FromToFilter;

                fFromTo.FromValue = ftf.FromValue;
                fFromTo.ToValue   = ftf.ToValue;
            }
            else if (filter is MultiSelectFilter)
            {
                MultiSelectFilter msf = filter as MultiSelectFilter;

                FillMulti();
                fMult.FillList(msf.List, false);

                foreach (ListItem li in msf.List)
                {
                    fMult.RemoveAtRight(li.Name);
                }
            }
            else if (filter is TextFilter)
            {
                TextFilter tf = filter as TextFilter;

                fText.Text = tf.Value;
            }
            else if (filter is MultiFromToFilter)
            {
                MultiSelectFilter msf = (filter as MultiFromToFilter).MultiSelectFilter;

                FillMulti();
                fMult.FillList(msf.List, false);

                foreach (ListItem li in msf.List)
                {
                    fMult.RemoveAtRight(li.Name);
                }

                FromToFilter ftf = (filter as MultiFromToFilter).FromtoFilter;

                fFromTo.FromValue = ftf.FromValue;
                fFromTo.ToValue   = ftf.ToValue;
            }
        }