示例#1
0
        private void FormEditPlayer_Load(object sender, EventArgs e)
        {
            listTeams = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");

            comboBoxTeam.DataSource    = listTeams;
            comboBoxTeam.DisplayMember = "Name";
            comboBoxTeam.DropDownStyle = ComboBoxStyle.DropDownList;

            Players selectedPlayer = Players.SelectPlayer(selectedPlayerId);

            int    selectedTeamId = selectedPlayer.Team.Id;
            string teamName       = "";

            foreach (Teams t in listTeams)
            {
                if (t.Id == selectedTeamId)
                {
                    teamName = t.Name;
                }
            }

            textBoxPlayerId.Text       = selectedPlayer.Id.ToString();
            textBoxPlayerName.Text     = selectedPlayer.Name;
            textBoxPlayerEmail.Text    = selectedPlayer.Email;
            comboBoxTeam.SelectedIndex = comboBoxTeam.FindStringExact(teamName);
        }
示例#2
0
 private void FormPairing_Load(object sender, EventArgs e)
 {
     listTeam = TournamentEntry.ReadTeam(FormMenu.selectedTournament);
     listPair = Pairing.GeneratePairing(listTeam);
     FormatDataGrid();
     AddPairToDataGrid();
 }
        public void FormPlayerTeam_Load(object sender, EventArgs e)
        {
            // Get data from db
            teamList = TournamentEntry.ReadTeam(FormMenu.selectedTournament);

            // Show data to datagridteams
            ShowDataGridTeams();

            // Get player data from db
            playerList = TournamentEntry.ReadPlayer(FormMenu.selectedTournament);

            // Format datagridplayer
            FormatDataGridPlayers();

            // Show data to datagridplayer
            ShowDataGridPlayers();

            if (FormMenu.buttonPlayerClicked == true)
            {
                tabControlTeam.SelectedIndex = 1;
                FormMenu.buttonPlayerClicked = false;
            }
            else
            {
                tabControlTeam.SelectedIndex = 0;
            }
        }
示例#4
0
        private void buttonGeneratePairingSE_Click(object sender, EventArgs e)
        {
            listBoxPairingSE.Items.Clear();

            List <Teams> listTeam = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");

            Random rnd = new Random();

            for (int i = listTeam.Count() - 1; i > 0; i--)
            {
                Teams temp  = listTeam[i];
                int   index = rnd.Next(0, i + 1);
                listTeam[i]     = listTeam[index];
                listTeam[index] = temp;
            }

            var teamstack = new Stack <Teams>(listTeam);

            while (teamstack.Count != 0 && teamstack.Count() != 1)
            {
                listBoxPairingSE.Items.Add(teamstack.Pop().Name + " vs " + teamstack.Pop().Name);
            }
            if (teamstack.Count == 1)
            {
                listBoxPairingSE.Items.Add(teamstack.Pop().Name + " vs bye");
            }
        }
        private void TextBoxSearchTeam_TextChanged(object sender, EventArgs e)
        {
            // Get texboxsearch
            string teamSearchCriteria = textBoxSearchTeam.Text;

            // Team search query with criteria
            teamList = TournamentEntry.ReadTeam(FormMenu.selectedTournament, teamSearchCriteria);

            // Refresh datagridteam
            ShowDataGridTeams();
        }
        private void FormDeletePlayer_Load(object sender, EventArgs e)
        {
            listTeams = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");

            Players selectedPlayer = Players.SelectPlayer(selectedPlayerId);

            textBoxPlayerId.Text    = selectedPlayer.Id.ToString();
            textBoxPlayerName.Text  = selectedPlayer.Name;
            textBoxPlayerEmail.Text = selectedPlayer.Email;
            comboBoxTeam.Text       = selectedPlayer.Team.Name;
        }
        private void FormAddPlayer_Load(object sender, EventArgs e)
        {
            listteam = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");
            comboBoxTeam.DataSource    = listteam;
            comboBoxTeam.DisplayMember = "Name";
            comboBoxTeam.DropDownStyle = ComboBoxStyle.DropDownList;

            string newCode = Players.GenerateCode();

            textBoxPlayerId.Text    = newCode;
            textBoxPlayerId.Enabled = false;
            textBoxPlayerName.Focus();
        }
        private void textBoxSearchTeam_TextChanged(object sender, EventArgs e)
        {
            teamList = TournamentEntry.ReadTeam(FormMenu.selectedTournament, textBoxSearchTeam.Text);

            if (teamList.Count > 0)
            {
                dataGridViewTeam.DataSource = teamList;
            }
            else
            {
                dataGridViewTeam.DataSource = null;
            }
        }
示例#9
0
        private void FormDeletePlayer_Load(object sender, EventArgs e)
        {
            // Get team for combobox
            listTeams = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");

            // Get selected player to be deleted
            Players selectedPlayer = Players.SelectPlayer(selectedPlayerId);

            // Show selected player to be deleted's data to form
            textBoxPlayerId.Text    = selectedPlayer.Id.ToString();
            textBoxPlayerName.Text  = selectedPlayer.Name;
            textBoxPlayerEmail.Text = selectedPlayer.Email;
            comboBoxTeam.Text       = selectedPlayer.Team.Name;
        }
示例#10
0
        private void FormEditMatchup_Load(object sender, EventArgs e)
        {
            listTeam1 = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");
            listTeam2 = TournamentEntry.ReadTeam(FormMenu.selectedTournament);

            comboBoxTeam1.DataSource = listTeam1;
            comboBoxTeam2.DataSource = listTeam2;

            comboBoxTeam1.DisplayMember = "Name";
            comboBoxTeam2.DisplayMember = "Name";

            comboBoxTeam1.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBoxTeam1.DropDownStyle = ComboBoxStyle.DropDownList;

            // Show Data
            textBoxId.Text              = FormMatch.selectedMatchup.Id;
            textBoxRound.Text           = FormMatch.selectedMatchup.Round.ToString();
            dateTimePickerMatchup.Value = FormMatch.selectedMatchup.Date;

            int    team1Id    = FormMatch.selectedMatchupEntry1.Team.Id;
            string team1Name  = "";
            double team1Score = 0;

            foreach (Teams team in listTeam1)
            {
                if (team.Id == team1Id)
                {
                    team1Name  = team.Name;
                    team1Score = team.TotalScore;
                }
            }
            comboBoxTeam1.SelectedIndex = comboBoxTeam1.FindStringExact(team1Name);
            textBoxScore1.Text          = FormMatch.selectedMatchupEntry1.Score.ToString();

            int    team2Id    = FormMatch.selectedMatchupEntry2.Team.Id;
            string team2Name  = "";
            double team2Score = 0;

            foreach (Teams team in listTeam2)
            {
                if (team.Id == team2Id)
                {
                    team2Name  = team.Name;
                    team2Score = team.TotalScore;
                }
            }
            comboBoxTeam2.SelectedIndex = comboBoxTeam2.FindStringExact(team2Name);
            textBoxScore2.Text          = FormMatch.selectedMatchupEntry2.Score.ToString();
        }
示例#11
0
        private void button1_Click(object sender, EventArgs e)
        {
            listBoxPairingRR.Items.Clear();

            List <Teams> listTeam = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");

            int listteamcount = listTeam.Count();
            int iterasi       = listteamcount - 1;

            for (int i = 0; i <= iterasi; i++)
            {
                for (int j = i + 1; j <= listteamcount - 1; j++)
                {
                    listBoxPairingRR.Items.Add(listTeam[i].Name + " vs " + listTeam[j].Name);
                }
            }
        }
        private void FormAddMatchup_Load(object sender, EventArgs e)
        {
            listTeam1 = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");
            listTeam2 = TournamentEntry.ReadTeam(FormMenu.selectedTournament);

            comboBoxTeam1.DataSource = listTeam1;
            comboBoxTeam2.DataSource = listTeam2;

            comboBoxTeam1.DisplayMember = "Name";
            comboBoxTeam2.DisplayMember = "Name";

            comboBoxTeam1.DropDownStyle = ComboBoxStyle.DropDownList;
            comboBoxTeam1.DropDownStyle = ComboBoxStyle.DropDownList;

            string newCode = Matchups.GenerateId();

            textBoxId.Text = newCode;
        }
        public void FormPlayerTeam_Load(object sender, EventArgs e)
        {
            //Team
            teamList = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");

            if (teamList.Count > 0)
            {
                dataGridViewTeam.DataSource = teamList;
            }
            else
            {
                dataGridViewTeam.DataSource = null;
            }

            //Player
            FormatDataGridPlayers();
            playerList = TournamentEntry.ReadPlayer(FormMenu.selectedTournament, "");
            ShowDataGridPlayers();
        }
        private void FormAddPlayer_Load(object sender, EventArgs e)
        {
            // Get data for teamlist
            listteam = TournamentEntry.ReadTeam(FormMenu.selectedTournament, "");

            // Show available team on combobox
            comboBoxTeam.DataSource    = listteam;
            comboBoxTeam.DisplayMember = "Name";
            comboBoxTeam.DropDownStyle = ComboBoxStyle.DropDownList;

            // Generate playerid
            string newCode = Players.GenerateId();

            // Fill generated playerid on form
            textBoxPlayerId.Text = newCode;

            // Disable editing player id texbox
            textBoxPlayerId.Enabled = false;

            // Focus player name textbox
            textBoxPlayerName.Focus();
        }