private void ActivateStatus() { tournamentDetails.tournamentStatus = 2; List <Team> team = TeamHelper.GetTeam(tournamentDetails); List <GameOfficial> gameofficial = GameOfficialHelper.GetAllGameOfficial(tournamentDetails); List <Player> player = PlayerHelper.GetPlayer(tournamentDetails); List <Venue> venue = VenueHelper.GetVenue(); /* if(tournamentDetails.ValidationOfActivation(team,gameofficial,player) != true) * { * MessageBox.Show("Error Activating"); * return; * } */ List <Match> match = Match.GenerateMatch(team, venue, tournamentDetails); foreach (Match m in match) { MatchHelper.SaveMatch(m); } if (TournamentHelper.UpdateTournamentStatus(tournamentDetails) == 0) { //report an error MessageBox.Show("Error activating tournament"); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } this.DialogResult = System.Windows.Forms.DialogResult.OK; }
private void ActivateStatus() { int si = 0; try { si = lvwTournaments.SelectedItems[0].Index; } catch { return; } Tournament selectedTournament = list[si]; selectedTournament.tournamentStatus = 2; List <Team> team = TeamHelper.GetTeam(selectedTournament); List <GameOfficial> gameofficial = GameOfficialHelper.GetAllGameOfficial(selectedTournament); List <Player> player = PlayerHelper.GetPlayer(selectedTournament); List <Venue> venue = VenueHelper.GetVenue(); if (selectedTournament.ValidationOfActivation(team, gameofficial, player) != true) { MessageBox.Show("Cannot Activate because you need follow the rules activating the tourmament[2 Teams] And [2 Game Official] require"); return; } List <Match> match = Match.GenerateMatch(team, venue, selectedTournament); foreach (Match m in match) { MatchHelper.SaveMatch(m); } if (TournamentHelper.UpdateTournamentStatus(selectedTournament) == 0) { //report an error MessageBox.Show("Error activating tournament"); this.DialogResult = System.Windows.Forms.DialogResult.Cancel; } lblStatus.Text = "Activate"; btnActivate.Visible = false; btnPrint.Visible = false; btnExportTeamRooster.Visible = true; btnClose.Visible = true; displayTournament(); }