public void ProcessFilterQueryListViewItemSelectedIsTrueAndFilterContainEntityLogicalName() { string inputEntityLogicalName = "contact"; bool listViewItemIsSelected = true; var inputFilterQuery = new Dictionary <string, string> { { inputEntityLogicalName, inputEntityLogicalName } }; NotificationServiceMock.Setup(x => x.DisplayFeedback(It.IsAny <string>())) .Verifiable(); var currentfilter = inputFilterQuery[inputEntityLogicalName]; using (var filterDialog = new FilterEditor(currentfilter, System.Windows.Forms.FormStartPosition.CenterParent)) { filterDialog.QueryString = "< filter type =\"and\" > < condition attribute =\"sw_appointmentstatus\" operator=\"eq\" value=\"266880017\" /></ filter >"; FluentActions.Invoking(() => systemUnderTest.ProcessFilterQuery(NotificationServiceMock.Object, null, inputEntityLogicalName, listViewItemIsSelected, inputFilterQuery, filterDialog)) .Should() .NotThrow(); } NotificationServiceMock.Verify(x => x.DisplayFeedback(It.IsAny <string>()), Times.Never); }
public void ProcessFilterQueryListViewFilterDialogQueryStringIsEmpty() { string inputEntityLogicalName = "contact"; bool listViewItemIsSelected = true; Dictionary <string, string> inputFilterQuery = new Dictionary <string, string> { { inputEntityLogicalName, inputEntityLogicalName } }; NotificationServiceMock.Setup(x => x.DisplayFeedback(It.IsAny <string>())) .Verifiable(); var currentfilter = inputFilterQuery[inputEntityLogicalName]; using (var filterDialog = new FilterEditor(currentfilter, System.Windows.Forms.FormStartPosition.CenterParent)) { filterDialog.QueryString = string.Empty; FluentActions.Invoking(() => systemUnderTest.ProcessFilterQuery(NotificationServiceMock.Object, null, inputEntityLogicalName, listViewItemIsSelected, inputFilterQuery, filterDialog)) .Should() .NotThrow(); } NotificationServiceMock.Verify(x => x.DisplayFeedback(It.IsAny <string>()), Times.Never); }
private void InitForms() { // Apply default filter - show only invoices with discount _filterForm = new FilterEditor(c1FlexGrid1); var expression = new CombinationExpression(); expression.Expressions.Add(new OperationExpression() { PropertyName = "Discount", FilterOperation = FilterOperation.GreaterThan, Value = 0 }); _filterForm.SetExpression(expression); // Apply default rule - bold text for major invoice records _rulesForm = new ConditionalFormattingForm(c1FlexGrid1); var rule = new C1.Win.RulesManager.Rule() { Name = "Major Invoices", Expression = "=[ExtendedPrice] > 1000", Style = new ItemStyle() { FontStyle = FontStyle.Bold } }; _rulesForm.Rules.Add(rule); }
private void ButtonAddFilter_Click(object sender, EventArgs e) { FilterEditor editor = new FilterEditor(null); editor.FilterResult += (result) => listBoxFilters.Items.Add(result); editor.ShowDialog(); }
public void FilterContainsFetchXml() { var currentfilter = "< filter type =\"and\" > < condition attribute =\"sw_appointmentstatus\" operator=\"eq\" value=\"266880017\" /></ filter >"; using (var systemUnderTest = new FilterEditor(currentfilter, System.Windows.Forms.FormStartPosition.CenterParent)) { systemUnderTest.Filter.Should().Be(currentfilter); } }
public void FilterZeroLengthFilter() { string currentfilter = string.Empty; using (var systemUnderTest = new FilterEditor(currentfilter, System.Windows.Forms.FormStartPosition.CenterParent)) { systemUnderTest.Filter.Should().Be(currentfilter); systemUnderTest.QueryString.Should().BeNullOrEmpty(); } }
public void FilterAppliesTrim() { string currentfilter = " TestValue "; using (var systemUnderTest = new FilterEditor(currentfilter, System.Windows.Forms.FormStartPosition.CenterParent)) { systemUnderTest.Filter.Should().Be("TestValue"); systemUnderTest.QueryString.Should().BeNullOrEmpty(); } }
private void TabStripFiltersClick(object sender, EventArgs e) { var currentFilter = filterQuery.ContainsKey(entityLogicalName) ? filterQuery[entityLogicalName] : null; using (var filterDialog = new FilterEditor(currentFilter, FormStartPosition.CenterParent)) { var controller = new ListController(); controller.ProcessFilterQuery(NotificationService, ParentForm, entityLogicalName, lvEntities.SelectedItems.Count > 0, filterQuery, filterDialog); } }
public void FilterContainsNoLessThanCharacter() { string currentfilter = "TestValue"; using (var systemUnderTest = new FilterEditor(currentfilter, System.Windows.Forms.FormStartPosition.CenterParent)) { systemUnderTest.Filter.Should().Be(currentfilter); systemUnderTest.QueryString.Should().BeNullOrEmpty(); } }
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(); } } }
public void ProcessFilterQueryNoListViewItemSelected() { string inputEntityLogicalName = "contact"; bool listViewItemIsSelected = false; Dictionary <string, string> inputFilterQuery = new Dictionary <string, string>(); NotificationServiceMock.Setup(x => x.DisplayFeedback(It.IsAny <string>())) .Verifiable(); using (var filterDialog = new FilterEditor(null, System.Windows.Forms.FormStartPosition.CenterParent)) { FluentActions.Invoking(() => systemUnderTest.ProcessFilterQuery(NotificationServiceMock.Object, null, inputEntityLogicalName, listViewItemIsSelected, inputFilterQuery, filterDialog)) .Should() .NotThrow(); } NotificationServiceMock.Verify(x => x.DisplayFeedback(It.IsAny <string>()), Times.Once); }
/// <summary> /// Launch the filter editor in a new window. /// </summary> internal void LaunchFilterEditor() { if (!_isEditorLaunched) { _isEditorLaunched = true; _filterEditorWindow = new FilterEditor(); _filterEditorWindow.Closed += (s, e) => { _isEditorLaunched = false; Filters = null; }; _filterEditorWindow.Show(); } else { if (_filterEditorWindow.WindowState == WindowState.Minimized) { _filterEditorWindow.WindowState = WindowState.Normal; } _filterEditorWindow.Focus(); } }
/// <summary> /// Launch the filter editor in a new window. /// </summary> internal void LaunchFilterEditor() { if (!_isEditorLaunched) { _isEditorLaunched = true; _filterEditorWindow = new FilterEditor(); _filterEditorWindow.Closed += (s, e) => { _isEditorLaunched = false; Filters = null; }; _filterEditorWindow.Show(); } else { if (_filterEditorWindow.WindowState == WindowState.Minimized) _filterEditorWindow.WindowState = WindowState.Normal; _filterEditorWindow.Focus(); } }
public void ButtonManageFiltersClick(Office.IRibbonControl control) { var dlg = new FilterEditor(); ShowModalWindow(dlg); }
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"); } }