private void RefreshFilter()
        {
            int internalIndex = -1;

            if (SelectedSearchIndex > -1)
            {
                internalIndex = InternalIndex;
            }
            SearchItems.Clear();
            entryMap.Clear();

            int index = -1;

            for (int ii = 0; ii < entries.Count; ii++)
            {
                if (SearchText == "" || entries[ii].IndexOf(SearchText, StringComparison.CurrentCultureIgnoreCase) > -1)
                {
                    entryMap.Add(ii);
                    SearchItems.Add(entries[ii]);
                    if (ii == internalIndex)
                    {
                        index = entryMap.Count - 1;
                    }
                }
            }
            if (index > -1)
            {
                SelectedSearchIndex = index;
            }
        }
Exemple #2
0
 public IQueryable <Dress> FilterDress(SearchItems item, IQueryable <Dress> dresses)
 {
     if (item.Brands.Any())
     {
         dresses = dresses.Where(dress => item.Brands.Contains(dress.BrandName));
     }
     if (item.Necklines.Any())
     {
         dresses =
             dresses.Where(
                 dress => dress.Properties.Any(dProp => item.Necklines.Contains(dProp.Property.PropertyId)));
     }
     if (item.Silhouettes.Any())
     {
         dresses =
             dresses.Where(
                 dress => dress.Properties.Any(dProp => item.Silhouettes.Contains(dProp.Property.PropertyId)));
     }
     if (item.Styles.Any())
     {
         dresses =
             dresses.Where(
                 dress => dress.Properties.Any(dProp => item.Styles.Contains(dProp.Property.PropertyId)));
     }
     if (item.Colors.Any())
     {
         dresses = dresses.Where(dress => item.Colors.Any(color => (dress.Colors & color) == color));
     }
     if (item.SelectedMaxPrice != null && item.SelectedMinPrice != null)
     {
         dresses = dresses.Where(dress => dress.PriceIndication >= item.SelectedMinPrice && dress.PriceIndication <= item.SelectedMaxPrice);
     }
     return(dresses);
 }
        public async Task LoadSearchItems()
        {
            SearchItems.Clear();
            var itemList = InternalCache.GetSearchList();

            if (itemList?.Count > 0)
            {
                foreach (var item in itemList)
                {
                    SearchItems.Add(new SearchItemDisplayModel(item));
                }
            }
            else
            {
                itemList = await _apiClient.GetSearches(ApplicationSettings.GetUserId());

                foreach (var item in itemList)
                {
                    SearchItems.Add(new SearchItemDisplayModel(item));
                    InternalCache.AddSearchItem(item);
                }
            }

            SearchItems.ForEach(i => i.PropertyChanged += ItemPropertyChanged);
        }
        public void SetInternalEntry(int internalIndex, string entry)
        {
            bool oldAppears = (SearchText == "" || entries[internalIndex].IndexOf(SearchText, StringComparison.CurrentCultureIgnoreCase) > -1);
            bool newAppears = (SearchText == "" || entry.IndexOf(SearchText, StringComparison.CurrentCultureIgnoreCase) > -1);

            entries[internalIndex] = entry;

            int shownIndex = entryMap.IndexOf(internalIndex);

            if (oldAppears && newAppears)
            {
                //change
                SearchItems[shownIndex] = entry;
            }
            else if (oldAppears)
            {
                //remove
                SearchItems.RemoveAt(shownIndex);
                entryMap.RemoveAt(shownIndex);
            }
            else if (newAppears)
            {
                //add
                for (int ii = 0; ii < entryMap.Count; ii++)
                {
                    if (entryMap[ii] < internalIndex)
                    {
                        SearchItems.Insert(ii, entry);
                        entryMap.Insert(ii, internalIndex);
                        break;
                    }
                }
            }
        }
        /// <summary>Synchronously send the SearchItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public SearchResponse Send(SearchItems request)
        {
            var task = SendAsync(request);

            RaiseExceptionOnFault(task);
            return(task.Result);
        }
Exemple #6
0
 private void Search(SearchItems sItem)
 {
     if (this.txtWhere.Text == "")
     {
         MessageBox.Show("Please choose where to search"); return;
     }
     this.chkFoundItems.Items.Clear();
     string[] foundItems;
     if (sItem == SearchItems.Files)
     {
         foundItems = Directory.GetFiles(this.txtWhere.Text, "*" + this.txtFind.Text + "*", SearchOption.AllDirectories);
     }
     else
     {
         foundItems = Directory.GetDirectories(this.txtWhere.Text, "*" + this.txtFind.Text + "*", SearchOption.AllDirectories);
     }
     if (foundItems.Count() == 0)
     {
         MessageBox.Show("No Items found");
     }
     else
     {
         this.chkFoundItems.Items.AddRange(foundItems);
     }
     UpdateCounterAll();
 }
Exemple #7
0
        public ActionResult Search(FormCollection col)
        {
            SearchItems searchItems = default(SearchItems);

            // added this items to the model in a struct so we can continue using same search items
            // ternary : if hidden element is null, use original search page element, else use hidden element

            searchItems.query               = col["hquery"] == null ? col["SearchQuery"] : col["hquery"];
            searchItems.cuisine             = col["hcuisine"] == null ? col["Cuisine"] : col["hcuisine"];
            searchItems.ingredients         = col["hingredients"] == null ? col["Ingredients"] : col["hingredients"];
            searchItems.diets               = col["hdiets"] == null ? col["Diets"] : col["hdiets"];
            searchItems.excludedIngredients = col["hexcludedIngredients"] == null ? col["ExcludedIngredients"] : col["hexcludedIngredients"];
            searchItems.intolerances        = col["hintolerances"] == null ? col["Intolerances"] : col["hintolerances"];
            searchItems.type  = col["htype"] == null ? col["Type"] : col["htype"];
            searchItems.index = col["hindex"] == null ? 0 : Convert.ToInt32(col["hindex"]) + 1;

            // update to search model when that is created
            Models.HomeContent h = new Models.HomeContent
            {
                searchItems = searchItems,
                // get recipes to display
                SearchResults = RecipeAPI.RecipeSearch(searchItems.query, searchItems.cuisine, searchItems.ingredients,
                                                       searchItems.diets, searchItems.excludedIngredients, searchItems.intolerances, searchItems.type, searchItems.index)

                                // get the user object when we set up users
            };

            return(View(h));
        }
Exemple #8
0
        //[Route("/Music/Index")]
        public ActionResult Index(string id, string artist, string track, string genre)
        {
            System.Console.WriteLine("artist = {0}", artist);
            System.Console.WriteLine("låt = {0}", track);
            _holder = new DataHolder();
            var search = new SearchItems()
            {
                artist = artist, track = track, genre = genre
            };

            var viewModel = new MusicViewModel
            {
                SearchItems = search,
                DataHolder  = _holder,
                artist      = artist,
                track       = track,
                genre       = genre,
                id          = id
            };

            viewModel.artist = artist;
            viewModel.track  = track;
            viewModel.genre  = genre;
            test.search(viewModel);
            return(View(viewModel));
        }
Exemple #9
0
        public override void RowSelected(UITableView tableView, NSIndexPath indexPath)
        {
            tableView.DeselectRow(indexPath, true);

            if (fView != null)
            {
                if (SearchItems.Count() == TableItems.Count())
                {
                    fView.SetSelected(indexPath.Row);
                }
                else
                {
                    PEAKiOS.Models.Module selected = SearchItems[indexPath.Row];
                    int cRow = 0;
                    for (int i = 0; i < TableItems.Count; i++)
                    {
                        if (TableItems[i].Equals(selected))
                        {
                            cRow = i;
                            break;
                        }
                    }
                    fView.SetSelected(cRow);
                }
                fView.PerformSegue("toModuleInfo", this);
            }
        }
Exemple #10
0
    /// <summary>
    /// 產生控制項
    /// </summary>
    public void Generate()
    {
        _container.Controls.Add(new LiteralControl(_title));

        // Start Date
        _container.Controls.Add(new TextBox
        {
            ID        = _startDateID,
            ToolTip   = _dateToolTip,
            MaxLength = _startDateMaxLength
        });

        // ~
        _container.Controls.Add(new Label {
            Text = "~"
        });

        // End Date
        _container.Controls.Add(new TextBox
        {
            ID        = _endDateID,
            ToolTip   = _dateToolTip,
            MaxLength = _endDateMaxLength
        });

        SearchItems.Add(new SearchItem(_startDateID, string.Format(" AND {0} >= @0", _datetimeFieldName)));
        SearchItems.Add(new SearchItem(_endDateID, string.Format(" AND {0} < DateAdd(d, 1, @0)", _datetimeFieldName)));
    }
Exemple #11
0
        async Task FillSearchFoodItems(string term)
        {
            IsBusy = true;
            App.VariationItemViewModel.IsSearchItemsListviewVisible = true;
            SearchItems.Clear();
            SearchItems.AddRange(
                from item in await App.DB.GetOrderedFoodItemsAsync(term)
                select new VariationItemSearchItem()
            {
                Source           = null,
                Name             = item.Name,
                Icon             = null,
                InternalFoodItem = item
            }
                );

            // External sources
            if (kaloriaBazisRemoteParser == null)
            {
                kaloriaBazisRemoteParser = new KaloriaBazisRemoteParser();
            }
            await FillSearchItems_ExternalSources(kaloriaBazisRemoteParser, term);

            IsBusy = false;
        }
Exemple #12
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Updates the DistributionChartLayout with the information from the specified grid.
        /// </summary>
        /// ------------------------------------------------------------------------------------
        public void UpdateFromDistributionGrid(DistributionGrid grid)
        {
            if (grid == null)
            {
                return;
            }

            Reset();

            // Save the search items.
            for (int i = 1; i < grid.Rows.Count; i++)
            {
                if (i != grid.NewRowIndex)
                {
                    SearchItems.Add(grid[0, i].Value as string);
                }
            }

            // Add the search item column.
            ColumnWidths.Add(grid.Columns[0].Width);

            // Save the environments and column widths.
            for (int i = 1; i < grid.Columns.Count - 1; i++)
            {
                ColumnWidths.Add(grid.Columns[i].Width);
                var query = grid.Columns[i].Tag as SearchQuery;
                if (query != null)
                {
                    SearchQueries.Add(query);
                }
            }

            // Add the new environment column (this is like the column equivalent of the new row).
            ColumnWidths.Add(grid.Columns[grid.Columns.Count - 1].Width);
        }
Exemple #13
0
        /// <summary>Synchronously send the SearchItems request</summary>
        /// <param name="request">Request to be sent</param>
        /// <returns>Response from the API</returns>
        public SearchResponse Send(SearchItems request)
        {
            var task   = Task.Run(async() => await SendAsync(request));
            var result = task.WaitAndUnwrapException();

            return(result);
        }
Exemple #14
0
 private void btnOkay_Click(object sender, EventArgs e)
 {
     dgItems.EndEdit();
     if (IsMultiple)
     {
         var items = new List <ReferenceItem>();
         for (int i = 0; i <= dgItems.Rows.Count - 1; i++)
         {
             var isSelected = dgItems[dtlSelect.Index, i].Value.ToString();
             if (isSelected == "1")
             {
                 var id   = dgItems[dtlId.Index, i].Value.ToString();
                 var item = SearchItems.FirstOrDefault(a => a.Id == id);
                 items.Add(item);
             }
         }
         this.ResultMultiple = items;
         this.Close();
         this.Dispose();
     }
     else
     {
         if (dgItems.CurrentRow.Index >= 0)
         {
             var result = dgItems[dtlId.Index, dgItems.CurrentRow.Index].Value.ToString();
             this.ResultSingle = result;
             this.Close();
             this.Dispose();
         }
         else
         {
             Prompt.Information("Please select the desired row in the datagrid.", this.Text);
         }
     }
 }
Exemple #15
0
        public DataSet ShowSearchData(SearchItems objinfo)
        {
            DataSet ds;

            using (SqlConnection con = new SqlConnection(Connection))
            {
                con.Open();
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.Connection  = con;
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.CommandText = "SPO_SearchDynamic ";
                    cmd.Parameters.Add(new SqlParameter("@fullname", SqlDbType.VarChar, 100)).Value    = objinfo.Fullname;
                    cmd.Parameters.Add(new SqlParameter("@productname", SqlDbType.VarChar, 50)).Value  = objinfo.ProductName;
                    cmd.Parameters.Add(new SqlParameter("@manufacturer", SqlDbType.VarChar, 50)).Value = objinfo.Manufacturer;
                    cmd.Parameters.Add(new SqlParameter("@rating", SqlDbType.VarChar, 10)).Value       = objinfo.Salesrating;
                    cmd.Parameters.Add(new SqlParameter("@title", SqlDbType.VarChar, 200)).Value       = objinfo.Title;
                    cmd.Parameters.Add(new SqlParameter("@price", SqlDbType.VarChar, 100)).Value       = objinfo.Price;
                    cmd.Parameters.Add(new SqlParameter("@listprice", SqlDbType.VarChar, 100)).Value   = objinfo.Listprice;

                    using (SqlDataAdapter da = new SqlDataAdapter(cmd))
                    {
                        ds = new DataSet();
                        da.Fill(ds);
                        con.Close();
                        da.Dispose();
                    }
                }
            }
            return(ds);
        }
        public void RemoveAt(int index)
        {
            entries.RemoveAt(entryMap[index]);

            SearchItems.RemoveAt(index);
            entryMap.RemoveAt(index);
        }
 public void ApplySelectedFilter(SearchItems filter)
 {
     this.SelectedFilter = filter;
     foreach (string brand in filter.Brands)
     {
         CheckBoxItemBrands item = Brands.FirstOrDefault(i => i.ID == brand);
         if (item != null)
         {
             item.IsChecked = true;
         }
     }
     foreach (Color color in filter.Colors)
     {
         var item = Colors.FirstOrDefault(i => i.color == color);
         if (item != null)
         {
             item.IsChecked = true;
         }
     }
     ApplyPropertyFilters(Styles, filter.Styles);
     ApplyPropertyFilters(Necklines, filter.Necklines);
     ApplyPropertyFilters(Silhouettes, filter.Silhouettes);
     SelectedMinPrice = filter.SelectedMinPrice ?? MinPrice;
     SelectedMaxPrice = filter.SelectedMaxPrice ?? MaxPrice;
 }
        public void Clear()
        {
            entries.Clear();

            SearchItems.Clear();
            entryMap.Clear();
            SearchText = "";
        }
        public void WhenIEnterIntoSearchBar(string ItemToSearch)
        {
            googleHomePage.GetSearchField().Clear();
            googleHomePage.GetSearchField().SendKeys(ItemToSearch);
            logger.Debug("Sent the text '{0}' to the element", ItemToSearch);

            //Search item stored globally to test Globals mechanism.
            globals.AddToList(SearchItems.ToString(), ItemToSearch);
        }
Exemple #20
0
        private async void productList_ItemSelected(object sender, SelectedItemChangedEventArgs e)
        {
            SearchItems item = (SearchItems)((ListView)sender).SelectedItem;

            ((ListView)sender).SelectedItem = null;
            SearchBox.Text = item.PRODUCT_NAME;
            productSearchList.IsVisible = false;
            await(this.BindingContext as ProductsViewModel).FindItemByIdAsync(item.PRODUCT_ID);
            productList.IsVisible = true;
        }
        public void AddItem(string item)
        {
            entries.Add(item);

            if (SearchText == "" || entries[entries.Count - 1].IndexOf(SearchText, StringComparison.CurrentCultureIgnoreCase) > -1)
            {
                SearchItems.Add(entries[entries.Count - 1]);
                entryMap.Add(entries.Count - 1);
            }
        }
Exemple #22
0
        void UpdateUI(object sender, EventArgs e)
        {
            var results = sender as List <SearchResult>;

            foreach (var item in results)
            {
                SearchItems.Add(item);
            }

            SearchItems.OrderByDescending(x => x.Time);
        }
 public void ResetSearchItemStatus()
 {
     //if (m_DisplayMode == SearchResultDisplayMode.ThumbNailAllSearchItem)
     //{
     SearchItems.ForEach(si => si.IsFinished = false);
     //}
     //else
     //{
     //    CurrentSearchItem.IsFinished = false;
     //}
 }
Exemple #24
0
 private void AddSearchItem(string itemKey, string itemValue)
 {
     if (SearchItems.ContainsKey(itemKey))
     {
         SearchItems[itemKey] = itemValue;
     }
     else
     {
         SearchItems.Add(itemKey, itemValue);
     }
 }
        private async void Delete(object obj)
        {
            var searchItem = obj as SearchItem;

            var result = await _apiClient.DeleteSearch(ApplicationSettings.GetUserId(), searchItem.Id.ToString());

            if (result == System.Net.HttpStatusCode.OK)
            {
                InternalCache.RemoveSearchItem(searchItem);
                SearchItems.Remove(SearchItems.FirstOrDefault(si => si.Id == searchItem.Id));
            }
        }
Exemple #26
0
        public IActionResult Add(SuperModel collectie, string priceRange, BrowseParameters parameters)
        {
            int minPrice, maxPrice;

            GetPriceRange(priceRange, out minPrice, out maxPrice);
            collectie.SelectedMinPrice = minPrice;
            collectie.SelectedMaxPrice = maxPrice;
            SearchItems item = new SearchItems(collectie);
            string      url  = "Browse?" + item.GetQueryString() + parameters.GetQueryString();

            return(Redirect(url));
        }
    /// <summary>
    /// 核取方塊控制項設定
    /// </summary>
    /// <param name="vs">ViewState</param>
    /// <param name="pl">搜尋 Panel 控制項</param>
    /// <param name="Title">搜尋項目標題</param>
    /// <param name="ID">控制項 ID</param>
    /// <param name="FieldName">目標欄位名稱</param>
    public Search_Checkbox(StateBag vs, Panel pl, string Title, string ID, string FieldName)
    {
        _title     = Title;
        _ID        = ID;
        _fieldName = FieldName;

        _viewState = vs;
        _container = pl;

        Generate();

        SearchItems.Add(new SearchItem(_ID, string.Format(" AND {0}=@0", _fieldName)));
    }
Exemple #28
0
 async Task FillSearchItems_ExternalSources(IRemoteParser source, string term)
 {
     SearchItems.AddRange(
         from item in await source.GetMatches(term)
         where !(from s in SearchItems
                 select s.Name).Contains(item)
         select new VariationItemSearchItem()
     {
         Name   = item,
         Icon   = source.GetIcon(),
         Source = source,
     }
         );
 }
        public void SetItem(int index, string entry)
        {
            entries[entryMap[index]] = entry;

            if (SearchText == "" || entries[entryMap[index]].IndexOf(SearchText, StringComparison.CurrentCultureIgnoreCase) > -1)
            {
                SearchItems[index] = entry;
            }
            else
            {
                SearchItems.RemoveAt(index);
                entryMap.RemoveAt(index);
            }
        }
    /// <summary>
    /// 文字搜尋控制項設定
    /// </summary>
    /// <param name="vs">ViewState</param>
    /// <param name="pl">搜尋 Panel 控制項</param>
    /// <param name="Title">搜尋項目標題</param>
    /// <param name="ID">控制項 ID</param>
    /// <param name="FieldName">目標欄位名稱</param>
    /// <param name="PlaceHolder">浮水印提示文字 (選填)</param>
    public Search_Textfield(StateBag vs, Panel pl, string Title, string ID, string FieldName, string PlaceHolder = "")
    {
        _title       = Title;
        _ID          = ID;
        _fieldName   = FieldName;
        _placeHolder = PlaceHolder;

        _viewState = vs;
        _container = pl;

        Generate();

        SearchItems.Add(new SearchItem(_ID, string.Format(" AND {0}=@0", _fieldName)));
    }