• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# SearchModel类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中SearchModel的典型用法代码示例。如果您正苦于以下问题:C# SearchModel类的具体用法?C# SearchModel怎么用?C# SearchModel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SearchModel类属于命名空间,在下文中一共展示了SearchModel类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: List

        /* Creates the grid data */
        public ActionResult List(SearchParameter searchP, SearchModel searchModel)
        {            
            var model = _stores.AsQueryable();

            GridData data = model.ToGridData(searchModel, new[] { "Id", "Name", "Address" });
            return Json(data, JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:8,代码来源:EditingController.cs


示例2: TestSearchEmpty

 public void TestSearchEmpty()
 {
     SearchModel<Status> model = new SearchModel<Status>();
     SearchValidationResult res = model.IsValidSearchCombination();
     Assert.False(res.IsValid);
     Assert.AreEqual(StringResource.NO_VALUES_TO_SEARCH, res.Description);
 }
开发者ID:stampr,项目名称:stampr-api-csharp,代码行数:7,代码来源:SearchTest.cs


示例3: TestCombineSearch

        public void TestCombineSearch()
        {
            // create mock of MovieRepository and construct SearchHelper with it
              Mock<MovieRepository> repository = new Mock<MovieRepository>();
              repository.Setup(x => x.Select<MovieModel>()).Returns(movies.AsQueryable());
              SearchHelper searcher = new SearchHelper(repository.Object);

              // test cases

              //1
              SearchModel search1 = new SearchModel
              {
            MovieName = new SearchOption<string>(),
            Genre = new SearchOption<Genre>(),
            ActorLastName = new SearchOption<string>(),
              };
              List<MovieModel> result1 = searcher.Search(search1);
              Assert.IsTrue(result1.Count == 3);
              Assert.IsTrue(result1.Where(x => x.Name == movies[0].Name).Any());
              Assert.IsTrue(result1.Where(x => x.Name == movies[1].Name).Any());
              Assert.IsTrue(result1.Where(x => x.Name == movies[2].Name).Any());

              //2
              SearchModel search2 = new SearchModel
              {
            MovieName = new SearchOption<string>(),
            Genre = new SearchOption<Genre> { Value = Genre.Drammatic, IsCritical = true },
            ActorLastName = new SearchOption<string> { Value = "Стоун", IsCritical = true },
              };
              List<MovieModel> result2 = searcher.Search(search2);
              Assert.IsTrue(result2.Count == 1);
              Assert.IsTrue(result2.Where(x => x.Name == movies[1].Name).Any());
        }
开发者ID:pavelsavrovsky,项目名称:movie_search,代码行数:33,代码来源:SearchHelperTest.cs


示例4: Search

        public ActionResult Search(SearchModel model)
        {
            ITwitterClient twitterClient = new TwitterClient();
            var tweetRepository = new TweetPageRepository();
            var cachedPage = tweetRepository.GetPageBySearchString(model.HashtagToSearchFor, model.PageToRetrieve);
            if (cachedPage != null)
            {
                return PartialView(cachedPage.ToModel(model.PageToRetrieve, PAGE_SIZE, model.HashtagToSearchFor));
            }

            int twitterPage = (int)Math.Ceiling(model.PageToRetrieve / (float)PAGE_SIZE);

            var searchResults = twitterClient.SearchByHashtag(model.HashtagToSearchFor, CACHE_SIZE, twitterPage);
            int pageCount = (int)Math.Ceiling(searchResults.Count()/(decimal)PAGE_SIZE);
            int cachePageRangeStart = ((twitterPage - 1) * PAGE_SIZE) + 1;

            var searchResultPages = Enumerable.Range(0, pageCount)
                    .Select(pageNo => searchResults.Skip(pageNo * PAGE_SIZE).Take(PAGE_SIZE))
                    .Select((page, pageNo) => page.ToRepositoryContract(cachePageRangeStart + pageNo, PAGE_SIZE, model.HashtagToSearchFor));

            tweetRepository.ReplacePages(searchResultPages);

            var currentPageResult = searchResultPages.FirstOrDefault(page => page.Page == model.PageToRetrieve);
            return PartialView(currentPageResult.ToModel(model.PageToRetrieve, PAGE_SIZE, model.HashtagToSearchFor));
        }
开发者ID:JimmyHoffa,项目名称:20HourChallenge,代码行数:25,代码来源:MVCController.cs


示例5: SearchModule

        public SearchModule () 
        {
            Get ["/search"] = parameters => {
                SearchModel model = new SearchModel();
                model.Planeswalker = ((Planeswalker)this.Context.CurrentUser);
                model.ActiveMenu = "search";

                return View["Search", model];
            };

            Post ["/search"] = parameters => {
                SearchModel model = this.Bind<SearchModel>();
                model.Planeswalker = ((Planeswalker)this.Context.CurrentUser);
                UserCard [] walkerCards = null;

                try
                {
                    Card[] cards = magicdb.Search(model.Term);
                    model.ActiveMenu = "search";

                    cards = cards
                        .AsEnumerable()
                        .OrderBy(x => x.Name)
                        .ThenByDescending(x => x.ReleasedAt).ToArray();

                    if(model.Planeswalker != null)
                    {
                        int [] cardIds = cards.AsEnumerable().Select(c => c.Id).ToArray();
                        walkerCards = repository.GetUserCards(model.Planeswalker.Id,cardIds);
                    }

                    foreach(var c in cards)
                    {
                        CardInfo cardInfo = new CardInfo();

                        if(walkerCards != null && walkerCards.Length > 0)
                        {
                            cardInfo.Amount = walkerCards.AsEnumerable()
                                .Where(info => info.MultiverseId == c.Id)
                                .Select(info => info.Amount).FirstOrDefault();

                        }
                        else
                        {
                            cardInfo.Amount = 0;
                        }

                        cardInfo.Card = c;
                        model.Cards.Add(cardInfo);
                    }
                }
                catch(Exception e)
                {
                    model.Errors.Add(e.Message);
                }
               
                return View["Search", model];
            };
        }
开发者ID:jesseflorig,项目名称:www.mtgdb.info,代码行数:59,代码来源:SearchModule.cs


示例6: ChildList

        public ActionResult ChildList(int productId, SearchModel searchModel)
        {
            StoreRepository rep = new StoreRepository();
            List<Store> stores = rep.GetByProductId(productId);

            var model = stores.AsQueryable();
            return Json(model.ToGridData(searchModel, new[] { "Id", "Name", "Address" }), JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:8,代码来源:HomeController.cs


示例7: SetSearch

 public void SetSearch(SearchModel searchRouter)
 {
     base.SetSearch(searchRouter);
     this.SearchBytitleCh = searchRouter.SearchBytitleCh;
     this.SearchBytitleEng = searchRouter.SearchBytitleEng;
     this.SearchByteacherName = searchRouter.SearchByteacherName;
     this.SearchBySkill = searchRouter.SearchBySkill;
 }
开发者ID:mcyang,项目名称:APISTest,代码行数:8,代码来源:fvmRDRManage.cs


示例8: Search

        public static IQueryable<RentCrib> Search(SearchModel queryParams)
        {
            Stack<Expression<Func<RentCrib, bool>>> filters = BuildFilters(queryParams);

            IQueryable<RentCrib> list = Db.RentCribs.Where(x => x.Active).OrderBy(x => x.DatePost);
            var filtered = ApplyFilters(list, filters);
            return filtered;
        }
开发者ID:goementhomiwa,项目名称:Cribs,代码行数:8,代码来源:CribSearch.cs


示例9: List

        public ActionResult List(SearchModel searchModel)
        {
            ProductRepository repository = new ProductRepository();

            List<Product> products = repository.ListAll();

            return Json(products.AsQueryable().ToGridData(searchModel, new[] { "Id", "Name", "CompanyName", "Price" }), JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:8,代码来源:HomeController.cs


示例10: List

        /* Notice the List methid accepts an additional
         * SearchParameter parameter - this is achieved using the -
         * Html.BuildQuery method used in the view Grid declaration */
        public ActionResult List(SearchParameter searchP, SearchModel searchModel)
        {
            StoreRepository repository = new StoreRepository();

            List<Store> stores = repository.ListAll();

            var model = stores.AsQueryable();
            return Json(model.ToGridData(searchModel, new[] { "Id", "Name", "Address" }), JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:12,代码来源:SearchController.cs


示例11: Search

        public ActionResult Search(string name, string comm, string addr)
        {
            if (!Authenticate(checkOrgLeadersOnly: true))
                return Content("not authorized");
            Response.NoCache();

            var m = new SearchModel(name, comm, addr);
            return new SearchResult0(m.PeopleList(), m.Count());
        }
开发者ID:GSBCfamily,项目名称:bvcms,代码行数:9,代码来源:APIiPhoneController.cs


示例12: ListNodes

 /// <summary>
 /// grid显示函数
 /// </summary>
 /// <param name="searchModel">grid搜索模型</param>
 /// <returns>程序功能节点</returns>
 public ActionResult ListNodes(SearchModel searchModel)
 {
     IQueryable<GeneralProgNode> oPrograms = dbEntity.GeneralProgNodes.Include("Name").Where(p => p.Deleted == false && p.ProgID == progNodeGidGrid).AsQueryable();
     GridColumnModelList<GeneralProgNode> columns = new GridColumnModelList<GeneralProgNode>();
     columns.Add(p => p.Gid).SetAsPrimaryKey();
     columns.Add(p => p.Code);
     columns.Add(p => p.Name.GetResource(CurrentSession.Culture)).SetName("Name.Matter");
     columns.Add(p => (p.Optional == null) ? "": p.Optional.GetResource(CurrentSession.Culture)).SetName("Optional.Matter");
     GridData gridData = oPrograms.ToGridData(searchModel, columns);
     return Json(gridData, JsonRequestBehavior.AllowGet);
 }
开发者ID:NH4CL,项目名称:UniProject,代码行数:16,代码来源:ProgramController.cs


示例13: Index

        public ActionResult Index(FormCollection form  )
        {
            var model = new SearchModel { City = form["City"], Zip = form["Zip"], };
            if (ModelState.IsValid)
            {

                return RedirectToAction("Index", "Results");
            }
            ModelState.AddModelError(string.Empty, "Oops,  " + string.Join(" ; ", ModelState.Values.SelectMany(x => x.Errors).Select(x => x.ErrorMessage)));
            return View(model);
        }
开发者ID:tosca,项目名称:Hyatt,代码行数:11,代码来源:SearchController.cs


示例14: ListPersons

        /* Creates the grid data */
        public ActionResult ListPersons(SearchModel searchModel)
        {
            List<Person> stores = _persons;

            IQueryable<Person> model =
                (from Person p in stores
                select p).AsQueryable();

            GridData gridData = model.ToGridData(searchModel, Columns.PersonColumns);

            return Json(gridData, JsonRequestBehavior.AllowGet);
        }
开发者ID:haithemaraissia,项目名称:MVCContribute,代码行数:13,代码来源:RenderersController.cs


示例15: SearchResults

        public ActionResult SearchResults(string name, string comm, string addr)
        {
            if (!Authenticate(checkOrgLeadersOnly: true))
                return Content("not authorized");
            if (!CMSRoleProvider.provider.IsUserInRole(AccountModel.UserName2, "Access"))
                return Content("not authorized");
            Response.NoCache();

            DbUtil.LogActivity($"iphone search '{name}'");
            var m = new SearchModel(name, comm, addr);
            return new SearchResult(m.PeopleList(), m.Count());
        }
开发者ID:GSBCfamily,项目名称:bvcms,代码行数:12,代码来源:APIiPhoneController.cs


示例16: ListProgs

        public ActionResult ListProgs(SearchModel searchModel)
        {
            IQueryable<GeneralProgNode> oPrograms = dbEntity.GeneralProgNodes.Include("Name").Where(p => p.Deleted == false).AsQueryable();
            int i = 2052;
            GridColumnModelList<GeneralProgNode> columns = new GridColumnModelList<GeneralProgNode>();
            columns.Add(p => p.Gid).SetAsPrimaryKey();
            columns.Add(p => p.Name.GetResource(i)).SetName("Name.Matter");
            columns.Add(p => p.Code);

            GridData gridData = oPrograms.ToGridData(searchModel, columns);
            return Json(gridData, JsonRequestBehavior.AllowGet);
        }
开发者ID:NH4CL,项目名称:UniProject,代码行数:12,代码来源:HomeController.cs


示例17: TestSearchMissingEndTimeForPaging

        public void TestSearchMissingEndTimeForPaging()
        {
            DateTime date = DateTime.Now;
            SearchModel<Status> model = new SearchModel<Status>()
            {
                Start = date,
                Paging = 10
            };

            SearchValidationResult res = model.IsValidSearchCombination();
            Assert.False(res.IsValid);
            Assert.AreEqual(StringResource.START_END_VALUES_SHOULD_BE_SPECIFIED, res.Description);
        }
开发者ID:stampr,项目名称:stampr-api-csharp,代码行数:13,代码来源:SearchTest.cs


示例18: TestSearchMissingStartTime

        public void TestSearchMissingStartTime()
        {
            DateTime date = DateTime.Now;
            SearchModel<Status> model = new SearchModel<Status>()
            {
                Status = Status.hold,
                End = date.AddMinutes(5)
            };

            SearchValidationResult res = model.IsValidSearchCombination();
            Assert.False(res.IsValid);
            Assert.AreEqual(StringResource.START_VALUE_SHOULD_BE_SPECIFIED, res.Description);
        }
开发者ID:stampr,项目名称:stampr-api-csharp,代码行数:13,代码来源:SearchTest.cs


示例19: BuildFilters

        public static Stack<Expression<Func<RentCrib, bool>>> BuildFilters(SearchModel queryParams)
        {
            Stack<Expression<Func<RentCrib, bool>>> filters = new Stack<Expression<Func<RentCrib, bool>>>();
            Expression<Func<RentCrib, bool>> inPriceRange;

            if (queryParams.MinPrice != null && queryParams.MaxPrice == null)
            {
                inPriceRange = c => c.MonthlyPrice >= queryParams.MinPrice;
                filters.Push(inPriceRange);
            }
            else if (queryParams.MinPrice == null && queryParams.MaxPrice != null)
            {
                inPriceRange = c => c.MonthlyPrice <= queryParams.MaxPrice;
                filters.Push(inPriceRange);
            }
            else if (queryParams.MinPrice != null && queryParams.MaxPrice != null)
            {
                inPriceRange = c => c.MonthlyPrice >= queryParams.MinPrice && c.MonthlyPrice <= queryParams.MaxPrice;
                filters.Push(inPriceRange);
            }

            if (queryParams.NumberOfRooms != null)
            {
                Expression<Func<RentCrib, bool>> numberOfRoomsFilter = c => c.NumberOfRooms == queryParams.NumberOfRooms;
                filters.Push(numberOfRoomsFilter);
            }

            if (queryParams.Address != null)
            {
                Expression<Func<RentCrib, bool>> addressFilter = c => c.Location.ToUpper().Contains(queryParams.Address.ToUpper());
                filters.Push(addressFilter);
            }

            if (queryParams.KeyWord != null)
            {
                var phrase = queryParams.KeyWord;
                var tokens = phrase.Split(' ');
                foreach (var token in tokens)
                {
                    var token1 = token;
                    Expression<Func<RentCrib, bool>> phraseFilter = c =>
                        (c.Title.ToUpper().Contains(token1.ToUpper())) ||
                        (c.Description.ToUpper().Contains(token1.ToUpper()));
                    filters.Push(phraseFilter);

                }

            }

            return filters;
        }
开发者ID:goementhomiwa,项目名称:Cribs,代码行数:51,代码来源:CribSearch.cs


示例20: Index

        public ActionResult Index(SearchModel searchModel)
        {
            string sql = @"select top  " + MaxRowSize + @"  e.BatchNo, d.*,
                        a.OrderNo,a.Item,a.Uom,a.IsCS,a.PlanBill,a.ActBill,a.QualityType, 
                        a.Qty,b.Type,b.Status,a.TransType,b.ExtOrderNo,
                        a.PartyFrom,a.LocFrom,a.PartyTo,b.LocTo,e.*
                        from sconit5_New.dbo.VIEW_LocTrans a
                        left join sconit5_New.dbo.ORD_OrderMstr b on a.OrderNo = b.OrderNo
                        left join sconit5_si.dbo.SAP_InvLoc c on c.SourceId = a.Id
                        left join sconit5_si.dbo.SAP_InvTrans e on (e.FRBNR = c.FRBNR and e.SGTXT = c.SGTXT)
                        left join sconit5_si.dbo.SAP_TransCallBack d on (d.FRBNR = c.FRBNR and d.SGTXT = c.SGTXT)
                        where d.Id>0 and c.SourceType = 0  and e.Status = @p0 and e.CreateDate > @p1 and e.CreateDate < @p2 ";

            TempData["SearchModel"] = searchModel;

            SqlParameter[] sqlParam = new SqlParameter[4];
            sqlParam[0] = new SqlParameter("@p0", searchModel.Status.HasValue ? searchModel.Status.Value : 2);

            if (searchModel.StartDate.HasValue)
            {
                sqlParam[1] = new SqlParameter("@p1", searchModel.StartDate);
            }
            else
            {
                sqlParam[1] = new SqlParameter("@p1", DateTime.Now.AddDays(-1));
            }

            if (searchModel.EndDate.HasValue)
            {
                sqlParam[2] = new SqlParameter("@p2", searchModel.EndDate);
            }
            else
            {
                sqlParam[2] = new SqlParameter("@p2", DateTime.Now);
            }

            if (searchModel.Id.HasValue)
            {
                sql += " and e.Id = @p3 ";
                sqlParam[3] = new SqlParameter("@p3", searchModel.Id);
            }

            sql += " order by d.Id desc ";

            DataSet entity = genericMgr.GetDatasetBySql(sql, sqlParam);

            ViewModel model = new ViewModel();
            model.Data = entity.Tables[0];
            model.Columns = IListHelper.GetColumns(entity.Tables[0]);
            return View(model);
        }
开发者ID:Novthirteen,项目名称:sih-les,代码行数:51,代码来源:SAPTransController.cs



注:本文中的SearchModel类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SearchOption类代码示例发布时间:2022-05-24
下一篇:
C# SearchMode类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap