/// <summary> /// Finds the items dto. /// </summary> /// <param name="search">The search.</param> /// <param name="recordsCount">The records count.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> internal static CatalogEntryDto FindItemsDto(CatalogSearch search, ref int recordsCount, CatalogEntryResponseGroup responseGroup) { // Assign new cache key, specific for site guid and response groups requested string cacheKey = String.Empty; // Only cache results if specified if (search.SearchOptions.CacheResults) { cacheKey = CatalogCache.CreateCacheKey("catalog-entriesdto", responseGroup.CacheKey, search.CacheKey); // check cache first object cachedObject = CatalogCache.Get(cacheKey); if (cachedObject != null) { return((CatalogEntryDto)cachedObject); } } CatalogEntryDto dto = FindItemsDto2(search, ref recordsCount, responseGroup); if (!String.IsNullOrEmpty(cacheKey)) // cache results { // Insert to the cache collection CatalogCache.Insert(cacheKey, dto, search.SearchOptions.CacheTimeout); } return(dto); }
/// <summary> /// Finds the nodes dto2. /// </summary> /// <param name="search">The search.</param> /// <param name="recordsCount">The records count.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> private static CatalogNodeDto FindNodesDto2(CatalogSearch search, ref int recordsCount, CatalogNodeResponseGroup responseGroup) { CatalogNodeDto dto = null; Guid searchGuid = Guid.NewGuid(); // Perform order search recordsCount = search.SearchNodes(searchGuid); CatalogNodeAdmin admin = new CatalogNodeAdmin(); // Load results and return them back admin.LoadSearchResults(searchGuid); dto = admin.CurrentDto; if (dto.CatalogNode.Count > 0) { foreach (CatalogNodeDto.CatalogNodeRow row in dto.CatalogNode.Rows) { LoadNode(admin, row, responseGroup); } } /* * if (admin.CurrentDto.CatalogNode.Count > 0) * { * MetaDataContext.Current = CatalogContext.MetaDataContext; * foreach (CatalogNodeDto.CatalogNodeRow row in admin.CurrentDto.CatalogNode.Rows) * MetaHelper.FillMetaData(row, row.MetaClassId, row.CatalogNodeId, true); * } * */ return(admin.CurrentDto); }
/// <summary> /// Finds the nodes dto. /// </summary> /// <param name="parameters">The parameters.</param> /// <param name="options">The options.</param> /// <param name="recordsCount">The records count.</param> /// <returns></returns> public CatalogNodeDto FindNodesDto(CatalogSearchParameters parameters, CatalogSearchOptions options, ref int recordsCount) { CatalogSearch search = new CatalogSearch(); search.SearchOptions = options; search.SearchParameters = parameters; return(CatalogNodeManager.FindNodesDto(search, ref recordsCount, new CatalogNodeResponseGroup())); }
/// <summary> /// Finds the items dto. /// </summary> /// <param name="parameters">The parameters.</param> /// <param name="options">The options.</param> /// <param name="recordsCount">The records count.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> public CatalogEntryDto FindItemsDto(CatalogSearchParameters parameters, CatalogSearchOptions options, ref int recordsCount, CatalogEntryResponseGroup responseGroup) { CatalogSearch search = new CatalogSearch(); search.SearchOptions = options; search.SearchParameters = parameters; return(CatalogEntryManager.FindItemsDto(search, ref recordsCount, responseGroup)); }
/// <summary> /// Finds the items. /// </summary> /// <param name="parameters">The parameters.</param> /// <param name="options">The options.</param> /// <returns></returns> public Entries FindItems(CatalogSearchParameters parameters, CatalogSearchOptions options) { CatalogSearch search = new CatalogSearch(); search.SearchOptions = options; search.SearchParameters = parameters; return(CatalogEntryManager.FindItems(search, new CatalogEntryResponseGroup())); }
/// <summary> /// Finds the items dto. /// </summary> /// <param name="search">The search.</param> /// <param name="recordsCount">The records count.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> private static CatalogEntryDto FindItemsDto2(CatalogSearch search, ref int recordsCount, CatalogEntryResponseGroup responseGroup) { Guid searchGuid = Guid.NewGuid(); // Perform order search recordsCount = search.SearchEntries(searchGuid); CatalogEntryAdmin admin = new CatalogEntryAdmin(); // Load results and return them back admin.LoadSearchResults(searchGuid); return(admin.CurrentDto); }
/// <summary> /// Finds the items. Results can be cached. Caching parameters are specified in CatalogSearch variable. /// </summary> /// <param name="search">The search.</param> /// <param name="responseGroup">The response group.</param> /// <returns></returns> internal static Entries FindItems(CatalogSearch search, CatalogEntryResponseGroup responseGroup) { // Assign new cache key, specific for site guid and response groups requested string cacheKey = String.Empty; // Only cache results if specified if (search.SearchOptions.CacheResults) { cacheKey = CatalogCache.CreateCacheKey("catalog-entries", responseGroup.CacheKey, search.CacheKey); // check cache first object cachedObject = CatalogCache.Get(cacheKey); if (cachedObject != null) { return((Entries)cachedObject); } } int recordsCount = 0; CatalogSearchOptions opt = search.SearchOptions; CatalogEntryDto dto = FindItemsDto2(search, ref recordsCount, responseGroup); Entries items = new Entries(); if (dto.CatalogEntry.Count > 0) { items = LoadEntries(dto, null, true, responseGroup); } items.TotalResults = recordsCount; items.TotalPages = (int)Math.Ceiling((decimal)recordsCount / opt.RecordsToRetrieve); if (!String.IsNullOrEmpty(cacheKey)) // cache results { // Insert to the cache collection CatalogCache.Insert(cacheKey, items, search.SearchOptions.CacheTimeout); } return(items); }