public ITaxon GetTaxonFromUrl(string url, UrlEvaluationMode mode, string urlPrefix = null)
        {
            if (this.taxonomyEvaluator == null)
            {
                return null;
            }

            string taxonomyName;
            string taxonName;

            this.taxonomyEvaluator.ParseTaxonomyParams(mode, url, urlPrefix, out taxonName, out taxonomyName);

            if (!string.IsNullOrEmpty(taxonName) && !string.IsNullOrEmpty(taxonomyName))
            {
                try
                {
                    return this.taxonomyEvaluator.GetTaxonByName(taxonomyName, taxonName);
                }
                catch
                {
                    return null;
                }
            }

            return null;
        }
Пример #2
0
        public ITaxon GetTaxonFromUrl(string url, UrlEvaluationMode mode, string urlPrefix = null)
        {
            if (this.taxonomyEvaluator == null)
            {
                return(null);
            }

            string taxonomyName;
            string taxonName;

            this.taxonomyEvaluator.ParseTaxonomyParams(mode, url, urlPrefix, out taxonName, out taxonomyName);

            if (!string.IsNullOrEmpty(taxonName) && !string.IsNullOrEmpty(taxonomyName))
            {
                try
                {
                    return(this.taxonomyEvaluator.GetTaxonByName(taxonomyName, taxonName));
                }
                catch
                {
                    return(null);
                }
            }

            return(null);
        }
Пример #3
0
        public override string BuildUrl(DateTime date, DateBuildOptions options, UrlEvaluationMode urlEvaluationMode, string urlKeyPrefix)
        {
            var qString = QueryStringBuilder.Current.Reset();

            if (urlEvaluationMode == UrlEvaluationMode.QueryString)
            {
                var yearFullUrlKey  = String.Concat(urlKeyPrefix, "year");
                var monthFullUrlKey = String.Concat(urlKeyPrefix, "month");
                var dayFullUrlKey   = String.Concat(urlKeyPrefix, "day");

                qString.Add(yearFullUrlKey, date.Year.ToString(), true);
                if (options != DateBuildOptions.Year)
                {
                    qString.Add(monthFullUrlKey, date.Month.ToString("00"), true);
                    if (options == DateBuildOptions.YearMonthDay)
                    {
                        qString.Add(dayFullUrlKey, date.Day.ToString("00"), true);
                    }
                }
            }
            return(qString.ToString());
        }