Example #1
0
        private void removeEloFromCheckBoxString()
        {
            int countTeam = sql.count("teams5v5", "id", "");

            try
            {
                string p1 = "";
                string p2 = "";
                string p3 = "";
                string p4 = "";
                string p5 = "";

                foreach (string s in playerListBox.CheckedItems)
                {
                    string removedElo = "";

                    if (s.Contains("   "))
                    {
                        removedElo = s.Substring(s.IndexOf("   ") + 3);
                    }
                    else
                    {
                        removedElo = s.Substring(s.IndexOf(" ") + 1);
                    }
                    if (p1 == "")
                    {
                        p1 = removedElo;
                    }
                    else if (p2 == "")
                    {
                        p2 = removedElo;
                    }
                    else if (p3 == "")
                    {
                        p3 = removedElo;
                    }
                    else if (p4 == "")
                    {
                        p4 = removedElo;
                    }
                    else if (p5 == "")
                    {
                        p5 = removedElo;
                    }
                }

                sql.add5v5Team(countTeam, teamNameBox.Text, coachNameBox.Text, p1, p2, p3, p4, p5);
            }
            catch
            {
                errorLabel.Text     = "Team name already exists";
                errorLabel.Location = new Point((ActiveForm.Width - errorLabel.Width) / 2, 465);
                addingLabel.Text    = "";
            }

            errorLabel.Text     = "Team successfully added";
            errorLabel.Location = new Point((ActiveForm.Width - errorLabel.Width) / 2, 465);
            addingLabel.Text    = "";
        }