public ActionResult List(GridCommand command, OrderMasterSearchModel searchModel) { SearchCacheModel searchCacheModel = ProcessSearchModel(command, searchModel); ViewBag.PageSize = this.ProcessPageSize(command.PageSize); return(View()); }
public ActionResult CancelList(GridCommand command, ReceiptMasterSearchModel searchModel) { SearchCacheModel searchCacheModel = ProcessSearchModel(command, searchModel); SearchStatementModel searchStatementModel = this.PrepareSearchStatement(command, (ReceiptMasterSearchModel)searchCacheModel.SearchObject); return(View(GetPageData <ReceiptMaster>(searchStatementModel, command))); }
public ActionResult List(GridCommand command, LocationSearchModel searchModel) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return(View()); }
public ActionResult _UomConvertList(GridCommand command, UomConversionSearchModel searchModel) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return(PartialView()); }
public ActionResult List(GridCommand command, ItemSearchModel searchModel) { ViewBag.HaveEditPermission = CurrentUser.Permissions.Where(p => p.PermissionCode == "Url_Item_Edit").Count() > 0; SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return(View()); }
private void AddToCache(List <SOFSearchModel.Item> items) { var cache = new SearchCacheModel() { Query = txtSearch.Text, Items = items, AddedOn = DateTime.Now }; NaiveCache.AddSearchModel(cache); }
public static void AddSearchModel(SearchCacheModel model) { if (_searchCache == null) { _searchCache = new Dictionary <string, SearchCacheModel>(); } model.Query.Trim(); if (!_searchCache.ContainsKey(model.Query)) { _searchCache.Add(model.Query, model); } }
public void StartCacheJob(SearchCriteria criteria, IEnumerable <Item> items = null, int pages = 4) { var cacheModel = new SearchCacheModel() { Criteria = criteria, Items = (items != null) ? items : new List <Item>(), PageFrom = criteria.Page, PageTo = criteria.Page + pages, Services = null }; BackgroundJob.Enqueue <SearchCache>(x => x.RunCacheJob(cacheModel)); }
public ActionResult List(GridCommand command, ReceiptMasterSearchModel searchModel) { SearchCacheModel searchCacheModel = this.ProcessSearchModel(command, searchModel); if (this.CheckSearchModelIsNull(searchCacheModel.SearchObject)) { TempData["_AjaxMessage"] = ""; } else { SaveWarningMessage(Resources.ErrorMessage.Errors_NoConditions); } ViewBag.PageSize = base.ProcessPageSize(command.PageSize); return(View()); }
public async Task RunCacheJob(SearchCacheModel model) { List <Task <SearchResultOverview> > searchJobs = new List <Task <SearchResultOverview> >(); var criteria = JsonConvert.DeserializeObject <SearchCriteria>(JsonConvert.SerializeObject(model.Criteria)); criteria.Page = model.PageFrom; await SearchServiceProvider.RetrieveSearchServices(webServices, cache, criteria); var pages = new List <int>(); for (int from = model.PageFrom; from <= model.PageTo; from++) { if (!await existItemSearch(criteria, from)) { pages.Add(from); } } var resultsTask = SearchDispatcher.Search(webServices, pages.ToArray()); var uncertain = JsonConvert.DeserializeObject <Item[]>(await getUncertain(criteria)); var results = await resultsTask; results.Items.AddRange(uncertain); //Cache the pages asked int index = 1; foreach (int page in pages) { criteria.Page = page; await cacheItemSearch(criteria, SearchFormatter.FormatResults(index++, results).Results); } var leftOver = results.Items.Skip((results.Items.Count / SearchFormatter.ResultsPerPage) * SearchFormatter.ResultsPerPage); //Cache the states of the web services await cacheServices(webServices); await cacheUncertain(criteria, leftOver); }
public static SearchCacheModel GetSearchModel(string query) { if (_searchCache == null) { return(null); } var model = new SearchCacheModel(); if (_searchCache.TryGetValue(query.Trim(), out model)) { var timeDifference = (DateTime.Now - model.AddedOn).TotalMinutes; if (timeDifference >= 60) { RemoveSearchModel(query); return(null); } return(model); } return(null); }