コード例 #1
0
        public ScheduleTeamMatchup(teammatchup tm)
        {
            int numOfTeams = tm.teams.Count;

            this.MatchOrder = tm.matchOrder;

            team team1 = numOfTeams > 0 ? tm.teams.First() : null;
            team team2 = numOfTeams > 1 ? tm.teams.Skip(1).First() : null;

            if (team1 != null)
            {
                this.Team1       = TeamResponse.From(team1);
                this.Team1Points = tm.PointsFor(team1);
                this.Team1Win    = tm.Team1Won();
            }

            if (team2 != null)
            {
                this.Team2       = TeamResponse.From(team2);
                this.Team2Points = tm.PointsFor(team2);
                this.Team2Win    = tm.Team2Won();
            }

            this.IsComplete  = tm.IsComplete();
            this.TeeTimeText = tm.TeeTimeText();
            this.Id          = tm.id;
            this.PlayoffType = tm.playoffType;

            if (this.IsComplete && team1 != null && team2 != null)
            {
                result team1PointsResult = tm.TopPoints(team1);
                //result team2PointsResult = tm.TopPoints(team2);

                this.TopPoints = team1PointsResult != null ?
                                 new MatchSummaryValue
                {
                    Player         = new PlayerWebResponse(team1PointsResult.player),
                    FormattedValue = LeaderBoardFormat.Default.FormatValue(team1PointsResult.points),
                    Value          = (double)team1PointsResult.points
                } : null;


                result topNetScore = tm.TopNetDifference(team1);

                this.TopNetScore = topNetScore != null ?
                                   new MatchSummaryValue
                {
                    Player         = new PlayerWebResponse(topNetScore.player),
                    FormattedValue = LeaderBoardFormat.Net.FormatValue(topNetScore.NetScoreDifference()),
                    Value          = (double)topNetScore.NetScoreDifference()
                } : null;

                //this.Team2TopPoints = team2PointsResult != null ?
                //    new MatchSummaryValue
                //    {
                //        Player = new PlayerWebResponse(team2PointsResult.player),
                //        FormattedValue = LeaderBoardFormat.Default.FormatValue(team2PointsResult.points),
                //        Value = (double)team2PointsResult.points
                //    } : null;
            }
        }