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); }
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)); }
/* 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); }
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()); }
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]; }; }
public void SetSearch(SearchModel searchRouter) { base.SetSearch(searchRouter); this.SearchBytitleCh = searchRouter.SearchBytitleCh; this.SearchBytitleEng = searchRouter.SearchBytitleEng; this.SearchByteacherName = searchRouter.SearchByteacherName; this.SearchBySkill = searchRouter.SearchBySkill; }
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); }
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); }
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; }
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()); }
/* 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); }
/// <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); }
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); }
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()); }
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); }
/* 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); }
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); }
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); }
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; }
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); }
public JsonResult Search(SearchModel model) { List<MovieModel> movies = searchHelper.Search(model); var data = movies.Select(x => new { Name = x.Name, Genre = GenreHelper.Description(x.Genre), Actors = x.Actors.Select(a => new { Name = a.Name, LastName = a.LastName }) }); return Json(data); }
public JsonResult Search(SearchModel searchCriteria) { var uriString = string.Format(serviceBaseUri + @"/Search?firstName={0}&lastName={1}&email={2}&phone={3}&occupationName={4}&occupationDescription={5}&instituteName={6}&instituteLocation={7}&qualification={8}&yearOfGradutation={9}&address={10}&state={11}&city={12}&country={13}&postcode={14}&preferedName={15}&houseName={16}&branch={17}&matchAllCriteria={18}" ,searchCriteria.FirstName, searchCriteria.LastName,searchCriteria.Email,searchCriteria.Phone,searchCriteria.OccupationName,searchCriteria.OccupationDescription ,searchCriteria.InstituteName,searchCriteria.InstituteLocation,searchCriteria.Qualification,searchCriteria.YearOfGraduation ,searchCriteria.Address,searchCriteria.State,searchCriteria.City,searchCriteria.Country,searchCriteria.Postcode ,searchCriteria.PreferedName,searchCriteria.HouseName,searchCriteria.Branch,true); var constituentsData = HttpHelper.Get<ConstituentsData>(uriString); mapper = new AutoDataContractMapper(); var constituents = new Constituents(); mapper.MapList(constituentsData, constituents,typeof(Constituent)); ViewData["Constituents"] = constituents; return this.Json(constituents); }
public ActionResult Datatable(SearchModel model) { if (string.IsNullOrWhiteSpace(model.SearchName) == false) { var people = _personData.GetPersonByName(model.SearchName); if (people.Any()) { var json = from p in people select new[] { p.rowguid.ToString(), p.FirstName + " " + p.MiddleName + " " + p.LastName, model.Admin ? p.PersonCreditCards.Any().ToString() : "false" }; model.JsonResults = new JavaScriptSerializer().Serialize(json); } } return View(model); }
public void TestSearchValidAll() { DateTime date = DateTime.Now; SearchModel<Status> model = new SearchModel<Status>() { Status = Status.hold, End = date.AddMinutes(5), Start = date, Paging = 10 }; SearchValidationResult res = model.IsValidSearchCombination(); Assert.True(res.IsValid); string[] searchArray = model.PropertiesToSearch(); Assert.AreEqual("with", searchArray[0]); Assert.AreEqual(Status.hold.ToString(), searchArray[1]); Assert.AreEqual(date.ToUniversalTime().ToString(_dateFormat), searchArray[2]); Assert.AreEqual(date.ToUniversalTime().AddMinutes(5).ToString(_dateFormat), searchArray[3]); Assert.AreEqual("10", searchArray[4]); }
/// <summary> /// ActionList函数 /// </summary> /// <param name="seachModel">searchModel</param> /// <returns>返回Json数据</returns> public ActionResult ActionList(SearchModel seachModel) { try { IQueryable<GeneralAction> actions = dbEntity.GeneralActions.AsQueryable(); GridColumnModelList<GeneralAction> columns = new GridColumnModelList<GeneralAction>(); columns.Add(p => p.Gid).SetAsPrimaryKey(); columns.Add(p => p.ActID); columns.Add(p => p.ActionSourceName); columns.Add(p => p.ClassName); columns.Add(p => p.RefTypeName); columns.Add(p => p.RefID); columns.Add(p => p.ActionLevelName); columns.Add(p => p.Matter); columns.Add(p => p.Keyword); GridData gridData = actions.ToGridData(seachModel, columns); return Json(gridData, JsonRequestBehavior.AllowGet); } catch { return RedirectToAction("Error"); } }
public JsonResult Search(SearchModel entity) { List <BaiViet> listBaiViet = new List <BaiViet>(); var res = db.BaiViets.ToList(); //Search Quan Quan q = db.Quans.Find(entity.idQuan); Phuong p = db.Phuongs.Find(entity.idPhuong); KieuBD k = db.KieuBDS.Find(entity.idBDS); LoaiBD l = db.LoaiBDS.Find(entity.idLoaiBDS); string temp = ""; if (q == null) { temp = ""; } else { temp = q.TenQuan; } if (p == null) { temp = temp; } else { temp += " " + p.TenPhuong; } if (l == null) { temp = temp; } else { temp += " " + l.TenLoai; } if (k == null) { temp = temp; } else { temp += " " + k.TenKieu; } var listNT = db.NhaTroes.SqlQuery("select * from NhaTro n where n.SoNha like N'%" + temp + "%'").ToList(); foreach (var item in res) { foreach (var item1 in listNT) { if (item.idNT == item1.idNT) { listBaiViet.Add(item); } } } //string tempJ = string.Empty; //tempJ = JsonConvert.SerializeObject(listBaiViet, Formatting.Indented, new JsonSerializerSettings //{ // ReferenceLoopHandling = ReferenceLoopHandling.Ignore //}); return(Json(listBaiViet, JsonRequestBehavior.AllowGet)); }
public ActionResult EditDeck(DeckModel model, int id, string search, string next, string prev, string save) { SearchModel searchModel = model.SearchModel; DeckDetailsModel deckDetailsModel = model.DeckDetails; Validate(ref searchModel); Validate(ref deckDetailsModel); if (id > 0) { DeckDetailsModel deckDetails = Session["DeckDetailsModel"] as DeckDetailsModel; if (DeckDetailsModel.IsEmpty(deckDetails)) { var tuple = DataManager.LoadDeck(id); var deck = tuple.Item1; var cards = tuple.Item2; deckDetails = new DeckDetailsModel() { DeckName = deck.DeckName, DeckDescription = deck.DeckDescription, CardItems = cards.Select(x => new CardItem() { CardID = x.CardId, Quantity = x.CardQuantity, Name = x.CardName }).ToList() }; deckDetailsModel = deckDetails; } } else { deckDetailsModel.CardItems = Session["CardItems"] as List <CardItem>; } if (!string.IsNullOrWhiteSpace(next)) { searchModel = Session["SearchModel"] as SearchModel; if (searchModel.Data.HasMore.HasValue) { if (searchModel.Data.HasMore.Value) { if (searchModel.Page <= 1) { searchModel.Page = 1; } searchModel.Page++; } } } if (!string.IsNullOrWhiteSpace(prev)) { searchModel = Session["SearchModel"] as SearchModel; if (searchModel.Page <= 1) { searchModel.Page = 1; } searchModel.Page--; } if (!string.IsNullOrWhiteSpace(search)) { } if (!string.IsNullOrWhiteSpace(save)) { deckDetailsModel.CardItems = Session["CardItems"] as List <CardItem>; if (id == 0) { id = DataManager.CreateDeck(model.DeckDetails.DeckName, model.DeckDetails.DeckDescription, deckDetailsModel.CardItems); ClearSession(); return(RedirectToAction("Edit", "Decks", id)); } else if (id >= 0) { DataManager.SaveDeck(id, model.DeckDetails.DeckName, model.DeckDetails.DeckDescription, deckDetailsModel.CardItems); ClearSession(); return(RedirectToAction("Edit", "Decks", id)); } } searchModel.Search(); Session["SearchModel"] = searchModel; Session["DeckDetailsModel"] = deckDetailsModel; Session["CardItems"] = deckDetailsModel.CardItems; model.DeckDetails = deckDetailsModel; model.SearchModel = searchModel; SetImages(searchModel.Data); return(View("Edit", model)); }
public async Task <ApiResponse <ProviderVersionSearchResults> > SearchProvidersInProviderVersion(string providerVersionId, SearchModel searchModel) { Guard.IsNullOrWhiteSpace(providerVersionId, nameof(providerVersionId)); Guard.ArgumentNotNull(searchModel, nameof(searchModel)); return(await PostAsync <ProviderVersionSearchResults, SearchModel>($"providers/versions-search/{providerVersionId}", searchModel)); }
public async Task <ApiResponse <ProviderVersionSearchResults> > SearchCurrentProviderVersionForFundingStream(string fundingStreamId, SearchModel search) { Guard.IsNullOrWhiteSpace(fundingStreamId, nameof(fundingStreamId)); Guard.ArgumentNotNull(search, nameof(search)); return(await PostAsync <ProviderVersionSearchResults, SearchModel>($"providers/fundingstreams/{fundingStreamId}/current/search", search)); }
/// <summary> /// 查询交易数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnSearch_Click(object sender, EventArgs e) { try { this.btnSearch.Enabled = false; this.btnClear.Enabled = false; _searchCondition = new SearchModel(); //股票代码 var stockInfo = this.luStock.GetSelectedDataRow() as StockInfoModel; _searchCondition.StockCode = (stockInfo == null || stockInfo.Id == 0) ? string.Empty : this.luStock.SelectedValue(); //账号ID _searchCondition.AccountId = luAccount.EditValue == null ? 0 : int.Parse(luAccount.EditValue.ToString()); //导入人 _searchCondition.ImportUser = luImport.EditValue == null ? null : luImport.EditValue.ToString(); //买卖标志 if (chkBuy.Checked) { _searchCondition.DealFlag = true; } else if (chkSell.Checked) { _searchCondition.DealFlag = false; } //导入日期 if (deImportFrom.EditValue == null) { _searchCondition.ImportDateFrom = null; } else { _searchCondition.ImportDateFrom = CommonHelper.StringToDateTime(deImportFrom.EditValue.ToString()); } if (deImportTo.EditValue == null) { _searchCondition.ImportDateTo = null; } else { _searchCondition.ImportDateTo = CommonHelper.StringToDateTime(deImportTo.EditValue.ToString()); } //交易日期 if (deTradeFrom.EditValue == null) { _searchCondition.TradeDateFrom = null; } else { _searchCondition.TradeDateFrom = CommonHelper.StringToDateTime(deTradeFrom.EditValue.ToString()); } if (deTradeTo.EditValue == null) { _searchCondition.TradeDateTo = null; } else { _searchCondition.TradeDateTo = CommonHelper.StringToDateTime(deTradeTo.EditValue.ToString()); } BindDeliveryRecord(_searchCondition); } catch (Exception ex) { DXMessage.ShowError(ex.Message); } finally { this.btnSearch.Enabled = true; this.btnClear.Enabled = true; } }
public ActionResult GetList(SearchModel search, PageParam pageParam) { PageData <AdminUserDto> pageData = _helper.GetPageList(search, o => o.Id, pageParam, true); return(Success(pageData)); }
public ActionResult Index() { var model = new SearchModel(); return(View(model)); }
public async Task <PagingResult <IHotelWithLinks> > GetPagingWithLinks(int page, int pageSize, SearchModel filter) { using (var cp = ContextProviderFactory.Create()) { var paging = await Get(page, pageSize, filter); var services = await GetLink <HotelServiceType>(paging.Items, hst => paging.Items.Select(t => t.Id).Contains(hst.HotelId)); var equipments = await GetLink <HotelEquipmentType>(paging.Items, hst => paging.Items.Select(t => t.Id).Contains(hst.HotelId)); return(new PagingResult <IHotelWithLinks>() { Total = paging.Total, Items = paging.Items.Select(t => new HotelWithLinks() { ServiceTypes = services.Where(w => w.HotelId == t.Id).Select(s => s.ServiceTypeId), EquipmentTypes = equipments.Where(w => w.HotelId == t.Id).Select(s => s.EquipmentTypeId), Hotel = t, }).ToArray() }); } }
public ActionResult GetList(SearchModel seachModel, PageParam pageParam) { PageData <SubscribeDto> pageData = _helper.GetPageList(seachModel, o => o.TeachTime, pageParam, false, true); return(Success(pageData)); }
public ActionResult SearchResults(string searchText) { var model = new SearchModel() { IsConfirmed = _accountRepository.GetUser(_accountRepository.FindById(User.Identity.GetUserId()).Email).EMailConfirmed, SearchText = searchText, }; if (!model.IsConfirmed) { return(View("SearchResults", model)); } var searchResultRows = new List <SearchResultRowModel>(); var initiativeHeads = _initiativeBusiness.GetInitiativesByDeveloper(_accountRepository.FindById(User.Identity.GetUserId()).Email); var initiatives = _initiativeBusiness.GetInitiatives().ToArray(); var userInitiatives = initiativeHeads.Select(initiativeHead => initiatives.Single(x => x.Id == initiativeHead.Id)).ToArray(); foreach (var initiative in userInitiatives) { var applications = initiative.ApplicationGroups.SelectMany(x => x.Applications).ToArray(); var initiativeUniqueIdentifier = initiative.GetUniqueIdentifier(initiatives.Select(x => x.Name)); var versions = new List <IApplicationVersion>(); foreach (var application in applications) { versions.AddRange(_applicationVersionBusiness.GetApplicationVersions(application.Id)); } foreach (var version in versions) { foreach (var issueType in version.IssueTypes) { if (issueType.Ticket.ToString().Equals(searchText)) { foreach (var issue in issueType.Issues) { searchResultRows.Add(new SearchResultRowModel() { InitiativeName = initiative.Name, InitiativeUniqueIdentifier = initiativeUniqueIdentifier, ApplicationName = applications.Single(x => x.Id == version.ApplicationId).Name, Version = version.Version, VersionUniqueIdentifier = version.GetUniqueIdentifier(versions.Select(x => x.Version)), IssueType = issueType, Issue = issue, Environment = GetSession(issue.SessionId).Environment, }); } } else { foreach (var issue in issueType.Issues) { if (issue.Ticket.ToString().Equals(searchText)) { searchResultRows.Add(new SearchResultRowModel() { InitiativeName = initiative.Name, InitiativeUniqueIdentifier = initiativeUniqueIdentifier, ApplicationName = applications.Single(x => x.Id == version.ApplicationId).Name, Version = version.Version, VersionUniqueIdentifier = version.GetUniqueIdentifier(versions.Select(x => x.Version)), IssueType = issueType, Issue = issue, Environment = GetSession(issue.SessionId).Environment, }); } else { if (!string.IsNullOrEmpty(issueType.ExceptionTypeName)) { if (issueType.ExceptionTypeName.Contains(searchText)) { searchResultRows.Add(new SearchResultRowModel() { InitiativeName = initiative.Name, InitiativeUniqueIdentifier = initiativeUniqueIdentifier, ApplicationName = applications.Single(x => x.Id == version.ApplicationId).Name, Version = version.Version, VersionUniqueIdentifier = version.GetUniqueIdentifier(versions.Select(x => x.Version)), IssueType = issueType, Issue = issue, Environment = GetSession(issue.SessionId).Environment, }); } } } } } } } } var allEnvironments = _initiativeBusiness.GetEnvironmentColors(User.Identity.GetUserId(), _accountRepository.FindById(User.Identity.GetUserId()).UserName); var environmentsInResult = searchResultRows.Select(x => x.Environment).Distinct(); var environments = new List <EnvironmentViewModel>(); foreach (var env in environmentsInResult) { if (allEnvironments.ContainsKey(env)) { string color; allEnvironments.TryGetValue(env, out color); environments.Add(new EnvironmentViewModel() { Name = env, Color = color, }); } } model.SearchResultRows = searchResultRows; model.Environments = environments; return(View("SearchResults", model)); }
public ActionResult FetchPeople(string data) { // Authenticate first var result = AuthenticateUser(); if (!result.IsValid) return AuthorizationError(result); BaseMessage dataIn = BaseMessage.createFromString(data); MobilePostSearch mps = JsonConvert.DeserializeObject<MobilePostSearch>(dataIn.data); BaseMessage br = new BaseMessage(); var m = new SearchModel(mps.name, mps.comm, mps.addr); br.setNoError(); br.count = m.Count; switch (dataIn.device) { case BaseMessage.API_DEVICE_ANDROID: { Dictionary<int, MobilePerson> mpl = new Dictionary<int, MobilePerson>(); MobilePerson mp; foreach (var item in m.ApplySearch().OrderBy(p => p.Name2).Take(100)) { mp = new MobilePerson().populate(item); mpl.Add(mp.id, mp); } br.data = SerializeJSON(mpl, dataIn.version); break; } case BaseMessage.API_DEVICE_IOS: { List<MobilePerson> mp = new List<MobilePerson>(); foreach (var item in m.ApplySearch().OrderBy(p => p.Name2).Take(100)) { mp.Add(new MobilePerson().populate(item)); } br.data = SerializeJSON(mp, dataIn.version); break; } } return br; }
/// <summary> /// GeneralOptional Grid列表 /// </summary> /// <param name="optionalItemSearchModel"></param> /// <returns></returns> public ActionResult OptionalList(SearchModel optionalItemSearchModel) { Guid OrgID=GetOrganization(); IQueryable<GeneralOptional> oGeneralOptional = dbEntity.GeneralOptionals.Include("Name").Where(g => g.Deleted == false && g.OrgID == ((orgId == null) ? OrgID : orgId)).AsQueryable(); GridColumnModelList<GeneralOptional> columns = new GridColumnModelList<GeneralOptional>(); columns.Add(p => p.Gid).SetAsPrimaryKey(); columns.Add(p => p.Otype); columns.Add(p => p.Code); columns.Add(p => p.Name.GetResource(CurrentSession.Culture)).SetName("Name"); columns.Add(p => p.Sorting); columns.Add(p => p.InputMode); GridData optionalItemGridData = oGeneralOptional.ToGridData(optionalItemSearchModel, columns); return Json(optionalItemGridData, JsonRequestBehavior.AllowGet); }
public ActionResult <List <SmsModel> > Post([FromBody] SearchModel model) { _smsService.Search(model.MapTo <SearchModel, SearchSmsModel>()); return(_smsService.SmsList); }
/// <summary> /// Prepare search model /// </summary> /// <param name="model">Search model</param> /// <param name="command">Catalog paging filtering command</param> /// <returns>Search model</returns> public virtual SearchModel PrepareSearchModel(SearchModel model, CatalogPagingFilteringModel command) { if (model == null) { throw new ArgumentNullException(nameof(model)); } var searchTerms = model.q; if (searchTerms == null) { searchTerms = ""; } searchTerms = searchTerms.Trim(); //sorting PrepareSortingOptions(model.PagingFilteringContext, command); //view mode PrepareViewModes(model.PagingFilteringContext, command); //page size PreparePageSizeOptions(model.PagingFilteringContext, command, _catalogSettings.SearchPageAllowCustomersToSelectPageSize, _catalogSettings.SearchPagePageSizeOptions, _catalogSettings.SearchPageProductsPerPage); var cacheKey = string.Format(ModelCacheEventConsumer.SEARCH_CATEGORIES_MODEL_KEY, _workContext.WorkingLanguage.Id, string.Join(",", _workContext.CurrentCustomer.GetCustomerRoleIds()), _storeContext.CurrentStore.Id); var categories = _cacheManager.Get(cacheKey, () => { var categoriesModel = new List <SearchModel.CategoryModel>(); //all categories var allCategories = _categoryService.GetAllCategories(storeId: _storeContext.CurrentStore.Id); foreach (var c in allCategories) { //generate full category name (breadcrumb) var categoryBreadcrumb = ""; var breadcrumb = _categoryService.GetCategoryBreadCrumb(c, allCategories); for (var i = 0; i <= breadcrumb.Count - 1; i++) { categoryBreadcrumb += _localizationService.GetLocalized(breadcrumb[i], x => x.Name); if (i != breadcrumb.Count - 1) { categoryBreadcrumb += " >> "; } } categoriesModel.Add(new SearchModel.CategoryModel { Id = c.Id, Breadcrumb = categoryBreadcrumb }); } return(categoriesModel); }); if (categories.Any()) { //first empty entry model.AvailableCategories.Add(new SelectListItem { Value = "0", Text = _localizationService.GetResource("Common.All") }); //all other categories foreach (var c in categories) { model.AvailableCategories.Add(new SelectListItem { Value = c.Id.ToString(), Text = c.Breadcrumb, Selected = model.cid == c.Id }); } } var manufacturers = _manufacturerService.GetAllManufacturers(storeId: _storeContext.CurrentStore.Id); if (manufacturers.Any()) { model.AvailableManufacturers.Add(new SelectListItem { Value = "0", Text = _localizationService.GetResource("Common.All") }); foreach (var m in manufacturers) { model.AvailableManufacturers.Add(new SelectListItem { Value = m.Id.ToString(), Text = _localizationService.GetLocalized(m, x => x.Name), Selected = model.mid == m.Id }); } } model.asv = _vendorSettings.AllowSearchByVendor; if (model.asv) { var vendors = _vendorService.GetAllVendors(); if (vendors.Any()) { model.AvailableVendors.Add(new SelectListItem { Value = "0", Text = _localizationService.GetResource("Common.All") }); foreach (var vendor in vendors) { model.AvailableVendors.Add(new SelectListItem { Value = vendor.Id.ToString(), Text = _localizationService.GetLocalized(vendor, x => x.Name), Selected = model.vid == vendor.Id }); } } } return(model); }
private SearchModel BuildBalanceSearchModel() { var model = new SearchModel(); return(model); }
public async Task <IActionResult> SearchSpecifications([FromBody] SearchModel searchModel) { return(await _specSearchService.SearchSpecifications(searchModel)); }
public async Task <List <Person> > Search(SearchModel criteria) { return(await _db.Search(criteria)); }
public ActionResult GetList(SearchModel search, PageParam pageParam) { PageData <ArticleDto> pageData = _helper.GetPageList(search, o => o.UpdateTime, pageParam, false); return(Success(pageData)); }
public async Task <IActionResult> Search([FromQuery] SearchModel input) { return(Ok(await _githubProfileQuery.SearchContacts(input))); }
public async Task <HttpResponseMessage> QueryProviders(SearchModel varSearchModel) { Thread.CurrentThread.CurrentCulture = culture; String typeAccount = varSearchModel.parameters[0]; string dailyPlanSearchType = (varSearchModel.parameters[1] != null) ? varSearchModel.parameters[1] : "0"; string searchDailyPlan = ""; String account = ""; if (typeAccount == "0") { account = "Administrador"; } else if (typeAccount == "1") { account = "Provider"; } else if (typeAccount == "2") { account = "User"; if (Convert.ToInt32(dailyPlanSearchType) == 1) { searchDailyPlan = "AND i.dailyplan = 1 "; } else if (Convert.ToInt32(dailyPlanSearchType) == 2) { searchDailyPlan = "AND (i.dailyplan = 0 OR i.dailyPlan IS NULL) "; } } List <UserProviderQuery> providers = new List <UserProviderQuery>(); try { using (SqlConnection connection1 = new SqlConnection(connetionString)) { await connection1.OpenAsync(); SqlCommand command1 = new SqlCommand("SELECT u.id, u.email, i.firstname, i.lastname, i.dailyplan " + "FROM AspNetUsers u " + "LEFT JOIN AspNetUserRoles ur on u.id = ur.UserId " + "LEFT JOIN AspNetRoles r on ur.RoleId = r.id " + "LEFT JOIN users i on u.id = i.id " + "WHERE r.name = '" + account + "' " + searchDailyPlan + "ORDER by email", connection1); SqlDataReader reader = await command1.ExecuteReaderAsync(); while (await reader.ReadAsync()) { UserProviderQuery provider = new UserProviderQuery(); provider.userid = reader.GetString(0); provider.email = reader.GetString(1); if (!reader.IsDBNull(2)) { provider.firtsName = reader.GetString(2); } if (!reader.IsDBNull(3)) { provider.lastName = reader.GetString(3); } if (!reader.IsDBNull(4)) { provider.dailyPlan = reader.GetBoolean(4); } providers.Add(provider); } reader.Close(); } } catch (ApplicationException ex) { ErrorModel _errors = new ErrorModel(); _errors.message = ex.Message; return(Request.CreateResponse(System.Net.HttpStatusCode.InternalServerError, _errors)); } catch (Exception ex) { ErrorModel _errors = new ErrorModel(); _errors.message = ex.Message; return(Request.CreateResponse(System.Net.HttpStatusCode.InternalServerError, _errors)); } return(Request.CreateResponse(System.Net.HttpStatusCode.OK, providers)); }
public SearchModel SearchDrafts(SearchModel.DraftKind kind, Guid?customerId, DateTime?dateFrom, DateTime?dateTo, int page, int size) { var model = new SearchModel(); var drafts = new List <SearchModel.Draft>(); if (kind == SearchModel.DraftKind.Any || kind == SearchModel.DraftKind.OutgoingInvoice) { var outgoingInvoiceDrafts = Database.OutgoingInvoiceDrafts; if (customerId.HasValue) { outgoingInvoiceDrafts = outgoingInvoiceDrafts.Where(d => d.Customer.OriginalId == customerId.Value); } if (dateFrom.HasValue) { outgoingInvoiceDrafts = outgoingInvoiceDrafts.Where(i => i.Date >= dateFrom.Value); } if (dateTo.HasValue) { outgoingInvoiceDrafts = outgoingInvoiceDrafts.Where(i => i.Date <= dateTo.Value); } drafts.AddRange(outgoingInvoiceDrafts.Select(d => new SearchModel.Draft { Id = d.Id, Currency = d.Currency, CustomerName = d.Customer.Name, Date = d.Date, DocumentType = "outgoingInvoice", TotalPrice = d.TotalPrice })); } if (kind == SearchModel.DraftKind.Any || kind == SearchModel.DraftKind.OutgoingCreditNote) { var outgoingCreditNoteDrafts = Database.OutgoingCreditNoteDrafts; if (customerId.HasValue) { outgoingCreditNoteDrafts = outgoingCreditNoteDrafts.Where(d => d.Customer.OriginalId == customerId.Value); } if (dateFrom.HasValue) { outgoingCreditNoteDrafts = outgoingCreditNoteDrafts.Where(i => i.Date >= dateFrom.Value); } if (dateTo.HasValue) { outgoingCreditNoteDrafts = outgoingCreditNoteDrafts.Where(i => i.Date <= dateTo.Value); } drafts.AddRange(outgoingCreditNoteDrafts.Select(d => new SearchModel.Draft { Id = d.Id, Currency = d.Currency, CustomerName = d.Customer.Name, Date = d.Date, DocumentType = "outgoingCreditNote", TotalPrice = -d.TotalPrice })); } model.TotalNumberOfDrafts = drafts.Count(); int skip = (page - 1) * size; model.Drafts = drafts .OrderByDescending(d => d.Date) .Skip(skip) .Take(size) .ToArray(); return(model); }
public async Task <ApiResponse <ProviderVersionSearchResults> > SearchProviderVersions(int year, int month, int day, SearchModel searchModel) { Guard.ArgumentNotNull(searchModel, nameof(searchModel)); return(await PostAsync <ProviderVersionSearchResults, SearchModel>("providers/date-search/{year}/{month}/{day}", searchModel)); }
public async Task <IActionResult> Search([FromBody] SearchModel <WebsiteSearchModel> searchModel) { var companies = await websiteService.SearchAsync(searchModel); return(Ok(new ApiResponse <PaginationResponse <List <WebsiteModel> > >(companies))); }
public async Task <ApiResponse <ProviderVersionSearchResults> > SearchProviderVersions(SearchModel searchModel) { Guard.ArgumentNotNull(searchModel, nameof(searchModel)); return(await PostAsync <ProviderVersionSearchResults, SearchModel>("providers/versions-search", searchModel)); }
public Task <ProviderSearchResults> SearchProviders(SearchModel searchModel) { return(_resultsApiClient.PostAsync <ProviderSearchResults, SearchModel>(GetProvidersFromSearchUri, searchModel)); }
public virtual async Task <(List <T> Data, PagingInfo PagingInfo)> SearchEntitiesAsync(SearchModel searchModel) { try { var query = await Task.Run(() => { return(Entities .Where(e => e.IsNotDeleted()) .Where(e => e.ContainsString(searchModel.SearchString, null)) .Where(e => e.CompareTo(searchModel))); }); if (searchModel.PageIndex > 0 && searchModel.PageSize > 0) { return(await Task.Run(() => { var source = query.ToPageList(searchModel.PageIndex, searchModel.PageSize); return (Data : source.List, PagingInfo : source.GetPagingInfo()); })); } else { return(await Task.Run(() => { var source = query.ToList(); return (Data : source, PagingInfo : new PagingInfo(source.Count, 1, source.Count, 1)); })); } } catch (Exception ex) { throw ex; } }
public virtual ActionResult Search(SearchModel model, CatalogPagingFilteringModel command) { //'Continue shopping' URL _genericAttributeService.SaveAttribute(_workContext.CurrentCustomer, SystemCustomerAttributeNames.LastContinueShoppingPage, _webHelper.GetThisPageUrl(false), _storeContext.CurrentStore.Id); if (model == null) { model = new SearchModel(); } model = _catalogModelFactory.PrepareSearchModel(model, command); model.SelectedCategories = _categoryService .GetAllCategories(onlyCategory: true) .Select(t => new SearchCategoriesModel { Id = t.Id, Name = t.Name, Selected = model.selcats?.Contains(t.Id) ?? false }) .Take(7) .ToList(); var selectedCategories = model .SelectedCategories .Where(t => t.Selected) .ToList(); var selCatIds = selectedCategories.Select(s => s.Id); model.SelectedSubCategories = _categoryService .GetAllCategories(onlySubCategory: true) .Where(t => selCatIds.Contains(t.ParentCategoryId)) .Select(t => new SearchCategoriesModel { Id = t.Id, Name = t.Name, Selected = model.selcats?.Contains(t.Id) ?? false }) .Take(6) .ToList(); model.SelectedBrands = _brandService .GetAllBrands() .Select(t => new SearchBrandModel { Id = t.Id, Name = t.Name, Selected = model.selBrands?.Contains(t.Id) ?? false }) .Take(5) .ToList(); ViewBag.RenderFilter = true; ViewBag.iCheck = true; ViewBag.CtaCustomizationColor = _settingService.GetSettingByKey <string>("moveleiros.mov-cta-customization"); ViewBag.CtaCustomizationColorHover = _settingService.GetSettingByKey <string>("moveleiros.mov-cta-customization.hover"); ViewBag.IsAjaxRequest = Request.IsAjaxRequest(); return(View("Search", model)); }
public static Expression <Func <T, bool> > ByPostCode <T>(SearchModel search) where T : class { return(x => predicate_using_PostCode(x, search)); }
/// <summary> /// Prepare the search model /// </summary> /// <param name="searchterms">Search terms</param> /// <param name="adv">Whether to use the advanced search</param> /// <param name="forumId">Forum identifier</param> /// <param name="within">String representation of int value of ForumSearchType</param> /// <param name="limitDays">Limit by the last number days; 0 to load all topics</param> /// <param name="page">Number of items page</param> /// <returns>Search model</returns> public virtual SearchModel PrepareSearchModel(string searchterms, bool?adv, string forumId, string within, string limitDays, int page) { var model = new SearchModel(); var pageSize = 10; // Create the values for the "Limit results to previous" select list var limitList = new List <SelectListItem> { new SelectListItem { Text = _localizationService.GetResource("Forum.Search.LimitResultsToPrevious.AllResults"), Value = "0" }, new SelectListItem { Text = _localizationService.GetResource("Forum.Search.LimitResultsToPrevious.1day"), Value = "1" }, new SelectListItem { Text = _localizationService.GetResource("Forum.Search.LimitResultsToPrevious.7days"), Value = "7" }, new SelectListItem { Text = _localizationService.GetResource("Forum.Search.LimitResultsToPrevious.2weeks"), Value = "14" }, new SelectListItem { Text = _localizationService.GetResource("Forum.Search.LimitResultsToPrevious.1month"), Value = "30" }, new SelectListItem { Text = _localizationService.GetResource("Forum.Search.LimitResultsToPrevious.3months"), Value = "92" }, new SelectListItem { Text = _localizationService.GetResource("Forum.Search.LimitResultsToPrevious.6months"), Value = "183" }, new SelectListItem { Text = _localizationService.GetResource("Forum.Search.LimitResultsToPrevious.1year"), Value = "365" } }; model.LimitList = limitList; // Create the values for the "Search in forum" select list var forumsSelectList = new List <SelectListItem> { new SelectListItem { Text = _localizationService.GetResource("Forum.Search.SearchInForum.All"), Value = "0", Selected = true, } }; var separator = "--"; var forumGroups = _forumService.GetAllForumGroups(); foreach (var fg in forumGroups) { // Add the forum group with value as '-' so it can't be used as a target forum id forumsSelectList.Add(new SelectListItem { Text = fg.Name, Value = "-" }); var forums = _forumService.GetAllForumsByGroupId(fg.Id); foreach (var f in forums) { forumsSelectList.Add( new SelectListItem { Text = $"{separator}{f.Name}", Value = f.Id.ToString() }); } } model.ForumList = forumsSelectList; // Create the values for "Search within" select list var withinList = new List <SelectListItem> { new SelectListItem { Value = ((int)ForumSearchType.All).ToString(), Text = _localizationService.GetResource("Forum.Search.SearchWithin.All") }, new SelectListItem { Value = ((int)ForumSearchType.TopicTitlesOnly).ToString(), Text = _localizationService.GetResource("Forum.Search.SearchWithin.TopicTitlesOnly") }, new SelectListItem { Value = ((int)ForumSearchType.PostTextOnly).ToString(), Text = _localizationService.GetResource("Forum.Search.SearchWithin.PostTextOnly") } }; model.WithinList = withinList; int.TryParse(forumId, out var forumIdSelected); model.ForumIdSelected = forumIdSelected; int.TryParse(within, out var withinSelected); model.WithinSelected = withinSelected; int.TryParse(limitDays, out var limitDaysSelected); model.LimitDaysSelected = limitDaysSelected; var searchTermMinimumLength = _forumSettings.ForumSearchTermMinimumLength; model.ShowAdvancedSearch = adv.GetValueOrDefault(); model.SearchResultsVisible = false; model.NoResultsVisisble = false; model.PostsPageSize = _forumSettings.PostsPageSize; model.AllowPostVoting = _forumSettings.AllowPostVoting; try { if (!string.IsNullOrWhiteSpace(searchterms)) { searchterms = searchterms.Trim(); model.SearchTerms = searchterms; if (searchterms.Length < searchTermMinimumLength) { throw new NopException(string.Format(_localizationService.GetResource("Forum.SearchTermMinimumLengthIsNCharacters"), searchTermMinimumLength)); } ForumSearchType searchWithin = 0; var limitResultsToPrevious = 0; if (adv.GetValueOrDefault()) { searchWithin = (ForumSearchType)withinSelected; limitResultsToPrevious = limitDaysSelected; } if (_forumSettings.SearchResultsPageSize > 0) { pageSize = _forumSettings.SearchResultsPageSize; } var topics = _forumService.GetAllTopics(forumIdSelected, 0, searchterms, searchWithin, limitResultsToPrevious, page - 1, pageSize); model.TopicPageSize = topics.PageSize; model.TopicTotalRecords = topics.TotalCount; model.TopicPageIndex = topics.PageIndex; foreach (var topic in topics) { var topicModel = PrepareForumTopicRowModel(topic); model.ForumTopics.Add(topicModel); } model.SearchResultsVisible = (topics.Any()); model.NoResultsVisisble = !(model.SearchResultsVisible); return(model); } model.SearchResultsVisible = false; } catch (Exception ex) { model.Error = ex.Message; } //some exception raised model.TopicPageSize = pageSize; model.TopicTotalRecords = 0; model.TopicPageIndex = page - 1; return(model); }
/// <summary> /// GeneralOptionalItems Grid列表 /// </summary> /// <param name="optionalSearchModel"></param> /// <returns></returns> public ActionResult OptionalItemList(SearchModel optionalSearchModel) { IQueryable<GeneralOptItem> oGeneralOptionalItem = dbEntity.GeneralOptItems.Include("Name").Where(g=>g.OptID==optid && g.Deleted == false).AsQueryable(); GridColumnModelList<GeneralOptItem> columns = new GridColumnModelList<GeneralOptItem>(); columns.Add(p => p.Gid).SetAsPrimaryKey(); columns.Add(p => p.Optional.Name.GetResource(CurrentSession.Culture)).SetName("Optional"); columns.Add(p => p.Name.GetResource(CurrentSession.Culture)).SetName("Name"); columns.Add(p => p.Code); columns.Add(p => p.Sorting); GridData optionalGridData = oGeneralOptionalItem.ToGridData(optionalSearchModel, columns); return Json(optionalGridData, JsonRequestBehavior.AllowGet); }
public static Expression <Func <T, bool> > PolicyNumber <T>(SearchModel search) where T : class { return(x => predicate_using_PolicyNumber(x, search)); }
/// <summary> /// 用于列举多语言资源编辑窗口的列表项 /// </summary> /// <param name="searchModel"></param> /// <returns></returns> public JsonResult ListMatter(SearchModel searchModel) { GeneralResource resource = (from i in dbEntity.GeneralResources.Include("ResourceItems") where i.Gid == resGid && i.Deleted == false select i).Single(); List<GeneralResItem> items = (from i in resource.ResourceItems where i.Deleted == false select i).ToList(); var model = items.AsQueryable(); GridData data = model.ToGridData(searchModel, Columns.MatterColumns); return Json(data, JsonRequestBehavior.AllowGet); }
public static Expression <Func <T, bool> > ByUniqueId <T>(SearchModel search) where T : class { return(x => predicate_using_UniqueId(x, search)); }
/// <summary> /// Initializes a new instance of the <see cref="IssuesSearchViewModel" /> class. /// </summary> /// <param name="searchModel">The search model.</param> /// <param name="notificationManager">The notification manager.</param> /// <param name="configurationHelper">The configuration helper.</param> /// <param name="restService">The rest service.</param> /// <param name="translator">The translator.</param> /// <param name="analyser">The analyser.</param> public IssuesSearchViewModel( IssuesSearchModel searchModel, INotificationManager notificationManager, IConfigurationHelper configurationHelper, ISonarRestService restService, ISQKeyTranslator translator, ISonarLocalAnalyser analyser) { this.restService = restService; this.notificationManager = notificationManager; this.configurationHelper = configurationHelper; this.searchModel = searchModel; this.Header = "Issues Search"; this.AvailableProjects = new List<Resource>(); this.AssigneeList = new ObservableCollection<User>(); this.AvailableSearches = new ObservableCollection<string>(); this.IssuesGridView = new IssueGridViewModel("SearchView", false, configurationHelper, restService, notificationManager, translator); this.savedSearchModel = new SearchModel(this.AvailableSearches); this.IssuesGridView.ContextMenuItems = this.CreateRowContextMenu(restService, translator, analyser); this.IssuesGridView.ShowContextMenu = true; this.IssuesGridView.ShowLeftFlyoutEvent += this.ShowHideLeftFlyout; this.SizeOfFlyout = 0; this.InitCommanding(); this.ForeGroundColor = Colors.Black; this.BackGroundColor = Colors.White; this.CreatedBeforeDate = DateTime.Now; this.CreatedSinceDate = DateTime.Now; SonarQubeViewModel.RegisterNewViewModelInPool(this); }
public ActionResult SearchCount(SearchModel model) { var jobs = ApplyFilters(model, _db.Jobs); return(Content(jobs.Count().ToString())); }