public override FilterResult Filter(FilterSettings settings) { var res = settings.Filter.GetFilterResult(this); if (res.FilterResult != null) return res.FilterResult.Value; return base.Filter(settings); }
public override FilterResult Filter(FilterSettings settings) { if (string.IsNullOrEmpty(settings.SearchTerm)) return FilterResult.MatchAndRecurse; else return FilterResult.Recurse; }
public virtual FilterResult Filter(FilterSettings settings) { if (string.IsNullOrEmpty(settings.SearchTerm)) return FilterResult.Match; else return FilterResult.Hidden; }
public override FilterResult Filter(FilterSettings settings) { if (settings.SearchTermMatches(this.name)) return FilterResult.MatchAndRecurse; else return FilterResult.Recurse; }
public override FilterResult Filter(FilterSettings settings) { if (settings.SearchTermMatches(field.Name) && settings.Language.ShowMember(field)) return FilterResult.Match; else return FilterResult.Hidden; }
public TreeWalker(INode root, FilterSettings settings, NodeFilter filter) { _root = root; _settings = settings; _filter = filter ?? (m => FilterResult.Accept); _current = _root; }
// initialize settings to defaults public RunningTotalsTaskSettings() { VariableGroups = new List<string>(); FilterSettings = new FilterSettings(); DataOut = "WORK.OUT_TOTALS"; VariableMeasure = ""; VariableTotal = ""; }
public override FilterResult Filter(FilterSettings settings) { if (!settings.ShowInternalApi && (r.Attributes & ManifestResourceAttributes.VisibilityMask) == ManifestResourceAttributes.Private) return FilterResult.Hidden; if (settings.SearchTermMatches(r.Name)) return FilterResult.Match; else return FilterResult.Hidden; }
public override FilterResult Filter(FilterSettings settings) { var res = settings.Filter.GetFilterResult(this.Name, ((AssemblyTreeNode)Parent).DnSpyFile); if (res.FilterResult != null) return res.FilterResult.Value; if (settings.SearchTermMatches(name)) return FilterResult.MatchAndRecurse; else return FilterResult.Recurse; }
public override FilterResult Filter(FilterSettings settings) { var res = settings.Filter.GetFilterResult(this); if (res.FilterResult != null) return res.FilterResult.Value; if (string.IsNullOrEmpty(settings.SearchTerm)) return FilterResult.MatchAndRecurse; else return FilterResult.Recurse; }
public NodeIterator(INode root, FilterSettings settings, NodeFilter filter) { _root = root; _settings = settings; _filter = filter ?? (m => FilterResult.Accept); _beforeNode = true; _iterator = _root.GetElements<INode>(settings); _reference = _iterator.First(); }
public override FilterResult Filter(FilterSettings settings) { if (!settings.ShowInternalApi && !IsPublicAPI) return FilterResult.Hidden; if (settings.SearchTermMatches(type.Name)) { if (type.IsNested && !settings.Language.ShowMember(type)) return FilterResult.Hidden; else return FilterResult.Match; } else return FilterResult.Recurse; }
public override FilterResult Filter(FilterSettings settings) { var res = settings.Filter.GetFilterResult(this); if (res.FilterResult != null) return res.FilterResult.Value; if (settings.SearchTermMatches(type.Name)) { if (type.IsNested && !settings.Language.ShowMember(type)) return FilterResult.Hidden; else return FilterResult.Match; } else return FilterResult.Recurse; }
public override FilterResult Filter(FilterSettings settings) { if (!settings.ShowInternalApi && !IsPublicAPI) return FilterResult.Hidden; var searchableName = UnicodeSupport.FormatUnicodeIdentifier(type.Name); if (settings.SearchTermMatches(searchableName)) { if (settings.Language.ShowMember(type)) return FilterResult.Match; else return FilterResult.Hidden; } else { return FilterResult.Recurse; } }
public async Task WhenThereAreIncludesAndExcludes_OnlyConsiderMatchesButRemoveNonMatching() { var updateSets = new List <PackageUpdateSet> { UpdateFoobarFromOneVersion(), UpdateFooFromOneVersion(), UpdateBarFromTwoVersions() }; var settings = new FilterSettings { MaxPullRequests = 10, Excludes = new Regex("bar"), Includes = new Regex("foo") }; var target = new UpdateSelection(settings, Substitute.For <INuKeeperLogger>()); var results = await target.Filter(updateSets, Pass); Assert.That(results.Count, Is.EqualTo(1)); Assert.That(results.First().SelectedId, Is.EqualTo("foo")); }
/// <summary> /// Provides a user-friendly description of the specified filter values. /// </summary> /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param> /// <param name="selection">A formatted string representing the filter settings.</param> /// <returns> /// A string containing the user-friendly description of the settings. /// </returns> public override string FormatSelection(Type entityType, string selection) { var settings = new FilterSettings(selection); string result = GetTitle(null); if (!settings.IsValid) { return(result); } using (var context = new RockContext()) { var dataView = new DataViewService(context).Get(settings.GroupMemberDataViewGuid.GetValueOrDefault()); result = string.Format("Group Memberships in Data View \"{0}\" is {1} {2}", (dataView != null ? dataView.ToString() : string.Empty), settings.MemberCountComparison.ConvertToString(), settings.MemberCount); } return(result); }
public void LoadFromSettings(FilterSettings settings) { var settingsSelectedCategories = settings.Categories.Replace(" ", "") .Split(',') .Where(item => !string.IsNullOrEmpty(item)) .Select(item => Convert.ToInt32(item)) .ToList(); var settingsSelectedSubCategories = settings.SubCategories.Replace(" ", "") .Split(',') .Where(item => !string.IsNullOrEmpty(item)) .Select(item => Convert.ToInt32(item)) .ToList(); if (settingsSelectedCategories.Any()) { CategoriesVisible = true; foreach (var c in PinCategories) { c.ItemSelected = settingsSelectedCategories.Contains(c.Id); } } if (settingsSelectedSubCategories.Any()) { SubCategoriesVisible = true; foreach (var c in PinSubCategories) { c.ItemSelected = settingsSelectedSubCategories.Contains(c.Id); } } MyMarkerSelected = settings.MyMarkerSelected; WifiSelected = settings.WifiSelected; NowOpenSelected = settings.NowOpenSelected; MapRegion = settings.MapRegion; LoadPins(MapRegion); }
/// <summary> /// Gets the selection. /// </summary> /// <param name="entityType">Type of the entity.</param> /// <param name="controls">The controls.</param> /// <param name="filterMode"></param> /// <returns></returns> public override string GetSelection(Type entityType, Control[] controls, FilterMode filterMode) { var settings = new FilterSettings(); if (controls.Length > 0) { var containerControl = controls[0] as DynamicControlsPanel; if (containerControl.Controls.Count >= 1) { // note: since this datafilter creates additional controls outside of CreateChildControls(), we'll use our _controlsToRender instead of the controls parameter GroupTypePicker groupTypePicker = containerControl.Controls[0] as GroupTypePicker; Guid groupTypeGuid = Guid.Empty; var groupTypeId = groupTypePicker.SelectedGroupTypeId; if (containerControl.Controls.Count > 1) { DropDownList ddlProperty = containerControl.Controls[1] as DropDownList; settings.AttributeKey = ddlProperty.SelectedValue; var entityFields = GetGroupMemberAttributes(groupTypeId); var entityField = entityFields.FirstOrDefault(f => f.UniqueName == ddlProperty.SelectedValue); if (entityField != null) { var panelControls = new List <Control>(); panelControls.AddRange(containerControl.Controls.OfType <Control>()); var control = panelControls.FirstOrDefault(c => c.ID.EndsWith(entityField.UniqueName)); if (control != null) { entityField.FieldType.Field.GetFilterValues(control, entityField.FieldConfig, filterMode).ForEach(v => settings.AttributeFilterSettings.Add(v)); } } } } } return(settings.ToSelectionString()); }
private void SaveXml(string fileName) { if (!fileName.EndsWith(".flt.xml")) { if (fileName.Contains(".")) { fileName = fileName.Split('.')[0] + ".flt.xml"; } else { fileName += ".flt.xml"; } } XmlSerializer ser = new XmlSerializer(typeof(FilterSettings)); StreamWriter writer = new StreamWriter(fileName, false); try { FilterSettings container = new FilterSettings(); foreach (L3MessageInfo selectedItem in lstFiltered.SelectedItems) { container.FilteredMessages.Add(selectedItem.Reference); } foreach (string field in lstExcept.SelectedItems) { container.ExceptionFields.Add(field); } ser.Serialize(writer, container); } finally { writer.Close(); } }
public string Translate(FilterSettings stg) { if (stg == null) { throw new ArgumentException("Filter settings is null.", nameof(stg)); } if (string.IsNullOrEmpty(stg.Name)) { if (stg.Expression.Count() > 0) { var e = stg.Expression.ElementAt(0); return(Translate(e)); } else { return(string.Format($"Expression with id: {stg.Id}")); } } else { return(stg.Name); } }
/// <summary> /// Provides a user-friendly description of the specified filter values. /// </summary> /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param> /// <param name="selection">A formatted string representing the filter settings.</param> /// <returns> /// A string containing the user-friendly description of the settings. /// </returns> public override string FormatSelection(Type entityType, string selection) { var settings = new FilterSettings(selection); var relatedEntityName = GetRelatedEntityName(); string result = $"Connected to { relatedEntityName }"; if (!settings.IsValid) { return(result); } using (var context = new RockContext()) { var dataView = new DataViewService(context).Get(settings.DataViewGuid.GetValueOrDefault()); var dataViewName = (dataView != null ? dataView.ToString() : string.Empty); result = $"Is associated with any { relatedEntityName } in Data View: { dataViewName }"; } return(result); }
private FilterDefinition <Document> BuildMatchStage(string author, FilterSettings filterSettings) { var filterList = new List <FilterDefinition <Document> >(); filterList.Add(this.filterBuilder.Where(d => d.Author == author)); if (filterSettings.Tags.Any()) { filterList.Add(this.filterBuilder.All(doc => doc.Tags, filterSettings.Tags)); } if (filterSettings.Values.Any()) { var valueFilter = filterSettings.Values.Select(v => MongoOp.Exists($"Values.{v}")); filterList.Add(new BsonDocument() { { "$or", new BsonArray(valueFilter) } }); } var matchStage = this.filterBuilder.And(filterList); return(matchStage); }
public static void SaveFilterSettings(string userID, string ctrlID, string id, string title, string exchange, string contract, string underlying, string portfolio) { using (var clientCtx = new ClientDbContext()) { var filterinfo = clientCtx.FilterSettings.FirstOrDefault(t => t.Id == id); if (filterinfo == null) { filterinfo = new FilterSettings { Id = id }; //insert new record clientCtx.FilterSettings.Add(filterinfo); } filterinfo.CtrlID = ctrlID; filterinfo.Title = title; filterinfo.Exchange = exchange; filterinfo.Underlying = underlying; filterinfo.Contract = contract; filterinfo.UserID = userID; filterinfo.Portfolio = portfolio; clientCtx.SaveChanges(); } }
public override FilterResult Filter(FilterSettings settings) { var res = settings.Filter.GetFilterResult(this.TypeDefinition); if (res.FilterResult != null) { return(res.FilterResult.Value); } if (settings.SearchTermMatches(type.Name)) { if (settings.Language.ShowMember(type)) { return(FilterResult.Match); } else { return(FilterResult.Hidden); } } else { return(FilterResult.Recurse); } }
/// <summary>Синхронизация объекта</summary> /// <param name="wayOfSync">Способ синхронизации</param> /// <param name="filter">Фильтры</param> private bool SyncObjects <T>(WaysOfSync wayOfSync, FilterSettings filter) where T : dbObject { return(SyncObjects <T>(typeof(T).Name, wayOfSync, filter, false, true)); }
/// <summary> /// Formats the selection. /// </summary> /// <param name="entityType">Type of the entity.</param> /// <param name="selection">The selection.</param> /// <returns></returns> public override string FormatSelection(Type entityType, string selection) { string result = "Steps taken"; var settings = new FilterSettings(selection); if (!settings.IsValid) { return(result); } var dataContext = new RockContext(); // Step Program var stepProgram = this.GetStepProgram(dataContext, settings.StepProgramGuid); if (stepProgram == null) { return(result); } // Step Types List <StepType> stepTypes; if (settings.StepTypeGuids != null) { var stepTypeService = new StepTypeService(dataContext); stepTypes = stepTypeService.Queryable().Where(a => settings.StepTypeGuids.Contains(a.Guid)).ToList(); } else { stepTypes = new List <StepType>(); } // Step Statuses List <StepStatus> stepStatuses; if (settings.StepStatusGuids != null) { var stepStatusService = new StepStatusService(dataContext); stepStatuses = stepStatusService.Queryable().Where(a => settings.StepStatusGuids.Contains(a.Guid)).ToList(); } else { stepStatuses = new List <StepStatus>(); } // Step Campuses List <CampusCache> stepCampuses; if (settings.StepCampusGuids != null) { stepCampuses = CampusCache.All().Where(a => settings.StepCampusGuids.Contains(a.Guid)).ToList(); } else { stepCampuses = new List <CampusCache>(); } result += string.Format(" in Program: {0}", stepProgram.Name); if (stepTypes.Any()) { result += string.Format(", in Step: {0}", stepTypes.Select(a => a.Name).ToList().AsDelimited(",")); } if (stepStatuses.Any()) { result += string.Format(", with Status: {0}", stepStatuses.Select(a => a.Name).ToList().AsDelimited(",")); } // Start Date if (settings.StartedInPeriod != null && settings.StartedInPeriod.Range != TimePeriodRangeSpecifier.All) { result += string.Format(", with Date Started: {0}", settings.StartedInPeriod.GetDescription()); } // Completion Date if (settings.CompletedInPeriod != null && settings.CompletedInPeriod.Range != TimePeriodRangeSpecifier.All) { result += string.Format(", with Date Completed: {0}", settings.CompletedInPeriod.GetDescription()); } if (stepCampuses.Any()) { result += string.Format(", at Campus: {0}", stepCampuses.Select(a => a.Name).ToList().AsDelimited(",")); } return(result); }
/// <summary> /// Gets a formatted string representing the current filter control values. /// </summary> /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param> /// <param name="controls">The collection of controls used to set the filter values.</param> /// <returns> /// A formatted string. /// </returns> public override string GetSelection( Type entityType, Control[] controls ) { var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView ); var ddlCompare = controls.GetByName<RockDropDownList>( _CtlComparison ); var nbValue = controls.GetByName<NumberBox>( _CtlMemberCount ); var settings = new FilterSettings(); settings.PersonDataViewGuid = DataComponentSettingsHelper.GetDataViewGuid( ddlDataView.SelectedValue ); settings.PersonCountComparison = ddlCompare.SelectedValueAsEnum<ComparisonType>( ComparisonType.GreaterThan ); settings.PersonCount = nbValue.Text.AsInteger(); return settings.ToSelectionString(); }
/// <summary> /// Provides a user-friendly description of the specified filter values. /// </summary> /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param> /// <param name="selection">A formatted string representing the filter settings.</param> /// <returns> /// A string containing the user-friendly description of the settings. /// </returns> public override string FormatSelection( Type entityType, string selection ) { var settings = new FilterSettings( selection ); string result = GetTitle( null ); if (!settings.IsValid) { return result; } using (var context = new RockContext()) { var dataView = new DataViewService( context ).Get( settings.PersonDataViewGuid.GetValueOrDefault() ); result = string.Format( "Members matching Person filter \"{0}\" is {1} {2}", ( dataView != null ? dataView.ToString() : string.Empty ), settings.PersonCountComparison.ConvertToString(), settings.PersonCount ); } return result; }
public override Expression GetExpression(RockContext context, MemberExpression entityIdProperty, string selection) { var settings = new FilterSettings(selection); // // 1. Define Candidate Locations // bool useDefaultLocationsFilter = true; // Get the Location Data View that defines the set of candidates from which proximate Locations can be selected. DataView dataView = null; if (settings.DataViewGuid.HasValue) { var dsService = new DataViewService(context); dataView = dsService.Get(settings.DataViewGuid.Value); if (dataView != null) { if (dataView.DataViewFilter == null) { dataView = null; } else { // Verify that the Group Data View does not contain any references to this Data View in any of its components. if (dsService.IsViewInFilter(dataView.Id, dataView.DataViewFilter)) { throw new Exception("Filter issue(s): One of the filters contains a circular reference to the Data View itself."); } } } } // Evaluate the Data View that defines the candidate Locations. var locationService = new LocationService(context); var locationQuery = locationService.Queryable(); if (dataView != null) { var paramExpression = locationService.ParameterExpression; List <string> errorMessages; var whereExpression = dataView.GetExpression(locationService, paramExpression, out errorMessages); if (errorMessages.Any()) { throw new Exception("Filter issue(s): " + errorMessages.AsDelimited("; ")); } locationQuery = locationQuery.Where(paramExpression, whereExpression, null); useDefaultLocationsFilter = false; // Include child groups? //if (true) //{ // var searchGroupKeys = new HashSet<int>(); // var parentGroups = groupQuery.Select(x => x.Id); // foreach (var parentGroupId in parentGroups) // { // var branchKeys = this.GetGroupBranchKeys(groupService, parentGroupId); // searchGroupKeys.UnionWith(branchKeys); // } // groupQuery = groupService.Queryable().Where(x => searchGroupKeys.Contains(x.Id)); //} } if (useDefaultLocationsFilter) { locationQuery = locationQuery.Where(x => !(x.Name == null || x.Name.Trim() == string.Empty)); } // TODO: Remove this locationQuery = locationQuery.Where(x => x.Name == "3149-Mount Waverley" || x.Name == "3140-Lilydale"); //var locationKeys = locationQuery.Select( x => x.Id ); // // 2. Find the Group Locations that are proximate to the candidate Locations and are associated with Family Groups. // var proximateGroupLocationsBaseQuery = new GroupLocationService(context).Queryable(); // Filter for Groups that are Families. var familyGroupTypeGuid = GroupType.GROUPTYPE_FAMILY.AsGuid(); proximateGroupLocationsBaseQuery = proximateGroupLocationsBaseQuery.Where(x => x.Group.GroupType.Guid == familyGroupTypeGuid); // Filter By Location Type. if (settings.LocationTypeGuid.HasValue) { proximateGroupLocationsBaseQuery = proximateGroupLocationsBaseQuery.Where(x => x.GroupLocationTypeValue.Guid == settings.LocationTypeGuid); } // Create Queries to find Family Group Locations that are proximate to each of the candidate Locations, then return a union of the result sets. // We do this to preserve the link between the candidate Location and the Families located near that candidate Location. double proximityInMeters = 0; var locations = locationQuery.ToList(); IQueryable <PersonNearLocationResult> unionQuery = null; foreach (var l in locations) { var groupLocationPredicate = LinqPredicateBuilder.Begin <GroupLocation>(); if (l.GeoPoint != null) { var gp = l.GeoPoint; groupLocationPredicate = groupLocationPredicate.Or(gl => gl.Location.GeoPoint.Distance(gp) <= proximityInMeters); } if (l.GeoFence != null) { var gf = l.GeoFence; groupLocationPredicate = groupLocationPredicate.Or(gl => gl.Location.GeoPoint != null && gl.Location.GeoPoint.Intersects(gf) || gl.Location.GeoPoint.Distance(gf) <= proximityInMeters); groupLocationPredicate = groupLocationPredicate.Or(gl => gl.Location.GeoFence != null && gl.Location.GeoFence.Intersects(gf) || gl.Location.GeoFence.Distance(gf) <= proximityInMeters); } var proximateGroupLocationsQuery = proximateGroupLocationsBaseQuery.Where(groupLocationPredicate); // Return all of the People in the Groups identified in the Group Locations, and the set of candidate Locations their Family Group is associated with. var groupMembersOfProximateLocations = new GroupMemberService(context).Queryable() .Where(gm => proximateGroupLocationsQuery.Select(gl => gl.GroupId).Contains(gm.GroupId)); // // ** This Query produces the correct results. // string locationName = l.ToString(); var personLocationsQuery = new PersonService(context).Queryable() .Where(p => groupMembersOfProximateLocations.Select(gm => gm.PersonId).Contains(p.Id)) .Select(x => new PersonNearLocationResult { Person = x, LocationName = locationName }); //var result5 = personLocationsQuery.ToList(); if (unionQuery == null) { unionQuery = personLocationsQuery; } else { unionQuery = unionQuery.Union(personLocationsQuery); } } //var finalQuery = unionQuery.Select(pnl => unionQuery.Where(uq => uq.Person.Id == pnl.Person.Id).Select(p => p.LocationName)); //var resultUnion = unionQuery.ToList(); var finalQuery = new PersonService(context).Queryable().Select(p => unionQuery.Where(uq => uq.Person.Id == p.Id).Select(x => x.LocationName)); //var result6 = finalQuery.Where( x => x.Any() ).ToList(); // Define the Select Expression containing the field output. var selectExpression = SelectExpressionExtractor.Extract <Model.Person>(finalQuery, entityIdProperty, "p"); return(selectExpression); }
public FilterSelectorConfig(GamesStats stats, FilterSettings settings) { Stats = stats; Settings = settings; }
private IExpression ProcessFilter(XElement elem, FilterSettings settings, PropertyReference prop) { var elemName = elem.Name.LocalName.ToLowerInvariant(); switch (elemName) { case "property": return(settings.ItemCallback(elem.Attribute("query_items_xpath")?.Value) .GetProperty(new[] { elem.Attribute("name")?.Value })); case "constant": if (long.TryParse(elem.Value, out var lng) || double.TryParse(elem.Value, out var dbl) || DateTime.TryParse(elem.Value, out var date)) { return(new ObjectLiteral(elem.Value, prop, _context)); } else if (elem.Value.IndexOf('$') >= 0) { return(ReplaceParameters(elem.Value)); } else { return(new StringLiteral(elem.Value)); } case "count": var path = elem.Element("query_reference_path").Value.Split('/'); var result = new CountAggregate(); foreach (var table in path.Select(s => settings.Joins[s].Right)) { result.TablePath.Add(table); } return(result); case "eq": case "ne": case "gt": case "ge": case "lt": case "le": case "like": var left = ProcessFilter(elem.Elements().First(), settings, prop); var right = ProcessFilter(elem.Elements().ElementAt(1), settings, left as PropertyReference); if (left is CountAggregate cnt && right is IntegerLiteral iLit && Parents(elem) .All(p => string.Equals(p.Name.LocalName, "condition", StringComparison.OrdinalIgnoreCase) || string.Equals(p.Name.LocalName, "and", StringComparison.OrdinalIgnoreCase)) && ((elemName == "gt" && iLit.Value == 0) || (elemName == "ge" && iLit.Value == 1))) { var refPath = elem.Element("count").Element("query_reference_path").Value.Split('/'); foreach (var join in refPath.Select(s => settings.Joins[s])) { join.Type = JoinType.Inner; } return(IgnoreNode.Instance); } switch (elemName) { case "eq": return(new EqualsOperator() { Left = left, Right = right }.Normalize()); case "ne": return(new NotEqualsOperator() { Left = left, Right = right }.Normalize()); case "gt": return(new GreaterThanOperator() { Left = left, Right = right }.Normalize()); case "ge": return(new GreaterThanOrEqualsOperator() { Left = left, Right = right }.Normalize()); case "lt": return(new LessThanOperator() { Left = left, Right = right }.Normalize()); case "le": return(new LessThanOrEqualsOperator() { Left = left, Right = right }.Normalize()); case "like": right = AmlLikeParser.Instance.Parse(right.ToString()); return(new LikeOperator() { Left = left, Right = right }.Normalize()); default: throw new InvalidOperationException(); } case "null": return(new IsOperator() { Left = ProcessFilter(elem.Elements().First(), settings, prop), Right = IsOperand.Null }.Normalize()); case "and": case "or": var children = elem.Elements() .Select(e => ProcessFilter(e, settings, prop)) .ToArray(); if (children.Length < 1) { throw new InvalidOperationException(); } else if (children.Length == 1) { return(children[0]); } else if (string.Equals(elem.Name.LocalName, "and", StringComparison.OrdinalIgnoreCase)) { var expr = new AndOperator() { Left = children[0], Right = children[1] }.Normalize(); for (var i = 2; i < children.Length; i++) { expr = new AndOperator() { Left = expr, Right = children[i] }.Normalize(); } return(expr); } else if (string.Equals(elem.Name.LocalName, "or", StringComparison.OrdinalIgnoreCase)) { var expr = new OrOperator() { Left = children[0], Right = children[1] }.Normalize(); for (var i = 2; i < children.Length; i++) { expr = new OrOperator() { Left = expr, Right = children[i] }.Normalize(); } return(expr); } break; case "not": return(new NotOperator() { Arg = ProcessFilter(elem.Elements().First(), settings, prop) }.Normalize()); case "condition": return(ProcessFilter(elem.Elements().First(), settings, prop)); } throw new InvalidOperationException(); }
public override FilterResult Filter(FilterSettings settings) { return FilterResult.Match; }
/// <summary> /// Gets the elements that satisfy the provided filter settings. /// </summary> /// <typeparam name="T">The type of nodes to obtain.</typeparam> /// <param name="parent">The parent of the nodes to find.</param> /// <param name="filter">The filter settings to apply.</param> /// <returns> /// The filtered list of all descendents from the provided node. /// </returns> public static IEnumerable <T> GetElements <T>(this INode parent, FilterSettings filter) where T : class, INode { return(parent.GetElements <T>(predicate: (node => filter.Accepts(node)))); }
protected override void OnParametersSet() { //determine current column filter settings _filterSettings = new List <ColumnFilterValue>(); if (FilterSettings.IsInitState(Column) && Column.InitialFilterSettings != ColumnFilterValue.Null) { _filterSettings.Add(Column.InitialFilterSettings); } else { _filterSettings.AddRange(FilterSettings.FilteredColumns.GetByColumn(Column)); } _isColumnFiltered = _filterSettings.Any(r => r.FilterType != GridFilterType.Condition); //determine current url: var queryBuilder = new CustomQueryStringBuilder(FilterSettings.Query); var exceptQueryParameters = new List <string> { QueryStringFilterSettings.DefaultTypeQueryParameter, QueryStringFilterSettings.DefaultClearInitFilterQueryParameter }; string pagerParameterName = GetPagerQueryParameterName(((ICGrid)(Column.ParentGrid)).Pager); if (!string.IsNullOrEmpty(pagerParameterName)) { exceptQueryParameters.Add(pagerParameterName); } _url = queryBuilder.GetQueryStringExcept(exceptQueryParameters); _clearInitFilter = FilterSettings.Query.Get(QueryStringFilterSettings.DefaultClearInitFilterQueryParameter); if (Column.Hidden) { _cssStyles = ((GridStyledColumn)Column).GetCssStylesString() + " " + ThStyle; } else { _cssStyles = ((GridStyledColumn)Column).GetCssStylesString(); } _cssClass = ((GridStyledColumn)Column).GetCssClassesString() + " " + ThClass; if (GridComponent.Grid.Direction == GridDirection.RTL) { _cssStyles = string.Concat(_cssStyles, " text-align:right;direction:rtl;").Trim(); } // tables with fixed layout don't need to set up column width on the header if (GridComponent.Grid.TableLayout == TableLayout.Auto) { if (!string.IsNullOrWhiteSpace(Column.Width)) { _cssStyles = string.Concat(_cssStyles, " width:", Column.Width, ";").Trim(); } } List <string> cssFilterClasses = new List <string>(); cssFilterClasses.Add(FilterButtonCss); if (_isColumnFiltered) { cssFilterClasses.Add(FilteredButtonCssClass); } _cssFilterClass = string.Join(" ", cssFilterClasses); List <string> cssSortingClass = new List <string>(); cssSortingClass.Add("grid-header-title"); if (Column.IsSorted) { cssSortingClass.Add("sorted"); cssSortingClass.Add(Column.Direction == GridSortDirection.Ascending ? "sorted-asc" : "sorted-desc"); } _cssSortingClass = string.Join(" ", cssSortingClass); if (Column.FilterEnabled) { FilterWidgetRender = CreateFilterWidgetComponent(); } if (!string.IsNullOrWhiteSpace(Column.Name)) { GridComponent.HeaderComponents.AddParameter(Column.Name, this); } }
public ITreeWalker CreateTreeWalker(INode root, FilterSettings settings = FilterSettings.All, NodeFilter filter = null) { throw new NotImplementedException(); }
public INodeIterator CreateNodeIterator(INode root, FilterSettings settings = FilterSettings.All, NodeFilter filter = null) { throw new NotImplementedException(); }
/// <summary> /// Filters query based on filterDTO that must abbey certain rules. /// Every property from filter has to have /// </summary> /// <typeparam name="T">Domain class</typeparam> /// <typeparam name="B">Filter class</typeparam> /// <param name="query">Query on which filtering will be applied</param> /// <param name="filter">Filter that contains filtering info that will be applied on query</param> /// <param name="settingsList">Custom optional setting that allow changing default filtering settings for different parameter</param> /// <returns></returns> public static IQueryable <T> SetFilters <T, B>(IQueryable <T> query, B filter, List <FilterSettings> settingsList = null) { if (filter == null) { throw new ArgumentNullException("Parameter query is null"); } if (filter == null) { throw new ArgumentNullException("Parameter filter is null"); } var predicate = PredicateBuilder.New <T>(); List <PropertyInfo> properties = GetOrderedPropertyInfoArray <B>(settingsList); foreach (PropertyInfo property in properties) { var value = property.GetValue(filter); var customComparison = PropertyComparisonTypeEnum.Equals; var customCombination = ExpressionCombinationTypeEnum.And; var name = property.Name; var handleType = GetPropertyType(property); FilterSettings settings = null; bool toLower = true; if (settingsList != null) { settings = settingsList.Where(x => x.FilterName == name).ToList().FirstOrDefault(); } if (settings != null) { //if yes then skip this prop if (settings.ExcludeFromFiltering.HasValue && settings.ExcludeFromFiltering.Value == true) { continue; } } string domainName = GetTargetPropertyName <T, B>(property, name); if (settings != null) { if (settings.PropertyComparison != null) { customComparison = settings.PropertyComparison.Value; } if (settings.ExpressionCombination != null) { customCombination = settings.ExpressionCombination.Value; } toLower = settings.ToLower; } predicate = SwitchOnType(handleType, predicate, value, domainName, customComparison, customCombination, property.PropertyType, toLower); } if (predicate.IsStarted) { query = query .Where(predicate) .AsExpandable(); } else { query = query .AsExpandable(); } return(query); }
public void FromXml(string xml) { try { // and use LINQ to parse it back out XDocument doc = XDocument.Parse(xml); XElement filter = doc .Element("RunningTotalsTask") .Element("FilterSettings"); FilterSettings = new FilterSettings(filter.Value); XElement outdata = doc .Element("RunningTotalsTask") .Element("DataOut"); DataOut = outdata.Value; XElement measure = doc .Element("RunningTotalsTask") .Element("MeasureVar"); VariableMeasure = measure.Value; XElement totals = doc .Element("RunningTotalsTask") .Element("TotalsVar"); VariableTotal = totals.Value; XElement groups = doc .Element("RunningTotalsTask") .Element("GroupVariables"); var g = groups.Elements("GroupVariable"); foreach (XElement e in g) { VariableGroups.Add(e.Value); } } catch (XmlException) { // couldn't read the XML content } }
public ITreeWalker CreateTreeWalker(INode root, FilterSettings settings = FilterSettings.All, NodeFilter filter = null) { return(new TreeWalker(root, settings, filter)); }
public override FilterResult Filter(FilterSettings settings) { var res = settings.Filter.GetFilterResult(this.LoadedAssembly, AssemblyFilterType); if (res.FilterResult != null) return res.FilterResult.Value; if (settings.SearchTermMatches(assembly.ShortName)) return FilterResult.Match; else return FilterResult.Recurse; }
/// <summary> /// Creates a new TreeWalker object. /// </summary> /// <param name="root"> /// Is the root Node of this TreeWalker traversal. /// </param> /// <param name="settings"> /// Indicates which nodes to iterate over. /// </param> /// <param name="filter"> /// An optional callback function for filtering. /// </param> /// <returns>The created node TreeWalker.</returns> public ITreeWalker CreateTreeWalker(INode root, FilterSettings settings = FilterSettings.All, NodeFilter filter = null) { return new TreeWalker(root, settings, filter); }
public override FilterResult Filter(FilterSettings settings) { return(FilterResult.Match); }
public NodeIterator CreateNodeIterator(Node root, FilterSettings whatToShow, NodeFilter filter = null) { throw new System.NotImplementedException(); }
public override void WriteEndElement() { var elem = _meta.Count < 1 ? null : _meta.Pop(); var value = _buffer.ToString() ?? ""; _buffer.Length = 0; if (elem is string name) { if (_meta.Peek() is QueryItem item) { switch (elem) { case "alias": item.Alias = value; break; case "item_type": if (_attrBuffer.TryGetValue("keyed_name", out var keyedName)) { item.Type = keyedName; } else if (_attrBuffer.TryGetValue("name", out var type)) { item.Type = type; } else { item.Attributes["typeId"] = value; } break; case "ref_id": item.Attributes["ref_id"] = value; break; case "filter_xml": item.Attributes["filter_xml"] = value; break; case "offset_fetch_xml": var offsetXml = XElement.Parse(value); item.Offset = (int?)offsetXml.Element("option")?.Element("offset"); item.Fetch = (int?)offsetXml.Element("option")?.Element("fetch"); break; } } else if (_meta.Peek() is SelectExpression select) { if (name == "property_name") { item = _meta.OfType <QueryItem>().Last(); select.Expression = new PropertyReference(value, item); } } else if (_meta.Peek() is SortedOrderBy orderBy) { switch (name) { case "property_name": item = _meta.OfType <QueryItem>().Last(); orderBy.Expression = new PropertyReference(value, item); break; case "sort_order": orderBy.SortOrder = int.Parse(value); break; case "sort_order_direction": orderBy.Ascending = value != "desc"; break; } } else if (_meta.Peek() is ParameterReference param) { switch (name) { case "name": param.Name = value; break; case "value": param.DefaultValue = value; break; } } else if (_meta.Peek() is QueryReference queryRef) { switch (name) { case "child_ref_id": queryRef.ChildRefId = value; break; case "filter_xml": queryRef.FilterXml = value; break; case "parent_ref_id": queryRef.ParentRefId = value; break; case "ref_id": queryRef.RefId = value; break; case "start_query_reference_path": queryRef.StartQueryReferencePath = value; break; } } else if (name == "qry_QueryDefinition") { var settings = new FilterSettings() { Items = _items .Where(i => i.Attributes.ContainsKey("ref_id")) .ToDictionary(i => i.Attributes["ref_id"]), }; foreach (var reference in _refs.Where(r => !string.IsNullOrEmpty(r.ParentRefId))) { var parent = settings.Items[reference.ParentRefId]; var child = settings.Items[reference.ChildRefId]; settings.ItemCallback = x => { if (string.Equals(x, "parent::Item", StringComparison.OrdinalIgnoreCase)) { return(parent); } return(child); }; var join = new Join() { Condition = ProcessFilter(XElement.Parse(reference.FilterXml), settings, null), Left = parent, Right = child, Type = JoinType.LeftOuter }; parent.Joins.Add(join); settings.Joins[reference.RefId] = join; } foreach (var i in _items) { if (i.Attributes.TryGetValue("filter_xml", out var filter)) { settings.ItemCallback = x => { if (string.Equals(x, "child::Item", StringComparison.OrdinalIgnoreCase)) { return(i.Joins[0].Right); } return(i); }; i.Attributes.Remove(filter); i.Where = ProcessFilter(XElement.Parse(filter), settings, null); } } var rootRef = _refs.First(r => string.IsNullOrEmpty(r.ParentRefId)); Query = settings.Items[rootRef.ChildRefId]; if (!string.IsNullOrEmpty(rootRef.FilterXml)) { settings.ItemCallback = x => { if (string.Equals(x, "child::Item", StringComparison.OrdinalIgnoreCase)) { return(Query.Joins[0].Right); } return(Query); }; Query.AddCondition(ProcessFilter(XElement.Parse(rootRef.FilterXml), settings, null)); } Query.RebalanceCriteria(); } } }
protected static void ResetFilters() { FilterSettings.Reset(); FilterSettings.AddDefaults(); FilterSettings.CheckSettings(); }
public TreeWalker CreateTreeWalker(Node node, FilterSettings whatToShow = FilterSettings.ShowAll, NodeFilter filter = null) { throw new System.NotImplementedException(); }
/// <summary> /// Creates a Linq Expression that can be applied to an IQueryable to filter the result set. /// </summary> /// <param name="entityType">The type of entity in the result set.</param> /// <param name="serviceInstance">A service instance that can be queried to obtain the result set.</param> /// <param name="parameterExpression">The input parameter that will be injected into the filter expression.</param> /// <param name="selection">A formatted string representing the filter settings.</param> /// <returns> /// A Linq Expression that can be used to filter an IQueryable. /// </returns> public override Expression GetExpression( Type entityType, IService serviceInstance, ParameterExpression parameterExpression, string selection ) { var settings = new FilterSettings( selection ); var context = (RockContext)serviceInstance.Context; // // Define Candidate People. // // Get the Person Data View that defines the set of candidates from which matching Group Members can be selected. var dataView = DataComponentSettingsHelper.GetDataViewForFilterComponent( settings.PersonDataViewGuid, context ); var personService = new PersonService( context ); var personQuery = personService.Queryable(); if (dataView != null) { personQuery = DataComponentSettingsHelper.FilterByDataView( personQuery, dataView, personService ); } var personKeys = personQuery.Select( x => x.Id ); // // Construct the Query to return the list of Groups matching the filter conditions. // var comparisonType = settings.PersonCountComparison; int memberCountValue = settings.PersonCount; var memberCountQuery = new GroupService( context ).Queryable(); var memberCountEqualQuery = memberCountQuery.Where( g => g.Members.Count( gm => personKeys.Contains( gm.PersonId ) ) == memberCountValue ); var compareEqualExpression = FilterExpressionExtractor.Extract<Model.Group>( memberCountEqualQuery, parameterExpression, "g" ) as BinaryExpression; var result = FilterExpressionExtractor.AlterComparisonType( comparisonType, compareEqualExpression, 0 ); return result; }
/// <summary> /// Provides a user-friendly description of the specified filter values. /// </summary> /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param> /// <param name="selection">A formatted string representing the filter settings.</param> /// <returns> /// A string containing the user-friendly description of the settings. /// </returns> public override string FormatSelection( Type entityType, string selection ) { var settings = new FilterSettings( selection ); string result = "Connected to Location"; if (!settings.IsValid) { return result; } using (var context = new RockContext()) { var dataView = new DataViewService( context ).Get( settings.DataViewGuid.GetValueOrDefault() ); string locationTypeName = null; if (settings.LocationTypeGuid.HasValue) { locationTypeName = DefinedValueCache.Read( settings.LocationTypeGuid.Value, context ).Value; } result = string.Format( "Location {0} is in filter: {1}", ( locationTypeName != null ? "type \"" + locationTypeName + "\"" : string.Empty ), ( dataView != null ? dataView.ToString() : string.Empty ) ); } return result; }
/// <summary> /// Sets the filter control values from a formatted string. /// </summary> /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param> /// <param name="controls">The collection of controls used to set the filter values.</param> /// <param name="selection">A formatted string representing the filter settings.</param> public override void SetSelection( Type entityType, Control[] controls, string selection ) { var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView ); var ddlCompare = controls.GetByName<RockDropDownList>( _CtlComparison ); var nbValue = controls.GetByName<NumberBox>( _CtlMemberCount ); var settings = new FilterSettings( selection ); if (!settings.IsValid) { return; } ddlDataView.SelectedValue = DataComponentSettingsHelper.GetDataViewId( settings.PersonDataViewGuid ).ToStringSafe(); ddlCompare.SelectedValue = settings.PersonCountComparison.ConvertToInt().ToString(); nbValue.Text = settings.PersonCount.ToString(); }
/// <summary> /// Creates a Linq Expression that can be applied to an IQueryable to filter the result set. /// </summary> /// <param name="entityType">The type of entity in the result set.</param> /// <param name="serviceInstance">A service instance that can be queried to obtain the result set.</param> /// <param name="parameterExpression">The input parameter that will be injected into the filter expression.</param> /// <param name="selection">A formatted string representing the filter settings.</param> /// <returns> /// A Linq Expression that can be used to filter an IQueryable. /// </returns> /// <exception cref="System.Exception">Filter issue(s): + errorMessages.AsDelimited( ; )</exception> public override Expression GetExpression( Type entityType, IService serviceInstance, ParameterExpression parameterExpression, string selection ) { var settings = new FilterSettings( selection ); var context = (RockContext)serviceInstance.Context; // Get the Location Data View that defines the set of candidates from which proximate Locations can be selected. var dataView = DataComponentSettingsHelper.GetDataViewForFilterComponent( settings.DataViewGuid, context ); // Evaluate the Data View that defines the candidate Locations. var locationService = new LocationService( context ); var locationQuery = locationService.Queryable(); if ( dataView != null ) { locationQuery = DataComponentSettingsHelper.FilterByDataView( locationQuery, dataView, locationService ); } // Get all the Family Groups that have a Location matching one of the candidate Locations. int familyGroupTypeId = GroupTypeCache.Read( SystemGuid.GroupType.GROUPTYPE_FAMILY.AsGuid() ).Id; var groupLocationsQuery = new GroupLocationService( context ).Queryable() .Where( gl => gl.Group.GroupTypeId == familyGroupTypeId && locationQuery.Any( l => l.Id == gl.LocationId ) ); // If a Location Type is specified, apply the filter condition. if (settings.LocationTypeGuid.HasValue) { int groupLocationTypeId = DefinedValueCache.Read( settings.LocationTypeGuid.Value ).Id; groupLocationsQuery = groupLocationsQuery.Where( x => x.GroupLocationTypeValue.Id == groupLocationTypeId ); } // Get all of the Group Members of the qualifying Families. var groupMemberServiceQry = new GroupMemberService( context ).Queryable() .Where( gm => groupLocationsQuery.Any( gl => gl.GroupId == gm.GroupId ) ); // Get all of the People corresponding to the qualifying Group Members. var qry = new PersonService( context ).Queryable() .Where( p => groupMemberServiceQry.Any( gm => gm.PersonId == p.Id ) ); // Retrieve the Filter Expression. var extractedFilterExpression = FilterExpressionExtractor.Extract<Model.Person>( qry, parameterExpression, "p" ); return extractedFilterExpression; }
/// <summary> /// Gets the expression. /// </summary> /// <param name="entityType">Type of the entity.</param> /// <param name="serviceInstance">The service instance.</param> /// <param name="parameterExpression">The parameter expression.</param> /// <param name="selection">The selection.</param> /// <returns></returns> public override Expression GetExpression(Type entityType, IService serviceInstance, ParameterExpression parameterExpression, string selection) { var settings = new FilterSettings(selection); if (!settings.IsValid) { return(null); } var dataContext = ( RockContext )serviceInstance.Context; int stepProgramId = 0; var stepProgram = GetStepProgram(dataContext, settings.StepProgramGuid); if (stepProgram != null) { stepProgramId = stepProgram.Id; } var stepService = new StepService(dataContext); // Filter by Step Program var stepQuery = stepService.Queryable().Where(x => x.StepType.StepProgramId == stepProgramId); // Filter by Step Types if (settings.StepTypeGuids.Count() > 0) { var stepTypeService = new StepTypeService(dataContext); var stepTypeIds = stepTypeService.Queryable() .Where(a => settings.StepTypeGuids.Contains(a.Guid)) .Select(a => a.Id).ToList(); stepQuery = stepQuery.Where(x => stepTypeIds.Contains(x.StepTypeId)); } // Filter by Step Status if (settings.StepStatusGuids.Count() > 0) { var stepStatusService = new StepStatusService(dataContext); var stepStatusIds = stepStatusService.Queryable() .Where(a => settings.StepStatusGuids.Contains(a.Guid)) .Select(a => a.Id).ToList(); stepQuery = stepQuery.Where(x => x.StepStatusId.HasValue && stepStatusIds.Contains(x.StepStatusId.Value)); } // Filter by Date Started if (settings.StartedInPeriod != null) { var startDateRange = settings.StartedInPeriod.GetDateRange(TimePeriodDateRangeBoundarySpecifier.Exclusive); if (startDateRange.Start != null) { stepQuery = stepQuery.Where(x => x.StartDateTime > startDateRange.Start.Value); } if (startDateRange.End != null) { stepQuery = stepQuery.Where(x => x.StartDateTime < startDateRange.End.Value); } } // Filter by Date Completed if (settings.CompletedInPeriod != null) { var completedDateRange = settings.CompletedInPeriod.GetDateRange(TimePeriodDateRangeBoundarySpecifier.Exclusive); if (completedDateRange.Start != null) { stepQuery = stepQuery.Where(x => x.CompletedDateTime > completedDateRange.Start.Value); } if (completedDateRange.End != null) { stepQuery = stepQuery.Where(x => x.CompletedDateTime < completedDateRange.End.Value); } } // Filter by Step Campus if (settings.StepCampusGuids.Count() > 0) { var campusService = new CampusService(dataContext); var stepCampusIds = campusService.Queryable() .Where(a => settings.StepCampusGuids.Contains(a.Guid)) .Select(a => a.Id).ToList(); stepQuery = stepQuery.Where(x => x.CampusId.HasValue && stepCampusIds.Contains(x.CampusId.Value)); } // Create Person Query. var personService = new PersonService(( RockContext )serviceInstance.Context); var qry = personService.Queryable() .Where(p => stepQuery.Any(x => x.PersonAlias.PersonId == p.Id)); var extractedFilterExpression = FilterExpressionExtractor.Extract <Rock.Model.Person>(qry, parameterExpression, "p"); return(extractedFilterExpression); }
/// <summary> /// Gets the selection. /// Implement this version of GetSelection if your DataFilterComponent works the same in all FilterModes /// </summary> /// <param name="entityType">The System Type of the entity to which the filter will be applied.</param> /// <param name="controls">The collection of controls used to set the filter values.</param> /// <returns> /// A formatted string. /// </returns> public override string GetSelection( Type entityType, Control[] controls ) { var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView ); var ddlLocationType = controls.GetByName<RockDropDownList>( _CtlLocationType ); var settings = new FilterSettings(); settings.LocationTypeGuid = ddlLocationType.SelectedValue.AsGuidOrNull(); settings.DataViewGuid = DataComponentSettingsHelper.GetDataViewGuid( ddlDataView.SelectedValue ); return settings.ToSelectionString(); }
/// <summary>Синхронизация объекта</summary> /// <param name="tableName">Имя таблицы</param> /// <param name="wayOfSync">Способ синхронизации</param> /// <param name="filter">Фильтры</param> /// <param name="skipExists">Пропустить существующие</param> /// <param name="updId">Нужно обновить ID</param> private bool SyncObjects <T>(string tableName, WaysOfSync wayOfSync, FilterSettings filter, bool skipExists, bool updId) where T : dbObject { CatalogSynchronizer synchronizer = null; synchronizer = this.getCatalogSynchronizer(tableName); logBuilder.AppendLine(); logBuilder.AppendLine(); logBuilder.AppendLine(string.Format("{0}:", typeof(T).Name)); Stopwatch totalWatch = new Stopwatch(); totalWatch.Start(); Stopwatch stopWatch = new Stopwatch(); stopWatch.Start(); string forWarehousesAndMapsSelect = string.Format(@"SELECT RTRIM({0}){0},RTRIM({1}){1},RTRIM({2}) {2} FROM {3} WHERE {4}=0", dbObject.IS_SYNCED, dbObject.BARCODE_NAME, dbObject.SYNCREF_NAME, tableName, CatalogObject.MARK_FOR_DELETING); string forByLogProcessedSelect = string.Format(@"SELECT RTRIM({0}){0},RTRIM({1}){1},RTRIM({2}) {2} FROM {3} WHERE {4}=0 AND {5} = 0", dbObject.IS_SYNCED, dbObject.BARCODE_NAME, dbObject.SYNCREF_NAME, tableName, CatalogObject.MARK_FOR_DELETING, CatalogObject.IS_SYNCED); bool isWarehouseTable = tableName.Equals("Contractors") || tableName.Equals("Maps"); //Выбрать (Признак синхронизации, Штрих-код) всех не удаленных элементов с таблицы tableName string command = (useLoggingSyncronization & !isWarehouseTable) ? forByLogProcessedSelect : forWarehousesAndMapsSelect; DataTable table = null; using (SqlCeCommand query = dbWorker.NewQuery(command)) { table = query.SelectToTable(); } int rowsCount = (table ?? new DataTable()).Rows.Count; logBuilder.AppendLine(string.Format("init pdt query: {0} msec; rows: {1}", stopWatch.ElapsedMilliseconds, rowsCount)); stopWatch.Reset(); stopWatch.Start(); if (filter == FilterSettings.None) { PerformQuery("StartSyncProcess", this.serverIdProvider.ServerId, tableName, table, (int)FilterSettings.NotMarkForDelete); } else { PerformQuery("StartSyncProcess", this.serverIdProvider.ServerId, tableName, table, (int)FilterSettings.NotMarkForDelete, (int)filter); } logBuilder.AppendLine(string.Format("StartSyncProcess: {0} msec; rows: {1}", stopWatch.ElapsedMilliseconds, rowsCount)); stopWatch.Reset(); stopWatch.Start(); if (IsAnswerIsTrue) { removeMarkedObject(tableName); logBuilder.AppendLine(string.Format("removeMarkedObject: {0} msec", stopWatch.ElapsedMilliseconds)); stopWatch.Reset(); stopWatch.Start(); updateObjOnLocalDb <T>(synchronizer, skipExists, updId); int localRowsCount = ((ResultParameters[1] as DataTable) ?? new DataTable()).Rows.Count; logBuilder.AppendLine(string.Format("updateObjOnLocalDb: {0} msec; rows: {1}", stopWatch.ElapsedMilliseconds, localRowsCount)); stopWatch.Reset(); stopWatch.Start(); if (wayOfSync == WaysOfSync.TwoWay) { int remoteTableRows = ((ResultParameters[2] as DataTable) ?? new DataTable()).Rows.Count; updateObjOnServDb <T>(tableName); logBuilder.AppendLine(string.Format("update greenhouse: {0} msec; rows:{1}", stopWatch.ElapsedMilliseconds, remoteTableRows)); stopWatch.Reset(); stopWatch.Start(); } logBuilder.AppendLine(string.Format("{0} total: {1} msec", typeof(T).Name, totalWatch.ElapsedMilliseconds)); return(true); } else { return(false); } }
/// <summary> /// Sets the selection. /// Implement this version of SetSelection if your DataFilterComponent works the same in all FilterModes /// </summary> /// <param name="entityType">Type of the entity.</param> /// <param name="controls">The controls.</param> /// <param name="selection">The selection.</param> public override void SetSelection( Type entityType, Control[] controls, string selection ) { var ddlDataView = controls.GetByName<DataViewPicker>( _CtlDataView ); var ddlLocationType = controls.GetByName<RockDropDownList>( _CtlLocationType ); var settings = new FilterSettings( selection ); if (!settings.IsValid) { return; } ddlDataView.SelectedValue = DataComponentSettingsHelper.GetDataViewId( settings.DataViewGuid ).ToStringSafe(); ddlLocationType.SelectedValue = settings.LocationTypeGuid.ToStringSafe(); }
public INodeIterator CreateNodeIterator(INode root, FilterSettings settings = FilterSettings.All, NodeFilter filter = null) { return(new NodeIterator(root, settings, filter)); }
FilterSettings StripSearchTerm(FilterSettings filterSettings) { if (filterSettings == null) return null; if (!string.IsNullOrEmpty(filterSettings.SearchTerm)) { filterSettings = filterSettings.Clone(); filterSettings.SearchTerm = null; } return filterSettings; }
public override FilterResult Filter(FilterSettings settings) { if (settings.SearchTermMatches(assembly.ShortName)) return FilterResult.Match; else return FilterResult.Recurse; }
private void LogFilter(FilterSettings filter) { LogMessage($"Filter: {filter.Name} Type: {filter.Type} Enabled: {filter.IsEnabled}{Environment.NewLine}Settings: {filter.Settings}"); }
public override FilterResult Filter(FilterSettings settings) { var res = settings.Filter.GetFilterResult(this.MethodDefinition); if (res.FilterResult != null) return res.FilterResult.Value; if (settings.SearchTermMatches(method.Name) && settings.Language.ShowMember(method)) return FilterResult.Match; else return FilterResult.Hidden; }
/// <summary> /// Creates a new NodeIterator object. /// </summary> /// <param name="root"> /// The root node at which to begin the NodeIterator's traversal. /// </param> /// <param name="settings"> /// Indicates which nodes to iterate over. /// </param> /// <param name="filter"> /// An optional callback function for filtering. /// </param> /// <returns>The created node NodeIterator.</returns> public INodeIterator CreateNodeIterator(INode root, FilterSettings settings = FilterSettings.All, NodeFilter filter = null) { return new NodeIterator(root, settings, filter); }