/// <summary> /// create match object /// </summary> /// <param name="elem">contains required element for round</param> /// <param name="tenum">tournament dyscypline as enum</param> /// <param name="referees">dictionary of referees with id key</param> /// <param name="teams">dictionary of teams with id key</param> /// <returns>match object</returns> private static TMatch.Match CreateMatch(MatchTempl elem, TEnum.TournamentDyscypline tenum, Dictionary <int, TPerson.Referee> referees, Dictionary <int, TTeam.ITeam> teams) { TMatch.Match match; switch (tenum) { case TEnum.TournamentDyscypline.dodgeball: match = new TMatch.DodgeballMatch(teams[elem.TeamA], teams[elem.TeamB], new List <TPerson.Referee> { referees[elem.RefA] }); break; case TEnum.TournamentDyscypline.tugofwar: match = new TMatch.TugOfWarMatch(teams[elem.TeamA], teams[elem.TeamB], new List <TPerson.Referee> { referees[elem.RefA] }); break; default: return(null); } if (elem.Winner != null) { match.Winner = teams[int.Parse(elem.Winner)]; } match.IsWalkover = elem.IsWalkover; return(match); }
/// <summary> /// create volleyball match object /// </summary> /// <param name="elem">contains required element for round</param> /// <param name="tenum">tournament dyscypline as enum</param> /// <param name="referees">dictionary of referees with id key</param> /// <param name="teams">dictionary of teams with id key</param> /// <returns>match object</returns> private static TMatch.Match CreateVolleyballMatch(MatchTempl elem, TEnum.TournamentDyscypline tenum, Dictionary <int, TPerson.Referee> referees, Dictionary <int, TTeam.ITeam> teams) { TMatch.Match match = new TMatch.VolleyballMatch(teams[elem.TeamA], teams[elem.TeamB], new List <TPerson.Referee> { referees[elem.RefA], referees[elem.assistantReferees[0]], referees[elem.assistantReferees[1]] }); if (elem.Winner != null) { match.Winner = teams[int.Parse(elem.Winner)]; } ((TMatch.VolleyballMatch)match).SetResult(elem.ScoreTeamA, elem.ScoreTeamB); match.IsWalkover = elem.IsWalkover; return(match); }