private void AfterMatchEdit(MatchPainter aMatchView) { MatchInfo aMatch = aMatchView.Match; MatchInfo winners_match = Competition.Matches.GetMatchByLabel(aMatch.Winners_MatchLabel); MatchInfo loosers_match = Competition.Matches.GetMatchByLabel(aMatch.Loosers_MatchLabel); MatchPlayer winner_place = null; if (winners_match != null) { switch (winners_match.Label.Letter) { case MatchLabel.PlayerLetters.A: winner_place = winners_match.PlayerA; break; case MatchLabel.PlayerLetters.B: winner_place = winners_match.PlayerB; break; } } MatchPlayer looser_place = null; if (loosers_match != null) { switch (loosers_match.Label.Letter) { case MatchLabel.PlayerLetters.A: looser_place = loosers_match.PlayerA; break; case MatchLabel.PlayerLetters.B: looser_place = loosers_match.PlayerB; break; } } MatchPlayer winner = aMatch.WinnerPlayer; MatchPlayer looser = aMatch.LooserPlayer; if (winner == null || looser == null) { if (winner_place != null) { winner_place.Id = -1; winner_place.Name = "Winner " + aMatch.Label.ToString(); } if (looser_place != null) { looser_place.Id = -1; looser_place.Name = "Looser " + aMatch.Label.ToString(); } } else { if (winner_place != null) { winner_place.Id = winner.Id; winner_place.Name = winner.Name; } if (looser_place != null) { looser_place.Id = looser.Id; looser_place.Name = looser.Name; } } if (winners_match != null) { winners_match.Refresh(); } if (loosers_match != null) { loosers_match.Refresh(); } TA.DB.Manager.DatabaseManager.CurrentDb.SetCompetitionPlayerPlace(Competition.Info.Id, aMatch.PlayerA.Id, ""); TA.DB.Manager.DatabaseManager.CurrentDb.SetCompetitionPlayerPlace(Competition.Info.Id, aMatch.PlayerB.Id, ""); Competition.Players[aMatch.PlayerA.Id].Place = ""; Competition.Players[aMatch.PlayerB.Id].Place = ""; if (aMatch.Winners_MatchLabel.Place != "" && aMatch.WinnerId != -1) { Competition.Players[winner.Id].Place = aMatch.Winners_MatchLabel.Place; TA.DB.Manager.DatabaseManager.CurrentDb.SetCompetitionPlayerPlace(Competition.Info.Id, aMatch.WinnerId, aMatch.Winners_MatchLabel.Place); } if (aMatch.Loosers_MatchLabel.Place != "" && aMatch.WinnerId != -1) { Competition.Players[looser.Id].Place = aMatch.Loosers_MatchLabel.Place; TA.DB.Manager.DatabaseManager.CurrentDb.SetCompetitionPlayerPlace(Competition.Info.Id, aMatch.LooserId, aMatch.Loosers_MatchLabel.Place); } }