Exemple #1
0
        private string CheckBoxItemClick(FilterPopupItem item,
            ref object filterValue, ref object filterDisplayValue)
        {
            CheckBoxX cb = _GridColumn.EditControl as CheckBoxX;

            if (cb != null)
            {
                string s1;

                switch ((CheckState)item.Value)
                {
                    case CheckState.Checked:
                        s1 = cb.CheckValueChecked != null
                            ? cb.CheckValueChecked.ToString() : "true";
                        break;

                    case CheckState.Unchecked:
                        s1 = cb.CheckValueUnchecked != null
                            ? cb.CheckValueUnchecked.ToString() : "false";
                        break;

                    default:
                        s1 = cb.CheckValueIndeterminate != null
                            ? cb.CheckValueIndeterminate.ToString() : "";
                        break;
                }

                filterValue = item.Value;
                filterDisplayValue = item.Text;

                return ("[" + _GridColumn.Name + "] = \"" + s1 + "\"");
            }
            
            if (_GridColumn.EditControl is GridSwitchButtonEditControl)
            {
                GridSwitchButtonEditControl sw =
                    (GridSwitchButtonEditControl)_GridColumn.EditControl;

                filterValue = item.Value;
                filterDisplayValue = item.Text;

                string s1;

                if ((CheckState)item.Value == CheckState.Checked)
                    s1 = sw.OnValue != null ? sw.OnValue.ToString() : "true";
                else
                    s1 = sw.OffValue != null ? sw.OffValue.ToString() : "false";

                return ("[" + _GridColumn.Name + "] = \"" + s1 + "\"");
            }

            return (null);
        }
Exemple #2
0
        private string ComboItemClick(FilterPopupItem item,
            ref object filterValue, ref object filterDisplayValue)
        {
            ComboBox cbx = _GridColumn.EditControl as ComboBox;

            if (cbx != null)
            {
                cbx.SelectedIndex = (int)item.Value;

                string s1 = cbx.Text;

                if (cbx.DataSource != null)
                    s1 = cbx.SelectedValue.ToString();

                if (string.IsNullOrEmpty(s1) == false)
                {
                    filterValue = s1;
                    filterDisplayValue = item.Text;

                    return ("[" + _GridColumn.Name + "] = \"" + s1 + "\"");
                }
            }

            return (null);
        }
Exemple #3
0
        private void LoadDefaultItems()
        {
            _VisButtonItem = null;

            ItemPanel itemPanel = GetBaseItemPanel();

            LoadCustomFilterItems(itemPanel);

            if (_GridColumn.FilterAutoScan == true)
            {
                List<object> list = GetScanItems();

                if (list != null)
                {
                    int n = Math.Min(list.Count, _GridColumn.FilterPopupMaxItems);

                    for (int i = 0; i < n; i++)
                    {
                        object o = list[i];

                        FilterPopupItem fpi;

                        if (o is DateTime)
                        {
                            DateTime dt = (DateTime)o;
                            dt = dt.Date;

                            string s = dt.Date.ToShortDateString();

                            fpi = new FilterPopupItem(s, s, FilterItemType.ScanDateEntry, dt);
                        }
                        else
                        {
                            string s = o.ToString();

                            fpi = new FilterPopupItem(s, s, FilterItemType.ScanTextEntry, o);
                        }

                        if (i == 0)
                            fpi.BeginGroup = true;

                        if (fpi.Text.Equals(_GridColumn.FilterDisplayValue) == true)
                        {
                            fpi.FontBold = true;

                            _VisButtonItem = fpi;
                        }

                        itemPanel.Items.Add(fpi);
                    }
                }
            }

            Control = itemPanel;
        }
Exemple #4
0
        private void LoadComboItems()
        {
            _VisButtonItem = null;

            ComboBox cbx = _GridColumn.EditControl as ComboBox;

            if (cbx != null && cbx.Items.Count > 0)
            {
                FilterPopupItem[] items = new FilterPopupItem[cbx.Items.Count];

                for (int i = 0; i < cbx.Items.Count; i++)
                {
                    FilterPopupItem bi = new FilterPopupItem("CbxEntry",
                        cbx.GetItemText(cbx.Items[i]), FilterItemType.ComboBoxEntry,i);

                    items[i] = bi;

                    if (bi.Text.Equals(_GridColumn.FilterDisplayValue) == true)
                    {
                        _VisButtonItem = bi;

                        bi.FontBold = true;
                    }
                }

                ItemPanel itemPanel = GetBaseItemPanel();

                LoadCustomFilterItems(itemPanel);

                if (itemPanel.Items.Count > 0)
                {
                    items[0].BeginGroup = true;

                    itemPanel.Items.AddRange(items);
                }

                Control = itemPanel;
            }
        }
Exemple #5
0
        private void LoadCheckBoxItems()
        {
            FilterPopupItem[] items = null;

            CheckBoxX cb = _GridColumn.EditControl as CheckBoxX;

            if (cb != null)
            {
                items = new FilterPopupItem[(cb.ThreeState == true) ? 3 : 2];

                items[0] = new FilterPopupItem("CbEntry", "Checked",
                    FilterItemType.CheckBoxEntry, CheckState.Checked);

                items[1] = new FilterPopupItem("CbEntry", "Unchecked",
                    FilterItemType.CheckBoxEntry, CheckState.Unchecked);

                if (cb.ThreeState == true)
                {
                    items[2] = new FilterPopupItem("CbEntry", "Indeterminate",
                        FilterItemType.CheckBoxEntry, CheckState.Indeterminate);
                }
            }
            else if (_GridColumn.EditControl is GridSwitchButtonEditControl)
            {
                GridSwitchButtonEditControl sw =
                    (GridSwitchButtonEditControl)_GridColumn.EditControl;

                items = new FilterPopupItem[2];

                items[0] = new FilterPopupItem("SwEntry", sw.OnText,
                    FilterItemType.CheckBoxEntry, CheckState.Checked);

                items[1] = new FilterPopupItem("SwEntry", sw.OffText,
                    FilterItemType.CheckBoxEntry, CheckState.Unchecked);
            }

            ItemPanel itemPanel = GetBaseItemPanel();

            LoadCustomFilterItems(itemPanel);

            if (items != null)
            {
                if (itemPanel.Items.Count > 0)
                    items[0].BeginGroup = true;

                itemPanel.Items.AddRange(items);
            }

            Control = itemPanel;
        }
Exemple #6
0
        private void LoadCustomFilterItems(ItemPanel itemPanel)
        {
            bool firstItem = true;

            if (_GridColumn.SuperGrid.FilterUseExtendedCustomDialog == true)
            {
                List<UserFilterData> filterData =
                    FilterUserData.GetFilterData(_GridColumn.GridPanel);

                foreach (UserFilterData fd in filterData)
                {
                    if (fd.ReferNames.Contains(_GridColumn.Name) == true)
                    {
                        FilterPopupItem fpi = new
                            FilterPopupItem(fd.Name, fd.Name, FilterItemType.UserEntry, fd.Expression);

                        if (string.IsNullOrEmpty(fd.Description) == false)
                            fpi.Tooltip = fd.Description;

                        if (firstItem == true)
                        {
                            firstItem = false;

                            AddBaseItem(itemPanel, "Custom",
                                _GridColumn.SuperGrid.FilterCustomString, FilterItemType.Custom, "...");

                            int n = itemPanel.Items.Count - 1;

                            if (n > 0)
                                itemPanel.Items[n].BeginGroup = true;
                        }

                        if (fd.Expression.Equals(_GridColumn.FilterDisplayValue) == true)
                            fpi.FontBold = true;

                        itemPanel.Items.Add(fpi);
                    }
                }
            }

            if (firstItem == true)
            {
                AddBaseItem(itemPanel, "Custom",
                    _GridColumn.SuperGrid.FilterCustomString, FilterItemType.Custom, "...");
            }
        }