Ejemplo n.º 1
0
        /// <summary>
        /// Returns a list with the search parameters that are
        /// different than default
        /// </summary>
        /// <returns></returns>
        public List <KeyValuePair <string, string> > GetSearchDescription()
        {
            var list = new List <KeyValuePair <string, string> >();

            // Restrict to taxon
            if (this.RestrictToTaxonChildren)
            {
                list.Add(new KeyValuePair <string, string>(RestrictToTaxonDescription, ""));
            }

            // NameCompareOperator
            if (this.NameCompareOperator != this.DefaultNameCompareOperator)
            {
                SelectList compareOperatorSelectList = CreateCompareOperatorSelectlist(NameCompareOperator);
                foreach (SelectListItem selectListItem in compareOperatorSelectList)
                {
                    if (selectListItem.Value == NameCompareOperator.Value.ToString())
                    {
                        list.Add(new KeyValuePair <string, string>(Labels.TaxonNameCompareOperatorLabel, selectListItem.Text));
                        break;
                    }
                }
            }

            // IsUnique
            if (this.IsUnique != null)
            {
                list.Add(new KeyValuePair <string, string>(Labels.IsUniqueLabel, IsUnique.Value ? Labels.TrueLabel : Labels.FalseLabel));
            }

            // IsValidTaxon
            if (this.IsValidTaxon != null)
            {
                list.Add(new KeyValuePair <string, string>(Labels.IsValidTaxonLabel, IsValidTaxon.Value ? Labels.TrueLabel : Labels.FalseLabel));
            }

            // IsRecommended
            if (this.IsRecommended != null)
            {
                list.Add(new KeyValuePair <string, string>(Labels.IsRecommendedLabel, IsRecommended.Value ? Labels.TrueLabel : Labels.FalseLabel));
            }

            // IsOkForObsSystems
            if (this.IsOkForObsSystems != null)
            {
                list.Add(new KeyValuePair <string, string>(Labels.IsOkForObsSystemLabel, IsOkForObsSystems.Value ? Labels.TrueLabel : Labels.FalseLabel));
            }

            // IsValidTaxonNameLabels
            if (this.IsValidTaxonName != null)
            {
                list.Add(new KeyValuePair <string, string>(Labels.IsValidTaxonNameLabel, IsValidTaxonName.Value ? Labels.TrueLabel : Labels.FalseLabel));
            }

            // NameCategoryId
            if (NameCategoryId.GetValueOrDefault(-1) != -1)
            {
                SelectList taxonNameCategorySelectList = CreateTaxonNameCategorySelectList(NameCategoryId);
                foreach (SelectListItem selectListItem in taxonNameCategorySelectList)
                {
                    if (selectListItem.Value == NameCategoryId.Value.ToString())
                    {
                        list.Add(new KeyValuePair <string, string>(Labels.TaxonNameCategoryLabel, selectListItem.Text));
                        break;
                    }
                }
            }

            // Author
            if (!string.IsNullOrEmpty(this.AuthorSearchString))
            {
                list.Add(new KeyValuePair <string, string>(Labels.AuthorLabel, AuthorSearchString));
            }

            return(list);
        }
        /// <summary>
        /// Returns a list with the search parameters that are
        /// different than default
        /// </summary>
        /// <returns></returns>
        public List <Tuple <string, string> > GetSearchDescription()
        {
            var list = new List <Tuple <string, string> >();

            // Restrict to taxon
            if (this.RestrictToTaxonChildren)
            {
                list.Add(new Tuple <string, string>(RestrictToTaxonDescription, ""));
            }

            // NameCompareOperator
            if (this.NameCompareOperator != this.DefaultNameCompareOperator)
            {
                SelectList compareOperatorSelectList = CreateCompareOperatorSelectlist(NameCompareOperator);
                foreach (SelectListItem selectListItem in compareOperatorSelectList)
                {
                    if (selectListItem.Value == NameCompareOperator.Value.ToString())
                    {
                        list.Add(new Tuple <string, string>(Labels.TaxonNameCompareOperatorLabel, selectListItem.Text));
                        break;
                    }
                }
            }

            // IsUnique
            if (this.IsUnique != null)
            {
                list.Add(new Tuple <string, string>(Labels.IsUniqueLabel, IsUnique.Value ? Labels.TrueLabel : Labels.FalseLabel));
            }

            // IsValidTaxon
            if (this.IsValidTaxon != null)
            {
                list.Add(new Tuple <string, string>(Labels.IsValidTaxonLabel, IsValidTaxon.Value ? DyntaxaResource.TaxonSummaryValitityValueAccepted : DyntaxaResource.TaxonSummaryValitityValueNotValid));
            }

            // IsRecommended
            if (this.IsRecommended != null)
            {
                list.Add(new Tuple <string, string>(Labels.IsRecommendedLabel, IsRecommended.Value ? Labels.TrueLabel : Labels.FalseLabel));
            }

            // IsOkForObsSystems
            if (this.IsOkForObsSystems != null)
            {
                list.Add(new Tuple <string, string>(Labels.IsOkForObsSystemLabel, IsOkForObsSystems.Value ? Labels.TrueLabel : Labels.FalseLabel));
            }

            // IsValidTaxonNameLabels
            if (this.IsValidTaxonName != null)
            {
                list.Add(new Tuple <string, string>(Labels.IsValidTaxonNameLabel, IsValidTaxonName.Value ? Labels.TrueLabel : Labels.FalseLabel));
            }

            // NameCategoryId
            if (NameCategoryId.GetValueOrDefault(-1) != -1)
            {
                SelectList taxonNameCategorySelectList = CreateTaxonNameCategorySelectList(NameCategoryId);
                foreach (SelectListItem selectListItem in taxonNameCategorySelectList)
                {
                    if (selectListItem.Value == NameCategoryId.Value.ToString())
                    {
                        list.Add(new Tuple <string, string>(Labels.TaxonNameCategoryLabel, selectListItem.Text));
                        break;
                    }
                }
            }

            // Author
            if (!string.IsNullOrEmpty(this.AuthorSearchString))
            {
                list.Add(new Tuple <string, string>(Labels.AuthorLabel, AuthorSearchString));
            }

            if (LastUpdatedStartDate.HasValue && LastUpdatedEndDate.HasValue)
            {
                string lastUpdatedDescription = string.Format(
                    "{0}: {1}, {2}: {3}",
                    Labels.LastUpdatedStartLabel,
                    LastUpdatedStartDate.Value.ToShortDateString(),
                    Labels.LastUpdatedEndLabel,
                    LastUpdatedEndDate.Value.ToShortDateString());
                list.Add(new Tuple <string, string>(Labels.LastUpdatedLabel, lastUpdatedDescription));
            }

            return(list);
        }