Ejemplo n.º 1
0
        /// <summary>
        /// Gets a description of the match suitable for metadata or search results
        /// </summary>
        public string Description()
        {
            var description = new StringBuilder();

            // Display match type/season/tournament
            if (Tournament != null)
            {
                // Check for 'the' to get the grammar right
                var the = (Tournament.TournamentName.StartsWith("THE ", StringComparison.OrdinalIgnoreCase)) ? string.Empty : "the ";
                description.Append("Match in ").Append(the).Append(Tournament.TournamentName);
                if (MatchLocation != null)
                {
                    description.Append(" at ").Append(MatchLocation.NameAndLocalityOrTown());
                }
                description.Append('.');
            }
            else
            {
                description.Append("Stoolball ").Append(MatchType.Humanize(LetterCasing.LowerCase));
                if (MatchLocation != null)
                {
                    description.Append(" at ").Append(MatchLocation.NameAndLocalityOrTown());
                }

                if (Season != null)
                {
                    var the = Season.Competition.CompetitionName.ToUpperInvariant().Contains("THE ");
                    description.Append(" in ").Append(the ? string.Empty : "the ").Append(Season.Competition.CompetitionName);
                }

                description.Append('.');
            }

            return(description.ToString());
        }
        /// <summary>
        /// Gets a description of the match suitable for metadata or search results
        /// </summary>
        public string Description()
        {
            var description = new StringBuilder(PlayerType.Humanize(LetterCasing.Sentence)).Append(" stoolball ");

            description.Append(MatchType == null ? "tournament" : MatchType.Humanize(LetterCasing.LowerCase));
            if (MatchLocation != null)
            {
                description.Append(" at ").Append(MatchLocation.NameAndLocalityOrTown());
            }
            description.Append(". ");

            if (TournamentQualificationType == Matches.TournamentQualificationType.OpenTournament)
            {
                description.Append("Any team may enter this tournament. ");
            }
            else if (TournamentQualificationType == Matches.TournamentQualificationType.ClosedTournament)
            {
                description.Append("This tournament is for invited or qualifying teams only. ");
            }

            if (PlayersPerTeam.HasValue)
            {
                description.Append(PlayersPerTeam).Append(" players per team. ");
            }

            return(description.ToString().TrimEnd());
        }