Exemple #1
0
        public TestContextFilter()
        {
            SchemaFilters.AddRange(new List <IFilterType <Schema> >
            {
                // Only include the schemas 'dbo' and 'events'
                new RegexIncludeFilter("^dbo$"),
                new RegexIncludeFilter("^events$")
            });

            TableFilters.AddRange(new List <IFilterType <Table> >
            {
                // Exclude filters
                new RegexExcludeFilter("(.*_FR_.*)|(^data_.*)"), // Exclude all tables that contain '_FR_' or begin with 'data_'
                new RegexExcludeFilter(".*[Bb]illing.*"),        // This excludes all tables with 'billing' anywhere in the name

                // Include filters
                new RegexIncludeFilter("^[Cc]ustomer.*"), // This includes any remaining tables with names beginning with 'customer'
                new RegexIncludeFilter("^Order.*"),       // This includes any remaining tables with names beginning with 'customer'
            });

            ColumnFilters.AddRange(new List <IFilterType <Column> >
            {
                // Exclude any columns that begin with 'FK_'
                new RegexExcludeFilter("^FK_.*$"),
            });
        }
Exemple #2
0
        protected void addFilterCommand(ServerColumnFilter newFilter)
        {
            //Update the filter collection
            if (ColumnFilters == null)
            {
                //Initiate the collection with the filter
                ColumnFilters = new List <ServerColumnFilter> {
                    newFilter
                };
            }
            else
            {
                //See if there is already an entry for this column
                var oldfilter = ColumnFilters.FirstOrDefault(f => f.ColumnName == newFilter.ColumnName);
                if (oldfilter != null)
                {
                    if (string.IsNullOrEmpty(newFilter.FilterText))
                    {
                        ColumnFilters.Remove(oldfilter);
                    }
                    else
                    {
                        oldfilter.FilterText = newFilter.FilterText;
                    }
                }
                else
                {
                    columnFilters.Add(newFilter);
                }
            }

            //Send it to the server
            UpdateDataStream();
        }
        private void NotifyFilterChanged()
        {
            var checkedFilters = ColumnFilters.Where(f => f.IsChecked).ToArray();

            _processor.SetFilters(checkedFilters);

            if (FilterChanged != null)
            {
                FilterChanged(this, EventArgs.Empty);
            }
        }
Exemple #4
0
 public override int GetHashCode()
 {
     unchecked
     {
         int result = Text == null ? 0 : Text.GetHashCode();
         result = (result * 397) ^ CaseSensitive.GetHashCode();
         result = (result * 397) ^ ColumnFilters.GetHashCode();
         result = (result * 397) ^ ColumnSorts.GetHashCode();
         return(result);
     }
 }
Exemple #5
0
        /// <summary>
        /// Resets the filter settings
        /// </summary>
        public static void ResetFilters()
        {
            // Clear any active filter queries
            filters    = string.Empty;
            secFilters = string.Empty;

            // Reset the advance filters
            AdvancedFilters.Reset();

            // Reset the column filters
            ColumnFilters.Reset();

            // Reset the date filters
            DateFilters.Reset();
        }
Exemple #6
0
        /// <summary>
        /// Creates instance of the <see cref="FastWindowGridModel&lt;T&gt;"/>
        /// </summary>
        public FastWindowGridModel(int rowCount)
        {
            RowCount = rowCount;

            //Store the column names via reflection
            ColumnPropertyInfoList = typeof(T).GetProperties().ToList();
            for (var i = 0; i < ColumnPropertyInfoList.Count; i++)
            {
                //Store the display and server column name
                var attribs = ColumnPropertyInfoList[i].GetCustomAttributes(typeof(ColumnNameAttribute)).ToList();
                if (attribs.Any())
                {
                    var attrib = (ColumnNameAttribute)attribs.First();
                    ColumnNameList.Add(attrib.DisplayName);
                    ServerNameList.Add(attrib.ServerName);
                }
                else
                {
                    var name = ColumnPropertyInfoList[i].Name;
                    ColumnNameList.Add(name);
                    ServerNameList.Add(name);
                }

                //See if there is a width override
                attribs = ColumnPropertyInfoList[i].GetCustomAttributes(typeof(ColumnWidthAttribute)).ToList();
                if (attribs.Any())
                {
                    var attrib = (ColumnWidthAttribute)attribs.First();
                    ColumnWidthOverrides[i] = attrib.Width;
                }
            }

            ColumnCount = ColumnPropertyInfoList.Count;

            //Fill the default filter strings
            for (var i = 0; i < ColumnCount; i++)
            {
                ColumnFilters.Add(string.Empty);
            }

            //Fill the grid with blank rows
            ClearGridRows(0, true);
        }
Exemple #7
0
        /// <summary>
        /// Send call to the server to open the stream if the connection is open and
        /// unpaused; otherwise store the call to use when the connection is (re)established.
        /// </summary>
        /// <returns>Await <see cref="Task"/></returns>
        protected async Task CallForDataStream()
        {
            //Need a dynamic object to properly format the json string
            var filters = new ExpandoObject();

            if (ColumnFilters != null && ColumnFilters.Any())
            {
                var filtersDict = (IDictionary <string, object>)filters;
                foreach (var filter in ColumnFilters)
                {
                    filtersDict.Add(filter.ColumnName, filter);
                }
            }

            //Create the arg list to send to the sever
            var args = new List <object>
            {
                ScrolledRowNumber,
                ScrolledRowNumber + PageRowCount,
                sortDirection.ToString().ToUpper(),
                SortColumnName,
                filters
            };

            var call = new ServerCall(currentId++, ordersStreamCall, args);

            //If the connection is not in a ready state store the call for when it is; otherwise commit
            if (connection.State != WebSocketState.Open || connection.IsUpdatePaused)
            {
                connection.StoreNextServerCall(call);
            }
            else
            {
                IsStreamPaused = true;
                await connection.Send(call);

                //Resume connection update but do not unpause stream until the next orders received event.
                connection.ResumeUpdate();
            }
        }
Exemple #8
0
        public override TableOutput Build()
        {
            //// Setup initial variables for processing
            _allTableColumns = GetAllTableColumnsForTable();

            //// When the default column is null, this should get the initial display columns
            var displayColumnRequested = ColumnIdsRequestedValue == null
                ? GetInitialColumns(_allTableColumns.ToList())
                : GetDisplayColumnRequested(ColumnIdsRequestedValue).ToList();

            var itemsToSort = GetItemsToSort();

            ColumnFilters?.ForEach((filter) =>
            {
                itemsToSort = ProcessFilter(itemsToSort, filter);
            });

            var totalItems    = itemsToSort.Count();
            var sortedDisplay = ProcessSortAndPagination(itemsToSort);

            var rowSummary = sortedDisplay
                             .Select(owc => new TableRow
            {
                Id    = GetId(owc),
                Cells = displayColumnRequested.Select(cr => cr.GetValueAsString(owc)).ToList()
            }).ToList();

            var displayColumnDtos = displayColumnRequested.Select(col => col.GetColumnDefinition()).ToList();

            return(new TableOutput
            {
                Rows = rowSummary,
                Columns = displayColumnDtos,
                TotalItems = totalItems
            });
        }
Exemple #9
0
        public IEnumerable <ColumnFilter> GetColumnFilters(DataPropertyDescriptor propertyDescriptor)
        {
            var columnId = ColumnId.GetColumnId(propertyDescriptor);

            return(ColumnFilters.Where(columnFilter => Equals(columnId, columnFilter.ColumnId)));
        }