Esempio n. 1
0
        private bool ValidateForm()
        {
            bool isValid = true;

            if (!_validator.IsStringValid(FilmNameTextBox.Text))
            {
                EditFilmErrorProvider.SetError(FilmNameTextBox, "Wrong chars");
                FilmNameTextBox.Focus();
                isValid = false;
            }
            if (!editYearTextBox.IsYearValid())
            {
                isValid = false;
            }
            if (!_validator.IsStringValid(ProducerTextBox.Text))
            {
                EditFilmErrorProvider.SetError(ProducerTextBox, "Incorrect year");
                ProducerTextBox.Focus();
                isValid = false;
            }
            else
            {
                EditFilmErrorProvider.SetError(FilmNameTextBox, String.Empty);
            }
            return(isValid);
        }
Esempio n. 2
0
        private bool ValidateForm()
        {
            bool isValid = true;

            if (!_validator.IsStringValid(FilmNameTextBox.Text))
            {
                FindErrorProvider.SetError(FilmNameTextBox, "String must be russian and not contains special simbols");
                FilmNameTextBox.Focus();
                isValid = false;
            }
            if (!YearFromTextBox.IsYearValid())
            {
                isValid = false;
            }
            if (!YearToTextBox.IsYearValid())
            {
                isValid = false;
            }
            if (!_validator.IsStringValid(CountryTextBox.Text))
            {
                FindErrorProvider.SetError(CountryTextBox, "String must be russian and not contains special simbols");
                CountryTextBox.Focus();
                isValid = false;
            }
            if (!_validator.IsStringValid(ProducerTextBox.Text))
            {
                ProducerTextBox.Focus();
                FindErrorProvider.SetError(ProducerTextBox, "String must be russian and not contains special simbols");
                isValid = false;
            }
            if (!_validator.IsStringValid(MainActorsTextBox.Text))
            {
                FindErrorProvider.SetError(MainActorsTextBox, "String must be russian and not contains special simbols");
                MainActorsTextBox.Focus();
                isValid = false;
            }
            else
            {
                FindErrorProvider.SetError(FilmNameTextBox, String.Empty);
            }
            return(isValid);
        }