Пример #1
0
 public TournamentParticipant(TournamentApplication application)
 {
     Id      = application.Id;
     UserId  = application.UserId;
     State   = application.State;
     Company = application.CompanyId;
 }
 public TournamentSC2Participant(TournamentApplication application, List <TournamentSC2Match> matches)
     : base(application)
 {
     BattleTag            = application.BattleNetId;
     User                 = new UserSummaryViewModel(application.User);
     TournamentSC2GroupId = application.TournamentSC2GroupId;
     if (matches != null)
     {
         foreach (TournamentSC2Match match in matches)
         {
             if (match.Player1Id == UserId)
             {
                 PlayerPoints += match.Player1Points;
                 if (match.Player1Points + match.Player2Points > 0)
                 {
                     Matches++;
                     if (match.Player1Points > match.Player2Points)
                     {
                         Wins++;
                     }
                     else
                     {
                         Losses++;
                     }
                 }
             }
             else if (match.Player2Id == UserId)
             {
                 PlayerPoints += match.Player2Points;
                 if (match.Player1Points + match.Player2Points > 0)
                 {
                     Matches++;
                     if (match.Player2Points > match.Player1Points)
                     {
                         Wins++;
                     }
                     else
                     {
                         Losses++;
                     }
                 }
             }
         }
     }
 }
        public TournamentCSGOParticipant(TournamentApplication application, List <TournamentCSGOMatch> matches)
            : base(application)
        {
            TeamId = application.TeamId;
            Team   = new CSGOTeamSummaryViewModel(application.Team);
            TournamentCSGOGroupId = application.TournamentCSGOGroupId;
            if (matches != null)
            {
                foreach (TournamentCSGOMatch match in matches)
                {
                    if (match.Team1Id == Team.TeamId)
                    {
                        TeamPoints += match.Team1Points;
                        foreach (CSGOMatchMap map in match.Maps)
                        {
                            RoundDifference += map.Team1Score;
                            RoundDifference -= map.Team2Score;
                        }
                        if (match.NoShow && match.Team1Points > match.Team2Points)
                        {
                            RoundDifference += 8;
                        }

                        if (match.Team1Points + match.Team2Points > 0)
                        {
                            Matches++;
                            if (match.Team1Points > match.Team2Points)
                            {
                                if (match.Team1Points + match.Team2Points > 30)
                                {
                                    OTWins++;
                                }
                                else
                                {
                                    Wins++;
                                }
                            }
                            else
                            {
                                if (match.Team1Points + match.Team2Points > 30)
                                {
                                    OTLosses++;
                                }
                                else
                                {
                                    Losses++;
                                }
                            }
                        }
                    }
                    else if (match.Team2Id == Team.TeamId)
                    {
                        TeamPoints += match.Team2Points;
                        foreach (CSGOMatchMap map in match.Maps)
                        {
                            RoundDifference -= map.Team1Score;
                            RoundDifference += map.Team2Score;
                        }
                        if (match.NoShow && match.Team2Points > match.Team1Points)
                        {
                            RoundDifference += 8;
                        }

                        if (match.Team1Points + match.Team2Points > 0)
                        {
                            Matches++;
                            if (match.Team2Points > match.Team1Points)
                            {
                                if (match.Team1Points + match.Team2Points > 30)
                                {
                                    OTWins++;
                                }
                                else
                                {
                                    Wins++;
                                }
                            }
                            else
                            {
                                if (match.Team1Points + match.Team2Points > 30)
                                {
                                    OTLosses++;
                                }
                                else
                                {
                                    Losses++;
                                }
                            }
                        }
                    }
                }
            }
        }