Ejemplo n.º 1
0
 /// <summary>
 /// chheck if the textBoxes are valids
 /// </summary>
 /// <returns>True - if valids, False - if not</returns>
 private bool CheckTextBoxFields()
 {
     if (RegexValidations.NameValidation(textBoxManagerName.Text) &&
         RegexValidations.NumericValidation(textBoxExperience.Text) &&
         RegexValidations.NumericValidation(textBoxAge.Text) &&
         RegexValidations.NumericValidation(textBoxTitles.Text))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Ejemplo n.º 2
0
        /// <summary>
        /// check the textboxes input from the user
        /// </summary>
        /// <returns>True - if it's O.k input, False - if something wrong with the input</returns>
        private bool CheckTextBoxFields()
        {
            // check if the score is valid
            if (!RegexValidations.NumericValidation(textBoxAwayScore.Text) ||
                !RegexValidations.NumericValidation(textBoxHomeScore.Text))
            {
                MessageBox.Show("Wrong input!", "Insert data again");
                return(false);
            }

            // check if the score is draw
            if (Convert.ToInt32(textBoxHomeScore.Text) == Convert.ToInt32(textBoxAwayScore.Text))
            {
                MessageBox.Show("The result can't be a draw", "Wrong input!");
                return(false);
            }
            // check if fixture combo box selected
            if (string.IsNullOrEmpty(comboBoxFixture.Text))
            {
                MessageBox.Show("Select Fixture", "Fixture not selected");
                return(false);
            }
            // check if MVP combo box selected
            if (string.IsNullOrEmpty(comboBoxMVP.Text))
            {
                MessageBox.Show("Select MVP", "MVP not selected");
                return(false);
            }
            // check if selected away and home teams
            if (comboBoxHome.SelectedItem == null || comboBoxAway.SelectedItem == null)
            {
                MessageBox.Show("Select two teams");
            }
            // check if not selected the same team in home and away
            if (comboBoxHome.SelectedItem.ToString() == comboBoxAway.SelectedItem.ToString())
            {
                MessageBox.Show("Select different teams", "Select teams error");
                return(false);
            }

            return(true);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// check the text boxes validation
 /// </summary>
 /// <returns></returns>
 private bool CheckTextBoxFields()
 {
     if (RegexValidations.NameValidation(textBoxPlayerName.Text) &&
         RegexValidations.NumericValidation(textBoxExperience.Text) &&
         RegexValidations.NumericValidation(textBoxAge.Text) &&
         RegexValidations.NumericValidation(textBoxTitles.Text) &&
         RegexValidations.HeightAndWeightValidation(textBoxHeight.Text) &&
         RegexValidations.HeightAndWeightValidation(textBoxWeight.Text))
     {
         return(true);
     }
     else
     {
         // change the color of the specific textBox problem
         if (!RegexValidations.NameValidation(textBoxPlayerName.Text))
         {
             textBoxPlayerName.ForeColor = Color.Red;
         }
         if (!RegexValidations.NameValidation(textBoxExperience.Text))
         {
             textBoxPlayerName.ForeColor = Color.Red;
         }
         if (!RegexValidations.NameValidation(textBoxAge.Text))
         {
             textBoxPlayerName.ForeColor = Color.Red;
         }
         if (!RegexValidations.NameValidation(textBoxTitles.Text))
         {
             textBoxPlayerName.ForeColor = Color.Red;
         }
         if (!RegexValidations.NameValidation(textBoxHeight.Text))
         {
             textBoxPlayerName.ForeColor = Color.Red;
         }
         if (!RegexValidations.NameValidation(textBoxWeight.Text))
         {
             textBoxPlayerName.ForeColor = Color.Red;
         }
         return(false);
     }
 }