private bool EntityFilter(object obj) { var entityViewModel = (EntityViewModelBase <TEntity>)obj; if (string.IsNullOrWhiteSpace(SearchString)) { return(true); } var searchString = SearchString.Trim().ToLower(); var itemValue = entityViewModel .GetFromModel <TEntity, object>(Filter) //todo concrete type .ToString() .Trim(); return(itemValue .ToLower() .Contains(searchString)); }
private List <Models.iTunesResult> GetPodcasts() { var term = SearchString?.Replace(" ", "+"); var data = ReadUrl(term); if (data != null) { var wrapper = Newtonsoft.Json.JsonConvert.DeserializeObject <Models.iTunesWrapper>(data); Console.WriteLine(wrapper?.resultCount); //Order data var results = wrapper.results.OrderBy(i => i.collectionName).ToList(); return(results); } return(null); }
public async Task <IActionResult> GetPaymentRequests(string storeId, ListPaymentRequestsViewModel model = null) { model = this.ParseListQuery(model ?? new ListPaymentRequestsViewModel()); var store = GetCurrentStore(); var includeArchived = new SearchString(model.SearchTerm).GetFilterBool("includearchived") == true; var result = await _PaymentRequestRepository.FindPaymentRequests(new PaymentRequestQuery { UserId = GetUserId(), StoreId = store.Id, Skip = model.Skip, Count = model.Count, IncludeArchived = includeArchived }); model.Total = result.Total; model.Items = result.Items.Select(data => new ViewPaymentRequestViewModel(data)).ToList(); return(View(model)); }
private InvoiceQuery GetInvoiceQuery(string searchTerm = null, int timezoneOffset = 0) { var fs = new SearchString(searchTerm); var invoiceQuery = new InvoiceQuery() { TextSearch = fs.TextSearch, UserId = GetUserId(), Unusual = fs.GetFilterBool("unusual"), Status = fs.GetFilterArray("status"), ExceptionStatus = fs.GetFilterArray("exceptionstatus"), StoreId = fs.GetFilterArray("storeid"), ItemCode = fs.GetFilterArray("itemcode"), OrderId = fs.GetFilterArray("orderid"), StartDate = fs.GetFilterDate("startdate", timezoneOffset), EndDate = fs.GetFilterDate("enddate", timezoneOffset) }; return(invoiceQuery); }
public async Task OnGetAsync() { IQueryable <string> genreQuery = from m in _context.Movie orderby m.Genre select m.Genre; var movies = from m in _context.Movie select m; if (!string.IsNullOrEmpty(SearchString)) { movies = movies.Where(s => s.Title.ToLower().Contains(SearchString.ToLower())); } if (!string.IsNullOrEmpty(MovieGenre)) { movies = movies.Where(x => x.Genre.ToLower() == MovieGenre.ToLower()); } Genres = new SelectList(await genreQuery.Distinct().ToListAsync()); Movie = await movies.ToListAsync(); }
public ActionResult Index(string SearchString, string CurrentFilter, string sortOrder, int?Page) { ViewBag.SortNameParam = string.IsNullOrEmpty(sortOrder) ? "name_des" : ""; ViewBag.CourseFee = string.IsNullOrEmpty(sortOrder) ? "CourseFee_des" : ""; if (SearchString != null) { Page = 1; } else { SearchString = CurrentFilter; } ViewBag.CurrentFilter = SearchString; List <StudentListViewModel> studentList = _repoObj.GetStudentList(); if (!string.IsNullOrEmpty(SearchString)) { studentList = studentList.Where(n => n.Name.ToUpper().Contains(SearchString.ToUpper())).ToList(); } switch (sortOrder) { case "name_des": studentList = studentList.OrderByDescending(n => n.Name).ToList(); break; case "CourseFee_des": studentList = studentList.OrderByDescending(n => n.CourseFee).ToList(); break; default: studentList = studentList.OrderBy(n => n.Name).ToList(); break; } int PageSize = 6; int PageNumber = (Page ?? 1); return(View("Index", studentList.ToPagedList(PageNumber, PageSize))); //List<studentListViewModel> list = repoObj.GetstudentList(); //return View(list); }
public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters) { ImGui.TextDisabled("Condition Info"); ImGuiExtension.ToolTip("This condition will return true if the player has any of the selected ailments or a minimum of the specified corrupted blood stacks."); base.CreateConfigurationMenu(extensionParameter, ref Parameters); var kappa = GetEnumList <BuffEnums>().ToList(); var test = kappa.Where(x => x.Contains(SearchString)).ToList(); HasBuffReady = ImGuiExtension.ComboBox("Buff List", HasBuffReady, test); Parameters[SearchingBuff] = HasBuffReady.ToString(); SearchString = ImGuiExtension.InputText("Filter Buffs", SearchString, 32, InputTextFlags.AllowTabInput); Parameters[SearchStringString] = SearchString.ToString(); //HasBuff = ExtensionComponent.InitialiseParameterBoolean(HasBuffString, HasBuff, ref Parameters); // CorruptCount = ImGuiExtension.IntSlider("Corruption Count", CorruptCount, 0, 20); // Parameters[CorruptCountString] = CorruptCount.ToString(); return(true); }
private InvoiceQuery GetInvoiceQuery(string searchTerm = null) { var filterString = new SearchString(searchTerm); var invoiceQuery = new InvoiceQuery() { TextSearch = filterString.TextSearch, UserId = GetUserId(), Unusual = !filterString.Filters.ContainsKey("unusual") ? null : !bool.TryParse(filterString.Filters["unusual"].First(), out var r) ? (bool?)null : r, Status = filterString.Filters.ContainsKey("status") ? filterString.Filters["status"].ToArray() : null, ExceptionStatus = filterString.Filters.ContainsKey("exceptionstatus") ? filterString.Filters["exceptionstatus"].ToArray() : null, StoreId = filterString.Filters.ContainsKey("storeid") ? filterString.Filters["storeid"].ToArray() : null, ItemCode = filterString.Filters.ContainsKey("itemcode") ? filterString.Filters["itemcode"].ToArray() : null, OrderId = filterString.Filters.ContainsKey("orderid") ? filterString.Filters["orderid"].ToArray() : null }; return(invoiceQuery); }
// GET: tblSemester public ActionResult Index(string SearchString, string CurrentFilter, string SortOrder, int?page) { List <SemesterViewModel> SmList = db.tblSemesters.Select(s => new SemesterViewModel { SemesterId = s.SemesterId, SemesterName = s.SemesterName, Duration = s.Duration, Fee = s.Fee, StudentId = s.tblStudent.StudentId, StudentName = s.tblStudent.StudentName }).ToList(); ViewBag.SortNameParam = string.IsNullOrEmpty(SortOrder) ? "name_desc" : ""; if (SearchString != null) { page = 1; } else { SearchString = CurrentFilter; } ViewBag.CurrentFilter = SearchString; var list = SmList; if (!string.IsNullOrEmpty(SearchString)) { list = list.Where(s => s.SemesterName.ToUpper().Contains(SearchString.ToUpper())).ToList(); } switch (SortOrder) { case "name_desc": list = list.OrderByDescending(u => u.SemesterName).ToList(); break; default: list = list.OrderBy(u => u.SemesterName).ToList(); break; } int PageSize = 3; int PageNumber = (page ?? 1); return(View(list.ToPagedList(PageNumber, PageSize))); }
public void WalkDirectoryTree(System.IO.DirectoryInfo root) { System.IO.FileInfo[] files = null; System.IO.DirectoryInfo[] subDirs = null; // First, process all the files directly under this folder try { files = root.GetFiles($"*.*"); } catch (UnauthorizedAccessException e) { Log.Add(e.Message); } catch (System.IO.DirectoryNotFoundException e) { Log.Add(e.Message); } int CurrentSearchId = DbManager.GetLastSearchId(); if (files != null) { foreach (System.IO.FileInfo fi in files) { if (fi.Name.ToLower().Contains(SearchString.ToLower())) { //raze event when file found FileSearchHandler?.Invoke(fi); //save file in db; DbManager.saveFile(fi, CurrentSearchId); } } // find all the subdirectories under this directory. subDirs = root.GetDirectories(); foreach (System.IO.DirectoryInfo dirInfo in subDirs) { // Resursive call for each subdirectory. WalkDirectoryTree(dirInfo); } } }
/// <summary> /// Called when a user selects a tag on one of the <see cref="CommunityPackRowTemplate"/> /// </summary> /// <param name="sender">The clicked <see cref="CommunityPackRowTemplate"/></param> /// <param name="tagSelected">Value of the tag clicked.</param> private void FilterTagSelectedByUser(object sender, string tagSelected) { // Clear the search text SearchTextBox.Text = string.Empty; if (string.IsNullOrWhiteSpace(SearchString)) { SearchString += tagSelected; } else { SearchString += "," + tagSelected; } // Remove any double commas left from the Tag manipulations SearchString = SearchString.Replace(",,", ","); ManagementPackSearchChanged?.Invoke(this, SearchString); VerifyIfAllPacksAreCollapsed(); }
public IncrementalSearchResult DeleteCharAndSearch() { if (!IsActive) { throw new InvalidOperationException(); } if (SearchString.Length == 0) { throw new InvalidOperationException(); } if (SearchString.Length == 1) { SearchString = string.Empty; return(searchFailedResult); } SearchString = SearchString.Substring(0, SearchString.Length - 1); return(SelectNextResult()); }
public void OnGet() { if (String.IsNullOrWhiteSpace(SearchString)) { Products = productData.GetAllProducts(); } else { if (SearchString.Contains("/")) { Products = productData.GetProductsByProductCode(SearchString); if (Products.Any()) { return; } } Products = productData.GetProductsByName(SearchString); } }
public override bool CreateConfigurationMenu(ExtensionParameter extensionParameter, ref Dictionary <String, Object> Parameters) { ImGui.TextDisabled("Condition Info"); ImGuiExtension.ToolTip("This condition will return true if the player has any of the selected ailments or a minimum of the specified corrupted blood stacks."); base.CreateConfigurationMenu(extensionParameter, ref Parameters); var buffList = GetEnumList <BuffEnums>().ToList(); var buffListSearch = buffList.Where(x => x.Contains(SearchString)).ToList(); HasBuffReady = ImGuiExtension.ComboBox("Buff List", HasBuffReady, buffListSearch); Parameters[SearchingBuff] = HasBuffReady.ToString(); SearchString = ImGuiExtension.InputText("Filter Buffs", SearchString, 32, InputTextFlags.AllowTabInput); Parameters[SearchStringString] = SearchString.ToString(); RemainingDuration = ImGuiExtension.IntSlider("Remaining Duration", RemainingDuration, 0, 4000); ImGuiExtension.ToolTip("Includes buffs with duration longer than specified. Set to 0 to ignore duration."); Parameters[RemainingDurationString] = RemainingDuration.ToString(); return(true); }
public async Task OnGetAsync() { var query = _context.Track.AsQueryable(); if (!string.IsNullOrEmpty(TrackArtist?.Trim())) { query = query.Where(t => t.Artist == TrackArtist); } if (!string.IsNullOrEmpty(SearchString?.Trim())) { var lower = SearchString.ToLower(); query = query.Where(t => t.Artist.Contains(lower) || t.Title.Contains(lower)); } var artists = await _context.Track.Select(t => t.Artist).Distinct().ToListAsync(); Artists = new SelectList(artists); Tracks = await query.ToListAsync(); }
public async Task <IActionResult> ListInvoices(string searchTerm = null, int skip = 0, int count = 50, int timezoneOffset = 0) { var fs = new SearchString(searchTerm); var storeIds = fs.GetFilterArray("storeid") != null?fs.GetFilterArray("storeid") : new List <string>().ToArray(); var model = new InvoicesModel { SearchTerm = searchTerm, Skip = skip, Count = count, StoreIds = storeIds, TimezoneOffset = timezoneOffset }; InvoiceQuery invoiceQuery = GetInvoiceQuery(searchTerm, timezoneOffset); var counting = _InvoiceRepository.GetInvoicesTotal(invoiceQuery); invoiceQuery.Count = count; invoiceQuery.Skip = skip; var list = await _InvoiceRepository.GetInvoices(invoiceQuery); foreach (var invoice in list) { var state = invoice.GetInvoiceState(); model.Invoices.Add(new InvoiceModel() { Status = invoice.Status, StatusString = state.ToString(), ShowCheckout = invoice.Status == InvoiceStatus.New, Date = invoice.InvoiceTime, InvoiceId = invoice.Id, OrderId = invoice.OrderId ?? string.Empty, RedirectUrl = invoice.RedirectURL?.AbsoluteUri ?? string.Empty, AmountCurrency = _CurrencyNameTable.DisplayFormatCurrency(invoice.ProductInformation.Price, invoice.ProductInformation.Currency), CanMarkInvalid = state.CanMarkInvalid(), CanMarkComplete = state.CanMarkComplete(), Details = InvoicePopulatePayments(invoice), }); } model.Total = await counting; return(View(model)); }
public ActionResult Index(int?page, string SearchString, string searchCheck, string currentFilter, bool checkActive = true, bool checkActivePage = true) { List <Subject> List = new List <Subject>(); if (SearchString != null) { page = 1; } else { SearchString = currentFilter; checkActive = checkActivePage; } ViewBag.CurrentFilter = SearchString; ViewBag.checkActivePage = checkActive; if (!String.IsNullOrEmpty(searchCheck)) { List = unitOfWork.Subject.GetPageList(); if (!String.IsNullOrWhiteSpace(SearchString)) { List = List.Where(s => s.Subject_ID.Trim().ToUpper().Contains(SearchString.Trim().ToUpper())).ToList(); } if (checkActive) { List = List.Where(s => s.Subject_Active == true).ToList(); } if (List.Count == 0) { ViewBag.Nodata = "Showing 0 results"; } else { ViewBag.Nodata = ""; } } int pageSize = 30; int pageNumber = (page ?? 1); ViewBag.Count = List.Count(); return(View(List.ToList().ToPagedList(pageNumber, pageSize))); }
public void SearchSuffixArray() { const string STR = "123456789"; IBigArray <ulong> suffixArray = buildSuffixArray(STR); FourBitDigitBigArray fourBitDigitArray = FourBitDigitBigArrayTests.convertStringTo4BitDigitArray(STR); for (int i = 0; i < STR.Length; i++) { for (int j = i + 1; j <= STR.Length; j++) { string find = STR.Substring(i, j - i); long[] seqSearchRes = SearchString.Search(STR, find).ToLongArr(); SuffixArrayRange suffixArrayRange = SearchString.Search(suffixArray, fourBitDigitArray, find); long[] suffixArraySearchRes = suffixArrayRange.SortedValues; CollectionAssert.AreEqual(seqSearchRes, suffixArraySearchRes); } } }
protected void Refresh(string search) { Clear(); if (string.IsNullOrWhiteSpace(search)) { search = ""; } if (!string.IsNullOrWhiteSpace(FolderPath)) { DirectoryInfo dir = new DirectoryInfo(FolderPath); FileInfo[] files = dir.GetFiles("*.pdf"); foreach (FileInfo file in files .Where(f => f.Name.ToLower().Trim() .Contains(SearchString.ToLower().Trim()))) { Add(GetNew(file)); } } }
public async Task OnGetAsync() { IQueryable <string> genreQuery = from m in _context.Cocktail orderby m.Category select m.Category; var cocktails = from m in _context.Cocktail select m; if (!string.IsNullOrEmpty(SearchString)) { cocktails = cocktails.Where(s => s.Name.ToUpper().Contains(SearchString.ToUpper()) || s.Ingredients.ToUpper().Contains(SearchString.ToUpper())); } if (!string.IsNullOrEmpty(CocktailCategory)) { cocktails = cocktails.Where(x => x.Category == CocktailCategory); } Categories = new SelectList(await genreQuery.Distinct().ToListAsync()); Cocktail = await cocktails.ToListAsync(); }
public async Task OnGetAsync() { //Get Distinct Genre in list of string IQueryable <string> genreQuery = (from m in _context.Books orderby m.Genre select m.Genre).Distinct(); //Get All Books var books = from m in _context.Books select m; if (!string.IsNullOrEmpty(SearchString)) { books = books.Where(s => s.Title.ToLower().Contains(SearchString.ToLower())); } if (!string.IsNullOrEmpty(BookGenre)) { books = books.Where(x => x.Genre == BookGenre); } Genres = new SelectList(await genreQuery.ToListAsync()); Book = await books.ToListAsync(); }
public void OnGet() { // Query for all possible leagues. IQueryable <string> leaguesQuery = from m in Context.Maps.AsNoTracking() orderby m.League select m.League; // Load related data (Stash <-> Maps <-> Currency) so we can get the seller from Stash-object and price from Currency-object. MapsList = Context.Maps.AsNoTracking() .Include(x => x.Stash) .AsNoTracking() .Include(c => c.Price) .AsNoTracking(); // Filters search to only show maps from selected league. if (!string.IsNullOrEmpty(LeagueString)) { MapsList = MapsList.Where(x => x.League.Equals(LeagueString)).AsNoTracking(); } // Search-function, ignores lowercase / uppercase characters when the search is done (toUpper() might be pretty expensive here). if (!string.IsNullOrEmpty(SearchString)) { MapsList = MapsList.Where(s => s.MapName.ToUpper().Contains(SearchString.ToUpper())).AsNoTracking(); } // Search by seller name. if (!string.IsNullOrEmpty(NameString)) { MapsList = MapsList.Where(n => n.Stash.Seller.Contains(NameString)).AsNoTracking(); } // Orders the list from cheapest map to most expensive map. MapsList = MapsList.OrderBy(c => c.Price.PriceDouble * SetRatio(c.Price.Orb)).AsNoTracking(); // Shows all possible leagues in a selectlist. Leagues = new SelectList(leaguesQuery.Distinct().AsNoTracking().ToList()); MapsDisplayed = MapsList.Take(DefaultAmount).AsNoTracking(); }
public async Task OnGetAsync(string sortOrder, string searchString, string currentFilter, int?pageIndex) { CurrentSort = sortOrder; LastNameSort = String.IsNullOrEmpty(sortOrder) ? "name_desc" : ""; CurrentFilter = searchString; if (searchString != null) { pageIndex = 1; } else { searchString = currentFilter; } CurrentFilter = searchString; IQueryable <Member> memberQuery = from m in _context.Members select m; if (!string.IsNullOrEmpty(searchString)) { memberQuery = memberQuery.Where(m => m.FirstName.ToUpper().Contains(SearchString.ToUpper()) || m.LastName.ToUpper().Contains(SearchString.ToUpper()) || m.FullName.ToUpper().Contains(SearchString.ToUpper())); } switch (sortOrder) { case "name_desc": memberQuery = memberQuery.OrderByDescending(m => m.LastName); break; default: memberQuery = memberQuery.OrderBy(m => m.LastName); break; } int pageSize = 10; Member = await PaginatedList <Member> .CreateAsync(memberQuery.Include(pm => pm.ProjectMembers).ThenInclude(p => p.Project).AsNoTracking(), pageIndex ?? 1, pageSize); }
public void Search() { if (SearchFilterIndex < 0) { SearchFilterIndex = 0; } if (SearchString is null) { SearchString = ""; } SearchString = SearchString.ToUpper(); BindableCollection <SACH> books; switch (SearchFilterIndex) { case 1: books = dataProvider.GetBookList(x => x.TENSACH.ToUpper().Contains(SearchString)); break; case 2: books = dataProvider.GetBookList(x => x.TACGIA.TACGIA1.ToUpper().Contains(SearchString)); break; case 3: books = dataProvider.GetBookList(x => x.THELOAI.THELOAI1.ToUpper().Contains(SearchString)); break; case 4: books = dataProvider.GetBookList(x => x.NHAXUATBAN.NHAXUATBAN1.ToUpper().Contains(SearchString)); break; default: books = dataProvider.GetBookList(x => x.TENSACH.ToUpper().Contains(SearchString) || x.TACGIA.TACGIA1.ToUpper().Contains(SearchString) || x.THELOAI.THELOAI1.ToUpper().Contains(SearchString) || x.NHAXUATBAN.NHAXUATBAN1.ToUpper().Contains(SearchString)); break; } BookList = books; SortBookList(SearchOrderIndex); }
private SearchStringType IncludesPath(out string path, out string keyword) { // check if searchString includs path path = null; keyword = null; int pathEndIndex = SearchString.LastIndexOf('\\'); if (pathEndIndex < 0) { return(SearchStringType.NoPath); } path = SearchString.Substring(0, pathEndIndex + 1); keyword = SearchString.Substring(pathEndIndex + 1, _searchString.Length - pathEndIndex - 1); if (Directory.Exists(path)) { return(SearchStringType.FullPath); } return(SearchStringType.PartialPath); }
public void SequentialSearch() { const string STR = "123456789991234"; Dictionary <string, int[]> answers = new Dictionary <string, int[]>() { { "1", new int[] { 0, 11 } }, { "2", new int[] { 1, 12 } }, { "12", new int[] { 0, 11 } }, { "5", new int[] { 4 } } }; foreach (KeyValuePair <string, int[]> kvp in answers) { string find = kvp.Key; int[] expected = kvp.Value; int[] actual = SearchString.Search(STR, find); CollectionAssert.AreEqual(expected, actual); } }
private void ProcessCodeFromFile(string fileName, string codeString, Regex regex) { var matches = regex.Matches(codeString); foreach (Match match in matches) { if (match != null) { var contents = match.Groups[0].Value; if (string.IsNullOrEmpty(SearchString) == false) { if (contents.ToLower().Contains(SearchString.ToLower())) { var row = ResultsDataTable.NewRow(); row[0] = fileName; row[ColExtractedContent] = contents; } } } } }
public bool DescriptionContains(SearchString str) { int index = Description.Length - str.Search.Length; while (index >= 0) { if (!str.Contains(Description[index])) { index -= str.Search.Length; } else if (Description.Substring(index, str.Search.Length) == str.Search) { return(true); } else { index -= 1; } } return(false); }
public HttpResponseMessage AddUsers(SearchString Info) { string strInfo = string.Empty; List <CreateUserData> Forms = new List <CreateUserData>(); try { XmlNodeList xmlnode; string xmlContent = Info.strSearchString; XmlDocument doc = new XmlDocument(); doc.LoadXml(xmlContent); xmlnode = doc.GetElementsByTagName("Info"); var random = new Random(System.DateTime.Now.Millisecond); int randomNumber = random.Next(1, 500000); string rndNumber = randomNumber.ToString(); string imageData = xmlnode[0].ChildNodes.Item(1).InnerText.Trim(); if (imageData != "") { var strimage = imageData.Substring(imageData.LastIndexOf(',') + 1); SaveImage(strimage, rndNumber + ".jpg"); } Forms = CreateUserData.CreateUpdateUsers(Info); } catch (Exception ex) { } HttpResponseMessage response; if (string.IsNullOrEmpty(strInfo)) { response = Request.CreateResponse(HttpStatusCode.OK, Forms); } else { response = Request.CreateResponse(strInfo); } return(response); }
public override bool FilterValidUrls() { string sort = m_parameterData.GetParameterValue("sort"); string limitStr = m_parameterData.GetParameterValue("limit"); if (!int.TryParse(limitStr, out int limit) || limit > Constants.MAX_LIMIT) { limit = Constants.DEFAULT_LIMIT; } string offsetStr = m_parameterData.GetParameterValue("offset"); int.TryParse(offsetStr, out int offset); int lowerLimit = (offset - 1) / 20; int remainder = 0; if ((offset - 1) % 20 != 0) { remainder = 20 % ((offset - 1) % 20); } int upperLimit = lowerLimit + (limit - 1 - remainder) / 20; if (offset - 1 + limit > 20 * (upperLimit + 1)) { upperLimit++; } for (int idx = lowerLimit; idx <= upperLimit; ++idx) { Urls.Add(string.Format(@"search/{0}/{1}/results?page={2}&sort={3}", GetThirdLevelRequest(), SearchString.Replace(" ", "%20"), idx, sort)); } return(Urls.Count > 0); }