Ejemplo n.º 1
0
        public ResultReasonTuple CanBeEnded()
        {
            var result = new ResultReasonTuple(true);

            if (Status == TournamentStatus.Prestart)
            {
                return(new ResultReasonTuple(false, Text.RoundNotStarted));
            }
            if (Status == TournamentStatus.Ended)
            {
                return(new ResultReasonTuple(false, Text.RoundAlreadyEnded));
            }
            var nonScoredContestants = ContestantEntries.Where(p => p.TotalScore == null).Select(p => p.Contestant.Name);

            if (nonScoredContestants.Count() != 0)
            {
                result.IsTrue = false;
                if (nonScoredContestants.Count() > 1)
                {
                    result.Reason = Text.ContestantsNotScored;
                }
                else
                {
                    result.Reason = String.Format(Text.ContestantXNotScored, nonScoredContestants.First());
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
 public IOrderedEnumerable <RoundContestant> GetContestantsInHeat(int heatNo)
 {
     return(ContestantEntries.Where(p => p.HeatNo == heatNo).OrderBy(p => p.Ordinal));
 }