Exemple #1
0
        private void ButtonAddFilter_Click(object sender, EventArgs e)
        {
            FilterEditor editor = new FilterEditor(null);

            editor.FilterResult += (result) => listBoxFilters.Items.Add(result);
            editor.ShowDialog();
        }
Exemple #2
0
        private void c1FlexGrid1_ColumnContextMenuOpening(object sender, C1.Win.C1FlexGrid.ColumnContextMenuOpeningEventArgs e)
        {
            // Update column context menu only for non-fixed columns
            if (e.Col >= c1FlexGrid1.Cols.Fixed)
            {
                var items = e.ContextMenuStrip.Items;

                // Add new separator menu item
                items.Add(new ToolStripSeparator());

                // Add new conditional formatting menu item
                var rulesItem = new ToolStripMenuItem("Conditional Formatting");
                rulesItem.Click += (s, eargs) => _rulesForm.ShowDialog();
                if (!_rulesForm.IsEmpty)
                {
                    rulesItem.Image = _checkedImage;
                }
                items.Add(rulesItem);

                // Add new data filter menu item
                var filterItem = new ToolStripMenuItem("Filter");
                filterItem.Click += (s, eargs) => _filterForm.ShowDialog();
                if (!_filterForm.IsEmpty)
                {
                    filterItem.Image = _checkedImage;
                }
                items.Add(filterItem);
            }
        }
Exemple #3
0
        public void ProcessFilterQuery(INotificationService notificationService, Form parentForm, string inputEntityLogicalName, bool listViewItemIsSelected, Dictionary <string, string> inputFilterQuery, FilterEditor filterDialog)
        {
            if (listViewItemIsSelected)
            {
                if (parentForm != null)
                {
                    filterDialog.ShowDialog(parentForm);
                }

                if (inputFilterQuery.ContainsKey(inputEntityLogicalName))
                {
                    if (string.IsNullOrWhiteSpace(filterDialog.QueryString))
                    {
                        inputFilterQuery.Remove(inputEntityLogicalName);
                    }
                    else
                    {
                        inputFilterQuery[inputEntityLogicalName] = filterDialog.QueryString;
                    }
                }
                else
                {
                    if (!string.IsNullOrWhiteSpace(filterDialog.QueryString))
                    {
                        inputFilterQuery[inputEntityLogicalName] = filterDialog.QueryString;
                    }
                }
            }
            else
            {
                notificationService.DisplayFeedback("Entity list is empty");
            }
        }
Exemple #4
0
        private void ListBoxFilters_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            Filter       selectedFilter = listBoxFilters.SelectedItem as Filter;
            FilterEditor editor         = new FilterEditor(selectedFilter);

            editor.FilterResult += (result) =>
            {
                int index = listBoxFilters.SelectedIndex;
                listBoxFilters.Items.Remove(selectedFilter);
                listBoxFilters.Items.Insert(index, result);
            };
            editor.ShowDialog();
        }
        public void InterpretCommand(ITagModuleScreen moduleScreen, string command)
        {
            var prefix = Url.Prefix(command);

            switch (prefix)
            {
            case BackToTemplateCommand:
            {
                moduleScreen.SwitchToModule(new MainProjectScreen(_project, -1));
                break;
            }

            case AddNewFilterCommand:
            {
                AddNewFilter();
                moduleScreen.ShowPage(StartScreen());
                break;
            }

            case DeleteFilterCommand:
            {
                var name = Url.GetValueFromQuery(command, "filter");
                DeleteFilter(name);
                moduleScreen.ShowPage(StartScreen());
                break;
            }

            case EditFilterCommand:
            {
                var name = Url.GetValueFromQuery(command, "filter");
                if (string.IsNullOrWhiteSpace(name))
                {
                    return;
                }

                _stateChange = StateChangePermission.NotAllowed;
                var ed = new FilterEditor(this, _project, name, null);
                ed.ShowDialog();

                _project.Reload();
                moduleScreen.ShowPage(StartScreen());
                break;
            }

            default:
                throw new Exception($"Unhandled command: {command}");
            }
        }
        private void btnFilter_Click(object sender, EventArgs e)
        {
            if (lvEntities.SelectedItems.Count > 0)
            {
                var entityitem = lvEntities.SelectedItems[0];

                if (entityitem != null && entityitem.Tag != null)
                {
                    var filter       = string.Empty;
                    var entity       = (EntityMetadata)entityitem.Tag;
                    var filterDialog = new FilterEditor(filter = settings[organisationid][entity.LogicalName].Filter);
                    filterDialog.ShowDialog(ParentForm);
                    settings[organisationid][entity.LogicalName].Filter = filterDialog.Filter;
                    InitFilter();
                }
            }
        }