Ejemplo n.º 1
0
        protected override WebRequest CreateWebRequest()
        {
            var req = base.CreateWebRequest();

            req.AddParameter("q", query);

            if (ruleset.ID.HasValue)
            {
                req.AddParameter("m", ruleset.ID.Value.ToString());
            }

            req.AddParameter("s", SearchCategory.ToString().ToLowerInvariant());

            if (Genre != SearchGenre.Any)
            {
                req.AddParameter("g", ((int)Genre).ToString());
            }

            if (Language != SearchLanguage.Any)
            {
                req.AddParameter("l", ((int)Language).ToString());
            }

            req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}");

            return(req);
        }
Ejemplo n.º 2
0
        protected override WebRequest CreateWebRequest()
        {
            var req = base.CreateWebRequest();

            if (query != null)
            {
                req.AddParameter("q", query);
            }

            if (General != null && General.Any())
            {
                req.AddParameter("c", string.Join('.', General.Select(e => e.ToString().Underscore())));
            }

            if (ruleset.OnlineID >= 0)
            {
                req.AddParameter("m", ruleset.OnlineID.ToString());
            }

            req.AddParameter("s", SearchCategory.ToString().ToLowerInvariant());

            if (Genre != SearchGenre.Any)
            {
                req.AddParameter("g", ((int)Genre).ToString());
            }

            if (Language != SearchLanguage.Any)
            {
                req.AddParameter("l", ((int)Language).ToString());
            }

            req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}");

            if (Extra != null && Extra.Any())
            {
                req.AddParameter("e", string.Join('.', Extra.Select(e => e.ToString().ToLowerInvariant())));
            }

            if (Ranks != null && Ranks.Any())
            {
                req.AddParameter("r", string.Join('.', Ranks.Select(r => r.ToString())));
            }

            if (Played != SearchPlayed.Any)
            {
                req.AddParameter("played", Played.ToString().ToLowerInvariant());
            }

            req.AddParameter("nsfw", ExplicitContent == SearchExplicit.Show ? "true" : "false");

            req.AddCursor(cursor);

            return(req);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Order By part
        /// </summary>
        /// <returns></returns>
        public string GetSqlStatementPartSortBy()
        {
            string sortClause = sortCriteria.ToString();

            if (!string.IsNullOrEmpty(sortClause))
            {
                return(" order by " + sortClause);
            }
            else
            {
                return(string.Empty);
            }
        }
        internal IEnumerable <IParameter> Build()
        {
            var parameterList = new List <IParameter>();

            var paging = pagingBuilder?.Build();

            if (paging != default(Paging))
            {
                parameterList.AddRange(paging.GetParameters());
            }


            // TODO Move this out of method
            if (sortCriteria != default(SortCriteria))
            {
                var prefix = string.Empty;

                if (sortOrder == SortOrder.Descending)
                {
                    prefix = "-";
                }

                parameterList.Add(
                    new Parameter(
                        "sort",
                        prefix +
                        char.ToLowerInvariant(sortCriteria.ToString().First()) +
                        sortCriteria.ToString().Substring(1)));
            }


            if (filter != default(FilterBuilder))
            {
                parameterList.AddRange(filter.Build());
            }

            return(parameterList);
        }
        protected override WebRequest CreateWebRequest()
        {
            var req = base.CreateWebRequest();

            req.AddParameter("q", query);

            if (ruleset.ID.HasValue)
            {
                req.AddParameter("m", ruleset.ID.Value.ToString());
            }

            req.AddParameter("s", SearchCategory.ToString().ToLowerInvariant());

            if (Genre != SearchGenre.Any)
            {
                req.AddParameter("g", ((int)Genre).ToString());
            }

            if (Language != SearchLanguage.Any)
            {
                req.AddParameter("l", ((int)Language).ToString());
            }

            req.AddParameter("sort", $"{SortCriteria.ToString().ToLowerInvariant()}_{directionString}");

            if (Extra != null && Extra.Any())
            {
                req.AddParameter("e", string.Join('.', Extra.Select(e => e.ToString().ToLowerInvariant())));
            }

            if (Ranks != null && Ranks.Any())
            {
                req.AddParameter("r", string.Join('.', Ranks.Select(r => r.ToString())));
            }

            if (Played != SearchPlayed.Any)
            {
                req.AddParameter("played", Played.ToString().ToLowerInvariant());
            }

            req.AddCursor(cursor);

            return(req);
        }