示例#1
0
        private Boolean isValidInput()
        {
            if (teamNameBox.Text == "")
            {
                errorLabel.Text     = "Please enter a team name";
                errorLabel.Location = new Point((ActiveForm.Width - errorLabel.Width) / 2, 465);
                addingLabel.Text    = "";
                return(false);
            }
            else if (teamNameBox.Text.Length > 15)
            {
                errorLabel.Text     = "Team names but be 15 characters or less";
                errorLabel.Location = new Point((ActiveForm.Width - errorLabel.Width) / 2, 465);
                addingLabel.Text    = "";
                return(false);
            }
            else if (coachNameBox.Text.Length > 15)
            {
                errorLabel.Text     = "Coach names but be 15 characters or less";
                errorLabel.Location = new Point((ActiveForm.Width - errorLabel.Width) / 2, 465);
                addingLabel.Text    = "";
                return(false);
            }
            else if (sql.findTeam5v5(teamNameBox.Text).ToLower() == teamNameBox.Text.ToLower())
            {
                errorLabel.Text     = "A team with that name already exists";
                errorLabel.Location = new Point((ActiveForm.Width - errorLabel.Width) / 2, 465);
                addingLabel.Text    = "";
                return(false);
            }
            else if (playerListBox.CheckedItems.Count != 5)
            {
                errorLabel.Text     = "You must have exactly 5 names checked";
                errorLabel.Location = new Point((ActiveForm.Width - errorLabel.Width) / 2, 465);
                return(false);
            }

            return(true);
        }