public OperationReturnModel <ProductsReturn> GetProductsByCategoryId(string catalogType, string categoryId, [FromUri] SearchInputModel searchModel) { OperationReturnModel <ProductsReturn> ret = new OperationReturnModel <ProductsReturn>(); try { if (catalogType.Equals(Constants.CATALOG_UNFI) && this.SelectedUserContext.BranchId.Equals(Constants.BRANCH_FEL)) { catalogType = Constants.CATALOG_UNFIEAST; } searchModel.CatalogType = catalogType; ProductsReturn prods = _catalogService.GetProductsByCategory(this.SelectedUserContext, categoryId, searchModel, this.AuthenticatedUser); prods.Products = FavoritesAndNotesHelper.GetFavoritesAndNotesFromLists(this.AuthenticatedUser, this.SelectedUserContext, prods.Products, _listService); ContractInformationHelper.GetContractCategoriesFromLists(SelectedUserContext, prods.Products, _listService); ret.SuccessResponse = prods; ret.IsSuccess = true; } catch (Exception ex) { ret.IsSuccess = false; ret.ErrorMessage = ex.Message; _elRepo.WriteErrorLog("GetProductsByCategory", ex); } return(ret); }
public ProductsReturn GetHouseProductsByBranch(string branch, string controlLabel, SearchInputModel searchModel) { return(new ProductsReturn()); }
/// <summary> /// 検索条件の追加 /// </summary> /// <param name="sourceData">加工前の検索結果</param> /// <param name="filter">検索条件</param> private static IQueryable <Preprocess> Search(IQueryable <Preprocess> sourceData, SearchInputModel filter) { IQueryable <Preprocess> data = sourceData; data = data .SearchLong(d => d.Id, filter.Id) .SearchString(d => d.Name, filter.Name) .SearchTime(d => d.CreatedAt, filter.CreatedAt) .SearchString(d => d.Memo, filter.Memo); return(data); }
public List <BookViewModel> GetSearchResults(SearchInputModel search) { var books = (from b in _db.Books where b.Title.Contains(search.Title) || search.Title == null where b.Isbn.ToString().Contains(search.Isbn.ToString()) || search.Isbn == null select b); if (search.AuthorIds != null) { books = (from bac in _db.BookAuthorConnections join a in search.AuthorIds on bac.AuthorId equals a join b in books on bac.BookId equals b.Id select b); } if (search.GenreIds != null) { books = (from bgc in _db.BookGenreConnections join g in search.GenreIds on bgc.GenreId equals g join b in books on bgc.BookId equals b.Id select b); } if (search.PublisherIds != null) { books = (from b in books join p in search.PublisherIds on b.PublisherId equals p select b); } if (search.Types != null) { books = (from b in books join t in search.Types on b.Type equals t select b); } var results = new List <BookViewModel>(); foreach (var b in books) { var authors = GetAuthors(b.Id); var coverImage = GetCoverImageAsync(b.Id); var rating = GetRating(b.Id); var book = new BookViewModel { BookId = b.Id, Title = b.Title, Type = b.Type, Price = b.Price, Author = authors, CoverImage = coverImage, Rating = rating }; results.Add(book); } return(results); }
public async Task <IActionResult> Index(SearchInputModel searchInputModel) { this.HttpContext.Session.SetString("SessionsTest", "Test"); this.ViewData["Destinations"] = SelectListGenerator.GetAllDestinations(this.destinationsService); return(this.View()); }
public IHttpResponse Search(SearchInputModel model) { if (!IsAuthenticated()) { ViewData["visible"] = "bloc"; ViewData["title"] = "Login"; return(View("account/login")); } const string searchTermKey = "searchTerm"; //var parameters = Request.QueryData; var shoppingCart = Request.Session.GetParameter <ShoppingCartViewModel>(ShoppingCartViewModel.SessionKey); var searchTerm = model.SearchTerm; bool isSearchKey = Request.Url.Contains(searchTermKey); if (isSearchKey) { ViewData[searchTermKey] = searchTerm; } ViewData["title"] = "Search Cake"; if (searchTerm == null && string.IsNullOrEmpty(ViewData[searchTermKey])) { ViewData["showCart"] = "none"; ViewData["results"] = @"<h2 class=""text text-info"">Please, make a Choice.</h2>"; return(View("products/search")); } searchTerm = searchTerm ?? ViewData[searchTermKey]; ViewData[searchTermKey] = searchTerm; var allProducts = _productService.All(searchTerm); if (!allProducts.Any()) { ViewData["results"] = @"<h2 class=""text text-info"">No cakes found.</h2>"; ViewData["showCart"] = "none"; } else { var sb = new StringBuilder(); sb.AppendLine(@"<div class=""row""><div class=""col-sm-3""></div><table class=""table table-bordered table-striped col-sm-6 ""><tbody><tr><th scope=""col-sm-4"">Name</th><th scope=""col-sm-1"">Price</th><th scope=""col-sm-1"">Order</th></tr>"); foreach (var productViewModel in allProducts) { sb.AppendLine($@"<tr ><td><a class=""btn btn-outline-primary col-sm-12"" href=""/details?id={productViewModel.Id}"">{productViewModel.Name}</a></td><td><p>${productViewModel.Price}</p></td><td><form method=""get"" action=""shopping/add"" class=""col-sm-1""><button type=""submit"" name=""id"" class=""btn btn-outline-primary"" value=""{productViewModel.Id}""><i class=""fas fa-cart-plus""></i> Add to Cart</button></form></td></tr>"); } sb.AppendLine(@"</tbody></table><div class=""col-sm-3""></div></div>"); var result = sb.ToString().Trim(); ViewData["results"] = result; } var totalProducts = shoppingCart.ProductIds.Count; var totalProductsText = totalProducts != 1 ? "products" : "product"; ViewData["showCart"] = "block"; ViewData["products"] = $"{totalProducts} {totalProductsText}"; return(View("products/search")); }
public ProductsReturn GetHouseProductNumbersByBranch(UserSelectedContext catalogInfo, string brandControlLabel, SearchInputModel searchModel) { throw new NotImplementedException(); }
/// <summary> /// 検索条件の追加 /// </summary> /// <param name="sourceData">加工前の検索結果</param> /// <param name="filter">検索条件</param> private static IQueryable <NotebookHistory> Search(IQueryable <NotebookHistory> sourceData, SearchInputModel filter) { IQueryable <NotebookHistory> data = sourceData; data = data .SearchLong(d => d.Id, filter.Id) .SearchString(d => d.Name, filter.Name) .SearchTime(d => d.CreatedAt, filter.CreatedAt) .SearchString(d => d.CreatedBy, filter.CreatedBy) .SearchString(d => d.Memo, filter.Memo) .SearchString(d => d.GetStatus().ToString(), filter.Status); return(data); }
public int GetHitsForSearchInIndex(UserSelectedContext catalogInfo, string searchTerm, SearchInputModel searchModel) { throw new NotImplementedException(); }
public ProductsReturn GetProductNumbersBySearch(UserSelectedContext catalogInfo, string search, SearchInputModel searchModel) { throw new NotImplementedException(); }
public ProductsReturn GetProductsByCategory(UserSelectedContext catalogInfo, string category, SearchInputModel searchModel) { throw new NotImplementedException(); }
public ProductsReturn GetProductsByItemNumbers(string branch, List <string> ids, SearchInputModel model = null) { throw new NotImplementedException(); }
public ProductsReturn GetProductsBySearch(string branch, string search, SearchInputModel searchModel) { throw new NotImplementedException(); }
public async Task <IActionResult> Sort(SortInputModel sortModel, AllCarsModel input, SearchInputModel searchModle, int page = 1) { ICollection <CarAdsViewModel> ads; // this is true only when you go through pages if (searchModle.Make != 0) { input.SortInputModel = new SortInputModel { OrderByYear = sortModel.OrderByYear, OrderByPrice = sortModel.OrderByPrice, SearchInputModel = searchModle }; } var sortInputModel = new SortInputModel(); if (input.SortInputModel.SearchInputModel == null) { ads = await this.homeService.GetAllAdsAsync(); } else { ads = await this.homeService.GetAdsByCriteriaAsync(input.SortInputModel.SearchInputModel); this.ViewData["searchModel"] = input.SortInputModel.SearchInputModel as SearchInputModel; this.ViewData["orderByYear"] = input.SortInputModel.OrderByYear; this.ViewData["orderByPrice"] = input.SortInputModel.OrderByPrice; sortInputModel.SearchInputModel = new SearchInputModel(); } if (input.SortInputModel.OrderByYear == "2") { ads = ads.OrderBy(x => x.YearOfProduction).ToList(); } else if (input.SortInputModel.OrderByYear == "1") { ads = ads.OrderByDescending(x => x.YearOfProduction).ToList(); } else if (input.SortInputModel.OrderByPrice == "2") { ads = ads.OrderBy(x => x.Price).ToList(); } else if (input.SortInputModel.OrderByPrice == "1") { ads = ads.OrderByDescending(x => x.Price).ToList(); } var result = new AllCarsModel { AllCars = ads, SortInputModel = sortInputModel, CurrentPage = page, Action = "Sort", }; var count = result.AllCars.Count; result.PagesCount = (int)Math.Ceiling((double)count / GlobalConstants.ItemsPerPage); if (result.PagesCount == 0) { result.PagesCount = 1; } var output = this.homeService.Paging(result, GlobalConstants.ItemsPerPage, (page - 1) * GlobalConstants.ItemsPerPage); return(this.View("All", output)); }
public ProductsReturn GetCatalogCampaignProducts(string campaignUri, UserSelectedContext context, SearchInputModel model, UserProfile profile) { CatalogCampaignReturnModel campaign = _campaignLogic.GetCampaignByUri(campaignUri); ProductsReturn products = null; var items = campaign?.Items?.Select(x => x.ItemNumber).ToList(); if (items != null) { products = _catalogLogic.GetProductsByItemNumbers(context, items, model, profile); } return(products); }
public ActionResult Advanced(SearchInputModel searchModel) { return(View()); }
public async Task <List <OfferDetails> > SearchOffer(SearchInputModel model) { return(await _offerService.Value.SearchOffers(model)); }
public List <BookViewModel> GetSearchResults(SearchInputModel search) { var test = _bookRepo.GetSearchResults(search); return(test); }
public void GetAllUserOrdersShouldReturnAllOrdersBeforeGivenUnloadingDate() { var searchModel = new SearchInputModel { SenderName = null, ReceiverName = null, LoadingDate = null, UnloadingDate = DateTime.UtcNow.AddDays(5), }; //Create first Order var shipment = new Shipment() { FromCity = new City { Name = "Plovdiv" }, ToCity = new City { Name = "Sofia" }, Length = 2, Width = 3, Height = 1.2, Weight = 333, CountOfPallets = 2, IsExpressDelivery = true, IsFragile = false, Price = 114.60M }; var input = new AddressInputModel { ShipmentId = shipment.Id, LoadingName = "Fenix", UnloadingName = "Faaaaaaaaan", LoadingDate = DateTime.UtcNow, UnloadingDate = DateTime.UtcNow.AddDays(1), LoadingPhone = "0877-223-225", UnloadingPhone = "0877-774-225", Description = "descr", LoadingStreet = "бул. Христо Ботев", UnloadingStreet = "Александровска", LoadingNumber = "12", UnloadingNumber = "23A", LoadingEmail = "*****@*****.**", UnloadingEmail = "*****@*****.**", }; var user = new ApplicationUser { UserName = "******" }; var optionsBuilder = new DbContextOptionsBuilder <ApplicationDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()); var db = new ApplicationDbContext(optionsBuilder.Options); db.Shipments.Add(shipment); db.Users.Add(user); db.SaveChanges(); var ordersService = new OrdersService(db); ordersService.CreateOrder(input, user.Id); //Create second Order var shipment2 = new Shipment() { FromCity = new City { Name = "Plovdiv" }, ToCity = new City { Name = "Sofia" }, Length = 2, Width = 3, Height = 1.2, Weight = 333, CountOfPallets = 2, IsExpressDelivery = true, IsFragile = false, Price = 114.60M }; var input2 = new AddressInputModel { ShipmentId = shipment2.Id, LoadingName = "Fenix2", UnloadingName = "Fazan", LoadingDate = DateTime.UtcNow, UnloadingDate = DateTime.UtcNow.AddDays(2), LoadingPhone = "0877-223-225", UnloadingPhone = "0877-774-225", Description = "descr", LoadingStreet = "бул. Христо Ботев", UnloadingStreet = "Александровска", LoadingNumber = "12", UnloadingNumber = "23A", LoadingEmail = "*****@*****.**", UnloadingEmail = "*****@*****.**", }; db.Shipments.Add(shipment2); db.SaveChanges(); ordersService.CreateOrder(input2, user.Id); //Create third Order var shipment3 = new Shipment() { FromCity = new City { Name = "Plovdiv" }, ToCity = new City { Name = "Sofia" }, Length = 2, Width = 3, Height = 1.2, Weight = 333, CountOfPallets = 2, IsExpressDelivery = true, IsFragile = false, Price = 114.60M }; var input3 = new AddressInputModel { ShipmentId = shipment3.Id, LoadingName = "Company", UnloadingName = "Fazan", LoadingDate = DateTime.UtcNow, UnloadingDate = DateTime.UtcNow.AddDays(10), LoadingPhone = "0877-223-225", UnloadingPhone = "0877-774-225", Description = "descr", LoadingStreet = "бул. Христо Ботев", UnloadingStreet = "Александровска", LoadingNumber = "12", UnloadingNumber = "23A", LoadingEmail = "*****@*****.**", UnloadingEmail = "*****@*****.**", }; db.Shipments.Add(shipment3); db.SaveChanges(); ordersService.CreateOrder(input3, user.Id); var searchService = new SearchService(db); var collection = searchService.GetAllUserOrders(user.Id, searchModel); var result = collection.Count(); Assert.Equal(2, result); }
public async Task <IActionResult> Guilds(SearchInputModel model) { var guild = await _guildService.FindGuiild(model); return(this.View(guild)); }
public IQueryable <UserOrderViewModel> GetAllUserOrders(string userId, SearchInputModel input) { var allOrders = this.db.Orders.Where(o => o.CreatorId == userId) .Select(x => new UserOrderViewModel { OrderId = x.Id, From = x.Shipment.FromCity.Name, To = x.Shipment.ToCity.Name, CountOfPallets = x.Shipment.CountOfPallets, Width = x.Shipment.Width, Length = x.Shipment.Length, Height = x.Shipment.Height, Weight = x.Shipment.Weight, Description = x.Shipment.Description, Comment = x.Shipment.Comment, IsDelivered = x.Shipment.IsDelivered, IsFragile = x.Shipment.IsFragile, IsExpressDelivery = x.Shipment.IsExpressDelivery, Sender = x.Shipment.Sender.Name, Receiver = x.Shipment.Receiver.Name, LoadingAddress = x.Shipment.LoadingAddress.Street + " " + x.Shipment.LoadingAddress.StreetNumber, UnloadingAddress = x.Shipment.UnloadingAddress.Street + " " + x.Shipment.UnloadingAddress.StreetNumber, LoadingDate = x.Shipment.LoadingDate, UnloadingDate = x.Shipment.UnloadingDate, OrderCreatedOn = x.Shipment.OrderCreatedOn, Price = x.Shipment.Price.ToString("F2"), DriverId = x.Shipment.DriverId, DriverFirstName = x.Shipment.Driver.FirstName, DriverLastName = x.Shipment.Driver.LastName, Images = x.Shipment.Images.ToList(), VotesCount = x.Shipment.Driver.DriverVotes.Count, VotesTotal = x.Shipment.Driver.DriverVotes.Sum(x => x.Value) }); //Ако при празно търсене искам да се показват всички поръчки трябва да изтрия този блок //В момента скривам всички поръчки, ако получа празни полета за търсене if (input.SenderName == null && input.ReceiverName == null && input.LoadingDate == default && input.UnloadingDate == default) { return(allOrders.Where(o => o.Sender == null)); } if (!string.IsNullOrWhiteSpace(input.SenderName)) { allOrders = allOrders.Where(o => o.Sender.Contains(input.SenderName)); } if (!string.IsNullOrWhiteSpace(input.ReceiverName)) { allOrders = allOrders.Where(o => o.Receiver.Contains(input.ReceiverName)); } if (input.LoadingDate != null) { allOrders = allOrders.Where(o => o.LoadingDate >= input.LoadingDate); } if (input.UnloadingDate != null) { allOrders = allOrders.Where(o => o.UnloadingDate <= input.UnloadingDate); } return(allOrders); }
public async Task <GlobalSearchDetails> Search(SearchInputModel model) { return(await _command.Value.GlobalSearch(model)); }
public IActionResult Results(SearchInputModel search) { var results = _searchService.GetSearchResults(search); return(View(results)); }
/// <summary> /// 検索条件の追加 /// </summary> /// <param name="sourceData">加工前の検索結果</param> /// <param name="filter">検索条件</param> private static IQueryable <TrainingHistory> Search(IQueryable <TrainingHistory> sourceData, SearchInputModel filter) { IQueryable <TrainingHistory> data = sourceData; data = data .SearchLong(d => d.Id, filter.Id) .SearchString(d => d.Name, filter.Name) .SearchTime(d => d.CreatedAt, filter.StartedAt) .SearchString(d => d.CreatedBy, filter.StartedBy) .SearchString(d => d.Memo, filter.Memo) .SearchString(d => d.EntryPoint, filter.EntryPoint) .SearchString(d => d.GetStatus().ToString(), filter.Status); // データセット名の検索 if (string.IsNullOrEmpty(filter.DataSet) == false) { if (filter.DataSet.StartsWith("!", StringComparison.CurrentCulture)) { data = data.Where(d => d.DataSet != null && d.DataSet.Name != null && d.DataSet.Name.Contains(filter.DataSet.Substring(1), StringComparison.CurrentCulture) == false); } else { data = data.Where(d => d.DataSet != null && d.DataSet.Name != null && d.DataSet.Name.Contains(filter.DataSet, StringComparison.CurrentCulture)); } } // 親学習IDの検索 if (string.IsNullOrEmpty(filter.ParentId) == false) { if (filter.ParentId.StartsWith(">=", StringComparison.CurrentCulture)) { if (long.TryParse(filter.ParentId.Substring(2), out long target)) { data = data.Where(d => d.ParentMaps != null && d.ParentMaps.Any(m => m.ParentId >= target)); } } else if (filter.ParentId.StartsWith(">", StringComparison.CurrentCulture)) { if (long.TryParse(filter.ParentId.Substring(1), out long target)) { data = data.Where(d => d.ParentMaps != null && d.ParentMaps.Any(m => m.ParentId > target)); } } else if (filter.ParentId.StartsWith("<=", StringComparison.CurrentCulture)) { if (long.TryParse(filter.ParentId.Substring(2), out long target)) { data = data.Where(d => d.ParentMaps != null && d.ParentMaps.Any(m => m.ParentId <= target)); } } else if (filter.ParentId.StartsWith("<", StringComparison.CurrentCulture)) { if (long.TryParse(filter.ParentId.Substring(1), out long target)) { data = data.Where(d => d.ParentMaps != null && d.ParentMaps.Any(m => m.ParentId < target)); } } else if (filter.ParentId.StartsWith("=", StringComparison.CurrentCulture)) { if (long.TryParse(filter.ParentId.Substring(1), out long target)) { data = data.Where(d => d.ParentMaps != null && d.ParentMaps.Any(m => m.ParentId == target)); } } else { if (long.TryParse(filter.ParentId, out long target)) { data = data.Where(d => d.ParentMaps != null && d.ParentMaps.Any(m => m.ParentId == target)); } } } // 親学習名の検索 if (string.IsNullOrEmpty(filter.ParentName) == false) { if (filter.ParentName.StartsWith("!", StringComparison.CurrentCulture)) { data = data.Where(d => d.ParentMaps == null || d.ParentMaps.Count == 0 || d.ParentMaps.All(m => m.Parent.Name.Contains(filter.ParentName.Substring(1), StringComparison.CurrentCulture) == false)); } else { data = data.Where(d => d.ParentMaps != null && d.ParentMaps.Any(m => m.Parent.Name.Contains(filter.ParentName, StringComparison.CurrentCulture))); } } // タグの検索 if (filter.Tags != null) { foreach (var tag in filter.Tags) { if (string.IsNullOrEmpty(tag) == false) { if (tag.StartsWith("!", StringComparison.CurrentCulture)) { data = data.Where(d => d.TagMaps == null || d.TagMaps.Count == 0 || d.TagMaps.All(m => m.Tag.Name.Contains(tag.Substring(1), StringComparison.CurrentCulture) == false)); } else { data = data.Where(d => d.TagMaps != null && d.TagMaps.Any(m => m.Tag.Name.Contains(tag, StringComparison.CurrentCulture))); } } } } return(data); }
/// <summary> /// 検索条件の追加 /// </summary> private static IQueryable <TrainingHistory> Search(IQueryable <TrainingHistory> sourceData, SearchInputModel filter) { IQueryable <TrainingHistory> data = sourceData; data = data .SearchLong(d => d.Id, filter.Id) .SearchString(d => d.Name, filter.Name) .SearchTime(d => d.CreatedAt, filter.StartedAt) .SearchString(d => d.Memo, filter.Memo) .SearchString(d => d.EntryPoint, filter.EntryPoint) .SearchString(d => d.GetStatus().ToString(), filter.Status); if (string.IsNullOrEmpty(filter.DataSet) == false) { if (filter.DataSet.StartsWith("!")) { data = data.Where(d => d.DataSet != null && d.DataSet.Name != null && d.DataSet.Name.Contains(filter.DataSet.Substring(1)) == false); } else { data = data.Where(d => d.DataSet != null && d.DataSet.Name != null && d.DataSet.Name.Contains(filter.DataSet)); } } return(data); }
public OperationReturnModel <CategoriesReturn> GetSubCategoriesByParentId(string id, [FromUri] SearchInputModel searchModel) { OperationReturnModel <CategoriesReturn> ret = new OperationReturnModel <CategoriesReturn>(); try { ret.SuccessResponse = _catalogLogic.GetCategories(searchModel.From, searchModel.Size, "BEK"); ret.IsSuccess = true; } catch (Exception ex) { ret.IsSuccess = false; ret.ErrorMessage = ex.Message; _elRepo.WriteErrorLog("GetCategories", ex); } return(ret); }
public List <MerchantSearchViewModel> SearchMerchant(SearchInputModel model) { return(_merchantService.Value.SearchMerchant(model)); }
public OperationReturnModel <ProductsReturn> GetProductsByHouseBrand(string brandControlLabel, [FromUri] SearchInputModel searchModel) { OperationReturnModel <ProductsReturn> ret = new OperationReturnModel <ProductsReturn>(); try { ProductsReturn prods = _catalogService.GetHouseProductsByBranch(this.SelectedUserContext, brandControlLabel, searchModel, this.AuthenticatedUser); prods.Products = FavoritesAndNotesHelper.GetFavoritesAndNotesFromLists(this.AuthenticatedUser, this.SelectedUserContext, prods.Products, _listService); ContractInformationHelper.GetContractCategoriesFromLists(SelectedUserContext, prods.Products, _listService); ret.SuccessResponse = prods; ret.IsSuccess = true; } catch (Exception ex) { ret.IsSuccess = false; ret.ErrorMessage = ex.Message; _elRepo.WriteErrorLog("GetHouseProductsByBranch", ex); } return(ret); }
public abstract SearchResultModel GetSearchResult(SearchInputModel searchInputModel);