public void ShouldBeAbleToBuildWithFactory(FilterCategory category, Type resultType) { var testMessage = new TestMessage().AsFilterMessage(category, resultType); Assert.Equal(category, testMessage.Category); Assert.Equal(resultType, testMessage.ResultType); }
public FilterItem(FilterCategory categoryItem, string description, bool isSelected, HashSet <string> filtList) { FilterCategoryItem = categoryItem; Description = description; IsSelected = _isSelectedOnOpen = isSelected; ValidateValue(filtList); }
public override void OnFilterChanged(FilterCategory filterCategory) { if (filterCategory.Id == FilterCategoryId.medium && filterCategory.Count > 0) { var filters = filterCategory.Filter.Where(f => { switch (f.Id) { case "ebook": return(true); case "ejournal": return(true); case "article": return(true); case "bookchapter": return(true); case "bookreview": return(true); } return(false); }); Frequency = 0; foreach (var filter in filters) { Frequency += filter.Frequency; } } }
public FilterDefinition(string filterName, FilterCategory filterCategory, int maxInBody, LookupAPICategory lookupAPICategory) { this.filterName = filterName ?? throw new ArgumentNullException("filterName"); this.filterCategory = filterCategory; this.lookupAPICategory = lookupAPICategory; this.maxInBody = maxInBody; }
public void UpdateChooser(FilterCategory category, bool forceDisable = false) { foreach (var chooser in Choosers) { chooser.OnFilterChanged(category); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,Name,Active,HardwareComponentId")] FilterCategory filterCategory) { if (id != filterCategory.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(filterCategory); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FilterCategoryExists(filterCategory.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["HardwareComponentId"] = new SelectList(_context.HardwareComponents, "ID", "Name", filterCategory.HardwareComponentId); return(View(filterCategory)); }
public static void WriteLine(FilterCategory category, string message) { if (m_PermittedCategories.Contains(category)) { Console.WriteLine(message); } }
public ListFilterViewModel(FilterCategory category = null) : base(category) { Style = new ViewStyle("ListFilterViewStyle"); FilterSelectionViewModel = new FilterSelectionListViewModel(category, SelectedFilter); FilterSelectionViewModel.SelectedFilter.ItemAdded += OnSelectedFilterItemAdded; FilterSelectionViewModel.SelectedFilter.ItemRemoved += OnSelectedFilterItemRemoved; }
public FilterTypeDescriptor(string name, SceneItemFilterType type, FilterCategory category, SliderType sliderType, double defaultValue = 0.0) { Name = name; Type = type; SliderType = sliderType; DefaultValue = defaultValue; Category = category; }
public static T AsFilterMessage <T>(this T message, FilterCategory category, Type resultType) where T : IFilterMessage { message.Category = category; message.ResultType = resultType; return(message); }
public ActionResult DeleteConfirmed(int id) { FilterCategory filterCategory = _context.FilterCategories.Find(id); _context.FilterCategories.Remove(filterCategory); _context.SaveChanges(); return(RedirectToAction("Index")); }
public RadioButton GetFilterCategoryButton(FilterCategory category) { var rButton = new RadioButton(Driver, By.XPath($"{BaseXPath}//span[contains(text(), {category})]")); // TODO: Fix the below function. //rButton.ScrollToElement(); return(rButton); }
private void AddDropItem(FilterCategory filter, OrderDirectionType direction) { _lstDropItems.Add(new OrderDropdownItem() { Title = GetTitle(filter.SearchValue, direction), SearchValue = filter.SearchValue, Direction = direction }); }
public void BuildDetails(TimerResult timerResult, string controllerName, string actionName, FilterCategory filterCategory, Type resultType, bool isChildAction, Type executedType, MethodInfo method, string eventName, Core.Message.TimelineCategory eventCategory) { var message = new ActionFilterMessage(timerResult, controllerName, actionName, filterCategory, resultType, isChildAction, executedType, method, eventName, eventCategory); var dictionary = new Dictionary<string, object>(); message.BuildDetails(dictionary); Assert.Equal(4, dictionary.Count); }
private void OnSearchFilterListItemAdded(object sender, FilterCategory item) { if (item.Id.Equals(CategoryName)) { foreach (var filter in item.Filter) { OnCategoryFilterAdded(filter); } } }
public AvailableFilterViewModel(FilterCategory category) : base(category) { FilterName = ""; SelectedFilter.Add(new Filter { Catgegory = FilterCategoryId.available, Id = "0" }); VisualState = FilterVisualStates.NORMAL; AppliedInfoString = Pici.Resources.Find(category.Id.ToString()); }
public void BuildDetails(TimerResult timerResult, FilterCategory filterCategory, Type resultType, bool isChildAction, Type executedType, MethodInfo method, string eventName, Core.Message.TimelineCategory eventCategory) { var message = new FilterMessage(timerResult, filterCategory, resultType, isChildAction, executedType, method, eventName, eventCategory); var dictionary = new Dictionary <string, object>(); message.BuildDetails(dictionary); Assert.Equal(4, dictionary.Count); Assert.Equal(resultType, dictionary["ResultType"]); }
public async Task <IActionResult> Create([Bind("Id,Name,Active,HardwareComponentId")] FilterCategory filterCategory) { if (ModelState.IsValid) { _context.Add(filterCategory); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } ViewData["HardwareComponentId"] = new SelectList(_context.HardwareComponents, "ID", "Name", filterCategory.HardwareComponentId); return(View(filterCategory)); }
public ActionResult Edit([Bind(Include = "FilterNameId,FilterValueId,CategoryId")] FilterCategory filterCategory) { if (ModelState.IsValid) { _context.Entry(filterCategory).State = EntityState.Modified; _context.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.CategoryId = new SelectList(_context.Categories, "Id", "Name", filterCategory.CategoryId); ViewBag.FilterNameId = new SelectList(_context.FiltersName, "Id", "Name", filterCategory.FilterNameId); //ViewBag.FilterValueId = new SelectList(_context.FiltersValue, "Id", "Name", filterCategory.FilterValueId); return(View(filterCategory)); }
public void Construct(TimerResult timerResult, FilterCategory filterCategory, Type resultType, bool isChildAction, Type executedType, MethodInfo method) { var message = new FilterMessage(timerResult, filterCategory, resultType, isChildAction, executedType, method); Assert.Equal(timerResult.Duration, message.Duration); Assert.Equal(timerResult.Offset, message.Offset); Assert.Equal(timerResult.StartTime, message.StartTime); Assert.Equal(executedType, message.ExecutedType); Assert.Equal(method, message.ExecutedMethod); Assert.Equal(filterCategory, message.Category); Assert.Equal(resultType, message.ResultType); Assert.Equal(string.Format("{0}", filterCategory.ToString()), message.EventName); }
// GET: FilterCategories/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FilterCategory filterCategory = _context.FilterCategories.Find(id); if (filterCategory == null) { return(HttpNotFound()); } return(View(filterCategory)); }
public virtual void OnFilterChanged(FilterCategory filterCategory) { if (filterCategory.Id == CategoryName) { if (filterCategory.Filter != null) { Frequency = filterCategory.Filter.Count; } else { Frequency = 0; } } }
public void Construct(TimerResult timerResult, string controllerName, string actionName, FilterBounds bounds, FilterCategory filterCategory, Type resultType, bool isChildAction, Type executedType, MethodInfo method) { var message = new BoundedFilterMessage(timerResult, controllerName, actionName, bounds, filterCategory, resultType, isChildAction, executedType, method); Assert.Equal(timerResult.Duration, message.Duration); Assert.Equal(timerResult.Offset, message.Offset); Assert.Equal(timerResult.StartTime, message.StartTime); Assert.Equal(executedType, message.ExecutedType); Assert.Equal(method, message.ExecutedMethod); Assert.Equal(filterCategory, message.Category); Assert.Equal(resultType, message.ResultType); Assert.Equal(controllerName, message.ControllerName); Assert.Equal(actionName, message.ActionName); Assert.Equal(bounds, message.Bounds); Assert.Equal(string.Format("{0}:{1} - {2}:{3}", filterCategory.ToString(), bounds.ToString(), controllerName, actionName), message.EventName); }
// GET: FilterCategories/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } FilterCategory filterCategory = _context.FilterCategories.Find(id); if (filterCategory == null) { return(HttpNotFound()); } ViewBag.CategoryId = new SelectList(_context.Categories, "Id", "Name", filterCategory.CategoryId); ViewBag.FilterNameId = new SelectList(_context.FiltersName, "Id", "Name", filterCategory.FilterNameId); //ViewBag.FilterValueId = new SelectList(_context.FiltersValue, "Id", "Name", filterCategory.FilterValueId); return(View(filterCategory)); }
public FilterViewModel(FilterCategory category = null) { Category = category; SelectedFilter = new PiciObservableCollection <Filter>(); Style = new ViewStyle("FilterViewStyle"); VisualState = FilterVisualStates.EDIT; if (category != null) { FilterName = Category.Name; foreach (var filter in category.Filter) { OnCategoryFilterAdded(filter); } } TapBehaviour.Tap += OnTap; ApplyButtonViewModel.TapBehaviour.Tap += OnApplyTap; }
public FilterSelectionListViewModel(FilterCategory filterCategory, PiciObservableCollection <Filter> selectedFilter) { CategoryName = filterCategory.Id; Style = new ViewStyle("FilterSelectionListViewStyle"); VisualState = "Expanded"; SelectedFilter = selectedFilter; SelectedFilter.ItemAdded += OnSelectedFilterItemAdded; SelectedFilter.ItemRemoved += OnSelectedFilterItemRemoved; foreach (var filter in filterCategory.Filter) { OnCategoryFilterAdded(filter); } HBS.Search.FilterList.ItemAdded += OnSearchFilterListItemAdded; HBS.Search.FilterList.RemovedAll += OnSearchFilterListRemovedAll; }
public IActionResult All([FromBody] FilterCategory filter) // kategory id göre fitreleme { try { var recipes = _uofw.Recipes.FindBy(f => f.Categories.Any(h => filter.CategoryIds.Contains(h.CategoryId))).Select(g => new RecipesDto() { Title = g.Title, Categories = g.Categories.Select(j => j.Category.Name).ToArray(), Directions = g.Desciription, Ingredients = g.Ingredients.Select(k => new IngredientDto() { Name = k.Name, Amounts = k.Amounts.Select(l => new AmountDto() { Quantity = l.Quantity, Unit = l.Unit, }).ToList() }).ToList() }).ToList(); if (recipes.Count == 0) { return(StatusCode(204, "No recipes found")); } RecipeLstDto reciplst = new RecipeLstDto() { Results = recipes.Count(), Recipes = recipes.ToList(), Totals = _uofw.Recipes.GettAll().Count() }; return(Ok(reciplst)); } catch (Exception) { return(StatusCode(500, "A problem happened while handling your request.")); } }
public void WriteLine(FilterCategory category, string message) { if (this.m_PermittedCategories.Contains(category)) Console.WriteLine(message); }
public ChooserButtonViewModel GetChooser(FilterCategory category) { return(Choosers.Where(c => c.CategoryName == category.Id).FirstOrDefault()); }
public static IEnumerable <FilterType> Types(this FilterCategory category) => category.Info()?.Types ?? new FilterType[0];
private static CategoryAttribute?Info(this FilterCategory filter) => filter .GetType() .GetField(filter.ToString()) ?.GetCustomAttribute <CategoryAttribute>(false);
public static string?Name(this FilterCategory category) => category.Info()?.Name;
private void OnSearchFilterListItemRemoved(object sender, FilterCategory category) { UpdateChooser(category); }
public void ClearAllFiltersOtherThan(FilterCategory category) { List<FilterBase> filtersToBeRemoved = new List<FilterBase>(); foreach (var filter in AppliedFilters) { if (filter.Category != category) { filtersToBeRemoved.Add(filter); } } foreach (var filter in filtersToBeRemoved) { AppliedFilters.Remove(filter); } }
internal Filter(FilterCategory category, DsDevice device) : base(device) { _category = category; }
public bool HasAppliedFilterOtherThan(FilterCategory category) { bool hasOtherFilters = false; if (AppliedFilters.Count == 0) { hasOtherFilters = false; } else { foreach (var filter in AppliedFilters) { if (filter.Category != category) { hasOtherFilters = true; break; } } } return hasOtherFilters; }