protected void populateHeadToHead(DbMatchInfo <TableTennisMatchInfo> match) { // not played matches we dont want if (match.MatchInfo == null) { return; } HeadToHeadKey key = new HeadToHeadKey(match.CompetitorId1, match.CompetitorId2); if (!PlayerHeadToHeadInfos.ContainsKey(key)) { PlayerHeadToHeadInfos.Add(key, new HeadToHeadInfo <SortInfo>(match.CompetitorId1, match.CompetitorId2)); } PlayerHeadToHeadInfos[key].Info1.Update(match); PlayerHeadToHeadInfos[key].Info2.Update(match); }
private void update(DbMatchInfo <TableTennisMatchInfo> match) { if (match?.MatchInfo?.Sets1?.Any() != true) { return; } var setsWon = 0; for (int i = 0; i < match.MatchInfo.Sets1.Count; i++) { if (string.IsNullOrEmpty(match.MatchInfo.Sets1[i]) || string.IsNullOrEmpty(match.MatchInfo.Sets2[i])) { continue; } var pointsWon = match.CompetitorId1 == ID?Convert.ToInt32(match.MatchInfo.Sets1[i]) : Convert.ToInt32(match.MatchInfo.Sets2[i]); var pointsLost = match.CompetitorId1 == ID?Convert.ToInt32(match.MatchInfo.Sets2[i]) : Convert.ToInt32(match.MatchInfo.Sets1[i]); if (pointsWon == 0 && pointsLost == 0) { continue; } if (pointsWon > pointsLost) { SetsWon++; setsWon++; } else { SetsLost++; } PointsWon += pointsWon; PointsLost += pointsLost; } if (setsWon == 3) { Wins++; } }
protected void populateCompetitorsInfo(DbMatchInfo <TableTennisMatchInfo> match) { if (!PlayerCompetitionInfos.ContainsKey(match.CompetitorId1)) { PlayerCompetitionInfos.Add(match.CompetitorId1, new SortInfo() { ID = match.CompetitorId1 }); } if (!PlayerCompetitionInfos.ContainsKey(match.CompetitorId2)) { PlayerCompetitionInfos.Add(match.CompetitorId2, new SortInfo() { ID = match.CompetitorId2 }); } PlayerCompetitionInfos[match.CompetitorId1].Update(match); PlayerCompetitionInfos[match.CompetitorId2].Update(match); }
public void Update <TMatchInfo>(DbMatchInfo <TMatchInfo> match) where TMatchInfo : MatchInfoBase { update(match as DbMatchInfo <TableTennisMatchInfo>); }