Esempio n. 1
0
        public void CanTakeAPage(ISearchParameters parameters)
        {
            var searchRequest = CreateSearchRequest(parameters);
            var transactions  = ExecuteSearch(searchRequest, GetTransactions());

            CollectionAssert.AreEqual(Enumerable.Range(1481, 10).Select(x => x.ToString()), transactions.Select(x => x.Id));
        }
Esempio n. 2
0
        /// <summary>
        /// Searches templates.
        /// </summary>
        /// <param name="parameters">Search and paging parameters.</param>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <returns>Search result.</returns>
        public ISearchResult <Template> Search(ISearchParameters parameters, IUnitOfWork unitOfWork = null)
        {
            IDatabaseManager dbm = _databaseManagerFactory.GetDatabaseManager(unitOfWork);

            try
            {
                List <Template> templates = new List <Template>();
                dbm.SetStoredProcedure("cms.SearchTemplates");
                dbm.AddParameter("@PageIndex", FieldType.Int, parameters.PageIndex);
                dbm.AddParameter("@PageSize", FieldType.Int, parameters.PageSize);
                dbm.AddParameter("@Search", FieldType.NVarChar, 50, parameters.Search);
                dbm.ExecuteReader();
                while (dbm.Read())
                {
                    templates.Add(GetTemplate(dbm, false));
                }
                dbm.Read();
                int total = (int)dbm.DataReaderValue("Total");
                return(new SearchResult <Template> {
                    Items = templates, Total = total
                });
            }
            finally
            {
                if (unitOfWork == null)
                {
                    dbm.Dispose();
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Searches master pages.
        /// </summary>
        /// <param name="tenantId">Identifies website that master pages belong to.</param>
        /// <param name="parameters">Search and paging parameters.</param>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <returns>Search result.</returns>
        public ISearchResult <MasterPage> Search(long tenantId, ISearchParameters parameters, IUnitOfWork unitOfWork = null)
        {
            IDatabaseManager dbm = _databaseManagerFactory.GetDatabaseManager(unitOfWork);

            try
            {
                List <MasterPage> masterPages = new List <MasterPage>();
                dbm.SetSQL(_sqlManager.GetSql("Sql.SearchMasterPages.sql"));
                dbm.AddParameter("@TenantId", FieldType.BigInt, tenantId);
                dbm.AddParameter("@PageIndex", FieldType.Int, parameters.PageIndex);
                dbm.AddParameter("@PageSize", FieldType.Int, parameters.PageSize);
                dbm.AddParameter("@Search", FieldType.NVarChar, 50, parameters.Search);
                dbm.ExecuteReader();
                while (dbm.Read())
                {
                    masterPages.Add(GetMasterPage(dbm, false));
                }
                dbm.Read();
                int total = (int)dbm.DataReaderValue("Total");
                return(new SearchResult <MasterPage> {
                    Items = masterPages, Total = total
                });
            }
            finally
            {
                if (unitOfWork == null)
                {
                    dbm.Dispose();
                }
            }
        }
 protected SearchCommand(List <Expansion <T> > expandPredicates, ISearchParameters <T> searchParameters, IAdditionalParameters <T> additionalParameters)
     : this()
 {
     this.Init(expandPredicates);
     this.SearchParameters     = searchParameters;
     this.AdditionalParameters = additionalParameters;
 }
        // TODO: наверное стоит такие штуки перенести в DataProviderService
        private FormUrlEncodedContent _getSearchForm(HtmlDocument doc, ISearchParameters parameters)
        {
            var form = new Dictionary <string, string>()
            {
                { "_EVENTTARGET", doc.GetValueById("_EVENTTARGET", true) },
                { "__EVENTARGUMENT", doc.GetValueById("__EVENTARGUMENT", true) },
                { "__VIEWSTATEFIELDCOUNT", doc.GetValueById("__VIEWSTATEFIELDCOUNT", true) },
                { "__VIEWSTATE", doc.GetValueById("__VIEWSTATE", true) },
                { "__VIEWSTATEGENERATOR", doc.GetValueById("__VIEWSTATEGENERATOR", true) },
                { "ctl00$ctl00$phWorkZone$xmlFilter", configService.GetSearchXml(parameters) },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$tbxPurchaseCode", parameters.Regnumber },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$tbSearch", doc.GetValueById("ctl00_ctl00_phWorkZone_phFilterZone_nbtPurchaseListFilter_tbSearch") },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$purchamountstart", doc.GetValueById("ctl00_ctl00_phWorkZone_phFilterZone_nbtPurchaseListFilter_purchamountstart") },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$purchamountend", doc.GetValueById("ctl00_ctl00_phWorkZone_phFilterZone_nbtPurchaseListFilter_purchamountend") },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$cldPublicDateStart", doc.GetValueById("ctl00_ctl00_phWorkZone_phFilterZone_nbtPurchaseListFilter_cldPublicDateStart") },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$cldPublicDateEnd", doc.GetValueById("ctl00_ctl00_phWorkZone_phFilterZone_nbtPurchaseListFilter_cldPublicDateEnd") },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$CldRRequestDateStart", doc.GetValueById("ctl00_ctl00_phWorkZone_phFilterZone_nbtPurchaseListFilter_CldRRequestDateStart") },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$CldRequestDateEnd", doc.GetValueById("ctl00_ctl00_phWorkZone_phFilterZone_nbtPurchaseListFilter_CldRequestDateEnd") },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$CldAuctionBeginDateStart", doc.GetValueById("ctl00_ctl00_phWorkZone_phFilterZone_nbtPurchaseListFilter_CldAuctionBeginDateStart") },
                { "ctl00$ctl00$phWorkZone$phFilterZone$nbtPurchaseListFilter$CldAuctionBeginDateEnd", doc.GetValueById("ctl00_ctl00_phWorkZone_phFilterZone_nbtPurchaseListFilter_CldAuctionBeginDateEnd") },
                { "ctl00$ctl00$phWorkZone$btnSearch", doc.GetValueById("ctl00_ctl00_phWorkZone_btnSearch") },
                { "ctl00$ctl00$phWorkZone$hfFilterZone", doc.GetValueById("ctl00_ctl00_phWorkZone_hfFilterZone") },
                { "ctl00$ctl00$phWorkZone$xmlData", doc.GetValueById("ctl00_ctl00_phWorkZone_xmlData") }
            };

            if (int.TryParse(form["__VIEWSTATEFIELDCOUNT"], out int viewstateFieldCount))
            {
                for (int i = 1; i < viewstateFieldCount; i++)
                {
                    form[$"__VIEWSTATE{i}"] = doc.GetValueById($"__VIEWSTATE{i}", true);
                }
            }

            return(new FormUrlEncodedContent(form));
        }
        public ISearchResult <Domain> Search(long tenantId, ISearchParameters parameters, IUnitOfWork unitOfWork = null)
        {
            IDatabaseManager dbm = _databaseManagerFactory.GetDatabaseManager(unitOfWork);

            try
            {
                List <Domain> domains = new List <Domain>();
                dbm.SetStoredProcedure("cms.SearchDomains");
                dbm.AddParameter("@TenantId", FieldType.BigInt, tenantId);
                dbm.AddParameter("@PageIndex", FieldType.Int, parameters.PageIndex);
                dbm.AddParameter("@PageSize", FieldType.Int, parameters.PageSize);
                dbm.AddParameter("@Search", FieldType.NVarChar, 50, parameters.Search);
                dbm.ExecuteReader();
                while (dbm.Read())
                {
                    domains.Add(GetDomainFromDatabaseManager(dbm));
                }
                dbm.Read();
                int total = (int)dbm.DataReaderValue("Total");
                return(new SearchResult <Domain> {
                    Items = domains, Total = total
                });
            }
            finally
            {
                if (unitOfWork == null)
                {
                    dbm.Dispose();
                }
            }
        }
Esempio n. 7
0
        /// <summary>
        /// Searches websites.
        /// </summary>
        /// <param name="parameters">Search and paging parameters.</param>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <returns>Search result.</returns>
        public ISearchResult <Web> Search(ISearchParameters parameters, IUnitOfWork unitOfWork = null)
        {
            IDatabaseManager dbm = _databaseManagerFactory.GetDatabaseManager(unitOfWork);

            try
            {
                List <Web> webs = new List <Web>();
                dbm.SetSQL(_sqlManager.GetSql("Sql.SearchWebs.sql"));
                dbm.AddParameter("@PageIndex", FieldType.Int, parameters.PageIndex);
                dbm.AddParameter("@PageSize", FieldType.Int, parameters.PageSize);
                dbm.AddParameter("@Search", FieldType.NVarChar, 50, parameters.Search);
                dbm.ExecuteReader();
                while (dbm.Read())
                {
                    webs.Add(GetWebFromDatabaseManager(dbm));
                }
                dbm.Read();
                int total = (int)dbm.DataReaderValue("Total");
                return(new SearchResult <Web> {
                    Items = webs, Total = total
                });
            }
            finally
            {
                if (unitOfWork == null)
                {
                    dbm.Dispose();
                }
            }
        }
        public ActionResult Index()
        {
            RefreshModules("");

            ISearchParameters searchParameters = SearchHelper.FillSearchParameters();

            ViewBag.SearchedFiles = new List <string>();

            return(View(searchParameters));
        }
Esempio n. 9
0
        private static bool CheckByParameters(ISearchParameters searchParameters, FileInfo item)
        {
            var  checkedFileAttributes = from res in searchParameters.FileAttributes where res.IsChecked select res.Value;
            bool hasAllFileAttributes  = Enum.GetValues(typeof(FileAttributes)).Cast <FileAttributes>().
                                         Where(x => item.Attributes.HasFlag(x)).Cast <int>().
                                         All(x => checkedFileAttributes.Contains(x));

            return(item.Length < searchParameters.FileLength &&
                   item.CreationTime < searchParameters.CreationDate &&
                   hasAllFileAttributes);
        }
Esempio n. 10
0
        public List <Product> GetProducts(ISearchParameters parameters)
        {
            var searchBuilder = new ProductBuilder(parameters);
            var predicate     = searchBuilder.Build();

            return(parameters.EmptyParameters
                ? _context.Products.ToList()
                : _context.Products
                   .Where(predicate)
                   .ToList());
        }
Esempio n. 11
0
 /// <summary>
 /// Searches websites.
 /// </summary>
 /// <param name="parameters">Search and paging parameters.</param>
 /// <param name="unitOfWork">Unit of work.</param>
 /// <returns>Search result.</returns>
 public ISearchResult <Web> Search(ISearchParameters parameters, IUnitOfWork unitOfWork = null)
 {
     if (parameters.Search == null)
     {
         parameters.Search = string.Empty;
     }
     else
     {
         parameters.Search = parameters.Search.Trim();
     }
     if (parameters.PageSize == 0)
     {
         parameters.PageSize = 10;
     }
     return(_webRepository.Search(parameters, unitOfWork));
 }
Esempio n. 12
0
 /// <summary>
 /// Searches pages.
 /// </summary>
 /// <param name="tenantId">Identifies website whose pages are searched.</param>
 /// <param name="parameters">Search and paging parameters.</param>
 /// <param name="unitOfWork">Unit of work.</param>
 /// <returns>Search result.</returns>
 public ISearchResult <Page> Search(long tenantId, ISearchParameters parameters, IUnitOfWork unitOfWork = null)
 {
     if (parameters.Search == null)
     {
         parameters.Search = string.Empty;
     }
     else
     {
         parameters.Search = parameters.Search.Trim();
     }
     if (parameters.PageSize == 0)
     {
         parameters.PageSize = 10;
     }
     return(_pageRepository.Search(tenantId, parameters, unitOfWork));
 }
Esempio n. 13
0
        /// <summary>
        /// Returns grid view model given search parameters and a search result.
        /// </summary>
        /// <typeparam name="TItem">The type of business model found in the search result.</typeparam>
        /// <param name="searchParameters">Search parameters.</param>
        /// <param name="searchResult">Search result.</param>
        /// <param name="properties">Model properties that determine grid column headers.</param>
        /// <param name="urlParameters">URL parameters determining hyperlinks found in first grid column.</param>
        /// <param name="routePropertyPairs">Determines route values dynamically extracted from business models.</param>
        /// <param name="noItemsMessage">String that is displayed when search result contains no items.</param>
        /// <returns>Grid of items.</returns>
        public Grid GetGrid <TItem>(ISearchParameters searchParameters, ISearchResult <TItem> searchResult, List <string> properties, UrlParameters urlParameters, List <RoutePropertyPair> routePropertyPairs, string noItemsMessage)
        {
            // Construct grid object
            Grid grid = new Grid
            {
                EmptyMessage = searchResult.Items.Count() == 0 ? noItemsMessage : null,
                Headers      = new List <GridHeader>(),
                Rows         = new List <GridRow>(),
                Search       = searchParameters.Search,
            };

            // Grid pager
            int pageCount = ((searchResult.Total - 1) / searchParameters.PageSize) + 1;

            if (pageCount > 1)
            {
                grid.Pager = new Pager
                {
                    FirstButtonLabel    = PagerResource.FirstButtonLabel,
                    PreviousButtonLabel = PagerResource.PreviousButtonLabel,
                    NextButtonLabel     = PagerResource.NextButtonLabel,
                    LastButtonLabel     = PagerResource.LastButtonLabel,
                    PageCount           = pageCount,
                    Summary             = string.Format(PagerResource.PageAndCountText, searchParameters.PageIndex, pageCount),
                    Page = searchParameters.PageIndex + 1
                };
            }

            // Populate headers
            foreach (string property in properties)
            {
                grid.Headers.Add(new GridHeader {
                    Label = _dataAnnotationsService.GetPropertyDisplayName <TItem>(property)
                });
            }

            // Populate rows
            UrlHelper urlHelper = null;// new UrlHelper();

            foreach (TItem item in searchResult.Items)
            {
                grid.Rows.Add(GetGridRow(item, properties, urlHelper, urlParameters, routePropertyPairs));
            }

            // Return the result
            return(grid);
        }
        public async Task <ISearchResult> SearchAsync(ISearchParameters parameters, CancellationToken ct)
        {
            await logger.Log("Поиск аукциона " + parameters.Regnumber);

            ct.ThrowIfCancellationRequested();
            var step1GetResult = await httpClientService.GetAsync(configService.PurchaseRequestListUrl, ct);

            _throwIfDocumentError(step1GetResult);
            var step2PostResult = await httpClientService.PostAsync(configService.PurchaseRequestListUrl, _getSearchForm(step1GetResult, parameters), ct);

            _throwIfDocumentError(step2PostResult);
            var xmlFilterResult = HttpUtility.HtmlDecode(step2PostResult.GetTextById("ctl00_ctl00_phWorkZone_xmlData"));
            var result          = serializationService.GetSearchResult(xmlFilterResult);
            await logger.Log("Найдено аукционов: " + (result?.Entries?.Length ?? 0));

            return(result);
        }
Esempio n. 15
0
        /// <summary>
        /// Retrieves list of pages filtered by tags.
        /// </summary>
        /// <param name="tenantId">Identifies website whose pages are listed.</param>
        /// <param name="parameters">Search and paging parameters.</param>
        /// <param name="tags">Tags used to filter pages.</param>
        /// <param name="pageId">Identifies the parent page whose child pages are returned (set NULL to include root folder of website).</param>
        /// <param name="sortBy">The sort order of pages returned.</param>
        /// <param name="sortAsc">True to sort ascending, false to sort descending.</param>
        /// <param name="recursive">Set true to get all child pages, false if only direct descendants are required.</param>
        /// <param name="pageType">The type of page listed (document or folder).</param>
        /// <param name="loadTags">Indicates whether tags should be loaded for retrieved pages.</param>
        /// <param name="unitOfWork">Unit of work.</param>
        /// <returns>Search result.</returns>
        public ISearchResult <Page> ListTagged(long tenantId, ISearchParameters parameters, IList <Tag> tags, long?pageId, PageSortBy sortBy, bool sortAsc, bool recursive, PageType pageType, bool loadTags, IUnitOfWork unitOfWork = null)
        {
            TagCollection tagCollection = new TagCollection();

            foreach (Tag tag in tags)
            {
                tagCollection.Add(tag);
            }
            IDatabaseManager dbm = _databaseManagerFactory.GetDatabaseManager(unitOfWork);

            try
            {
                List <Page> pages = new List <Page>();
                dbm.SetStoredProcedure(recursive ? "cms.ListTaggedPagesRecursive" : "cms.ListTaggedPages");
                dbm.AddParameter("@TenantId", FieldType.BigInt, tenantId);
                dbm.AddParameter("@PageId", FieldType.BigInt, pageId ?? (object)DBNull.Value);
                dbm.AddParameter("@SortBy", FieldType.Int, (int)sortBy);
                dbm.AddParameter("@SortAsc", FieldType.Bit, sortAsc);
                dbm.AddParameter("@PageType", FieldType.Int, (int)pageType);
                dbm.AddParameter("@PageIndex", FieldType.Int, parameters.PageIndex);
                dbm.AddParameter("@PageSize", FieldType.Int, parameters.PageSize);
                dbm.AddParameter("@Tags", FieldType.Structured, tagCollection.Count == 0 ? null : tagCollection);
                dbm.ExecuteReader();
                while (dbm.Read())
                {
                    pages.Add(GetPage(dbm, false, false));
                }
                dbm.Read();
                int total = (int)dbm.DataReaderValue("Total");
                if (loadTags)
                {
                    LoadTagsForPages(dbm, tenantId, pages);
                }
                return(new SearchResult <Page> {
                    Items = pages, Total = total
                });
            }
            finally
            {
                if (unitOfWork == null)
                {
                    dbm.Dispose();
                }
            }
        }
Esempio n. 16
0
        public List <KeyValuePair <string, string> > GetSearchParameters <T>(ISearchParameters <T> searchParameters)
        {
            List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >();
            ProductProjectionSearchParameters     productProjectionSearchParameters = searchParameters as ProductProjectionSearchParameters;

            if (productProjectionSearchParameters == null)
            {
                return(parameters);
            }

            parameters.AddRange(AddTextLanguageParameter(productProjectionSearchParameters));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.Filter, "filter"));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.FilterQuery, "filter.query"));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.FilterFacets, "filter.facets"));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.Facets, "facet"));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.Sort, "sort"));
            if (productProjectionSearchParameters.Fuzzy != null)
            {
                parameters.Add(new KeyValuePair <string, string>("fuzzy", productProjectionSearchParameters.Fuzzy.ToString()));
            }

            if (productProjectionSearchParameters.FuzzyLevel != null)
            {
                parameters.Add(new KeyValuePair <string, string>("fuzzyLevel", productProjectionSearchParameters.FuzzyLevel.ToString()));
            }

            if (productProjectionSearchParameters.Limit != null)
            {
                parameters.Add(new KeyValuePair <string, string>("limit", productProjectionSearchParameters.Limit.ToString()));
            }

            if (productProjectionSearchParameters.Offset != null)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", productProjectionSearchParameters.Offset.ToString()));
            }

            if (productProjectionSearchParameters.MarkMatchingVariants != null)
            {
                parameters.Add(new KeyValuePair <string, string>("markMatchingVariants", productProjectionSearchParameters.MarkMatchingVariants.ToString()));
            }

            return(parameters);
        }
Esempio n. 17
0
        //internal static async Task<List<String>> AsyncSearchByParameters(ISearchParameters searchParameters, IFinder action,
        //    CancellationToken token)
        //{
        //    return await Task.Run(() => AsyncSearch(searchParameters, action, token));
        //}

        /// <summary>
        /// Возвращает список файлов.
        /// </summary>
        /// <param name="searchParameters">Параметры поиска.</param>
        /// <returns>Список файлов.</returns>
        internal static List <FileInfo> GetFiles(ISearchParameters searchParameters)
        {
            List <FileInfo> result = new List <FileInfo>();

            try
            {
                var folder = new DirectoryInfo(searchParameters.FolderPath);
                if (!folder.Exists)
                {
                    throw new DirectoryNotFoundException("Folder " + searchParameters.FolderPath + " does not exists");
                }
                return(folder.GetFiles("*", searchParameters.IsSearchInSubfolders ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly).ToList());
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Error: {0}", ex.Message);
            }
            return(result);
        }
Esempio n. 18
0
        public IEnumerable <TModel> GetMany(ISearchParameters searchParameters, int outputCount = 0)
        {
            Check.NotNull(searchParameters, "searchParameters");
            Seeker1 <TModel> seeker = new Seeker1 <TModel>(searchParameters, null);

            object[]             whereParameters;
            string               simpleFilterConstraint = seeker.GetSimpleFilterConstraint(out whereParameters);
            string               orderConstraint        = seeker.GetOrderConstraint();
            IEnumerable <TModel> many = null;

            //if (outputCount == 0)
            //{
            //    TRepository repository = this.Repository;
            //    many = repository.GetMany(simpleFilterConstraint, whereParameters, orderConstraint);
            //}
            //else
            //{
            //    TRepository repository = this.Repository;
            //    many = repository.GetMany(simpleFilterConstraint, whereParameters, orderConstraint, outputCount);
            //}
            return(many);
        }
Esempio n. 19
0
 public MovesToGoModel(ISearchParameters original)
 {
     EnsureArg.IsNotNull(original, nameof(original));
     _time     = new[] { original.WhiteTimeMilliseconds, original.BlackTimeMilliseconds };
     MovesToGo = new[] { original.MovesToGo[0], original.MovesToGo[1] };
 }
Esempio n. 20
0
 public SearchBuilder(ISearchParameters searchParameters)
 {
     _searchParameters = searchParameters;
 }
Esempio n. 21
0
 public string GetSearchXml(ISearchParameters parameters)
 {
     return(_searchXmlTemplate.Replace("{{REG_NUMBER}}", parameters.Regnumber));
 }
Esempio n. 22
0
 /// <summary>
 /// Retrieves list of pages filtered by tags.
 /// </summary>
 /// <param name="tenantId">Identifies website whose pages are listed.</param>
 /// <param name="parameters">Search and paging parameters.</param>
 /// <param name="tags">Tags used to filter pages.</param>
 /// <param name="pageId">Identifies the parent page whose child pages are returned (set NULL to include root folder of website).</param>
 /// <param name="sortBy">The sort order of pages returned.</param>
 /// <param name="sortAsc">True to sort ascending, false to sort descending.</param>
 /// <param name="recursive">Set true to get all child pages, false if only direct descendants are required.</param>
 /// <param name="pageType">The type of page listed (document or folder).</param>
 /// <param name="loadTags">Indicates whether tags should be loaded for retrieved pages.</param>
 /// <param name="unitOfWork">Unit of work.</param>
 /// <returns>Search result.</returns>
 public ISearchResult <Page> ListTagged(long tenantId, ISearchParameters parameters, IList <Tag> tags, long?pageId, PageSortBy sortBy, bool sortAsc, bool recursive, PageType pageType, bool loadTags, IUnitOfWork unitOfWork = null)
 {
     return(_pageRepository.ListTagged(tenantId, parameters, tags, pageId, sortBy, sortAsc, recursive, pageType, loadTags, unitOfWork));
 }
Esempio n. 23
0
 public Expression GetSearchExpression(ISearchParameters searchParameters)
 {
     throw new NotImplementedException();
 }
 public SearchParametersConfigurator(ISearchParameters parameters)
 {
     Parameters = parameters;
 }
        public List <KeyValuePair <string, string> > GetSearchParameters <T>(ISearchParameters <T> searchParameters)
        {
            List <KeyValuePair <string, string> > parameters = new List <KeyValuePair <string, string> >();
            ProductProjectionSearchParameters     productProjectionSearchParameters = searchParameters as ProductProjectionSearchParameters;

            if (productProjectionSearchParameters == null)
            {
                return(parameters);
            }

            parameters.AddRange(AddTextLanguageParameter(productProjectionSearchParameters));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.Filter, "filter"));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.FilterQuery, "filter.query"));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.FilterFacets, "filter.facets"));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.Facets, "facet"));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.Sort, "sort"));
            parameters.AddRange(AddParameters(productProjectionSearchParameters.Expand, "expand"));
            if (productProjectionSearchParameters.Fuzzy != null)
            {
                parameters.Add(new KeyValuePair <string, string>("fuzzy", productProjectionSearchParameters.Fuzzy.ToString()));
            }

            if (productProjectionSearchParameters.FuzzyLevel != null)
            {
                parameters.Add(new KeyValuePair <string, string>("fuzzyLevel", productProjectionSearchParameters.FuzzyLevel.ToString()));
            }

            if (productProjectionSearchParameters.Limit != null)
            {
                parameters.Add(new KeyValuePair <string, string>("limit", productProjectionSearchParameters.Limit.ToString()));
            }

            if (productProjectionSearchParameters.Offset != null)
            {
                parameters.Add(new KeyValuePair <string, string>("offset", productProjectionSearchParameters.Offset.ToString()));
            }

            if (productProjectionSearchParameters.MarkMatchingVariants != null)
            {
                parameters.Add(new KeyValuePair <string, string>("markMatchingVariants", productProjectionSearchParameters.MarkMatchingVariants.ToString()));
            }

            if (productProjectionSearchParameters.PriceCurrency != null)
            {
                parameters.Add(new KeyValuePair <string, string>("priceCurrency", productProjectionSearchParameters.PriceCurrency));
            }

            if (productProjectionSearchParameters.PriceCountry != null)
            {
                parameters.Add(new KeyValuePair <string, string>("priceCountry", productProjectionSearchParameters.PriceCountry));
            }

            if (productProjectionSearchParameters.PriceCustomerGroup != null)
            {
                parameters.Add(new KeyValuePair <string, string>("priceCustomerGroup", productProjectionSearchParameters.PriceCustomerGroup));
            }

            if (productProjectionSearchParameters.PriceChannel != null)
            {
                parameters.Add(new KeyValuePair <string, string>("priceChannel", productProjectionSearchParameters.PriceChannel));
            }

            if (productProjectionSearchParameters.StoreProjection != null)
            {
                parameters.Add(new KeyValuePair <string, string>("storeProjection", productProjectionSearchParameters.StoreProjection));
            }

            if (productProjectionSearchParameters.LocaleProjection != null)
            {
                parameters.Add(new KeyValuePair <string, string>("localeProjection", productProjectionSearchParameters.LocaleProjection));
            }

            var withTotal = productProjectionSearchParameters.WithTotal ? "true" : "false";

            parameters.Add(new KeyValuePair <string, string>("withTotal", withTotal));

            return(parameters);
        }
 protected SearchCommand(ISearchParameters <T> searchParameters)
     : this()
 {
     this.SearchParameters = searchParameters;
 }
Esempio n. 27
0
        //public virtual IEnumerable<TModel> GetMany(Expression<Func<TModel, bool>> where, string orderBy)
        //{
        //    TRepository repository = this.Repository;
        //    return repository.GetMany(where, orderBy);
        //}
        //public virtual IEnumerable<TModel> GetMany(int outputCount, Expression<Func<TModel, bool>> where, string orderBy)
        //{
        //    TRepository repository = this.Repository;
        //    return repository.GetMany(where, orderBy, outputCount);
        //}
        public virtual IEnumerable <TModel> GetMany(ISearchParameters searchParameters)
        {
            SearchEngine <TModel, TRepository> searchEngine = new SearchEngine <TModel, TRepository>();

            return(searchEngine.GetMany(searchParameters, 0));
        }
Esempio n. 28
0
 public Seeker1(ISearchParameters parameters, Func <ConstraintRule, Expression <Func <TModel, bool> > > getCustomFilterExpression = null)
 {
     this.Parameters = parameters;
     this.getCustomFilterExpression = getCustomFilterExpression;
 }
 public SearchParametersConfigurator(ISearchParameters parameters)
 {
     Parameters = parameters;
 }
 protected SearchCommand(ISearchParameters <T> searchParameters, IAdditionalParameters <T> additionalParameters)
     : this()
 {
     this.SearchParameters     = searchParameters;
     this.AdditionalParameters = additionalParameters;
 }
Esempio n. 31
0
 public MovesToGoModel(ISearchParameters original)
 {
     _time     = new[] { original.WhiteTimeMilliseconds, original.BlackTimeMilliseconds };
     MovesToGo = new[] { original.MovesToGo[0], original.MovesToGo[1] };
 }