示例#1
0
        private void BtnSalvar_Click(object sender, RoutedEventArgs e)
        {
            email  = txtEmail.Text;
            numero = txtNumero.Text;

            ValidatesCustom validatesCustom = new ValidatesCustom();

            Regex regexTelefone = new Regex(@"^([+][0-9]{2})\([1-9]{2}\) (?:[2-8]|9[1-9])[0-9]{3}\-[0-9]{4}$");

            Match match1 = regexTelefone.Match(numero);


            if (match1.Success)
            {
                MessageBox.Show(numero + " Numero correto");
            }
            else
            {
                MessageBox.Show(numero + " Formato de numero inválido, \r tente o formato +DDI(DDD) XXXXX-XXXX");
            }


            if (match.Success)
            {
                MessageBox.Show(email + " email correto");
            }
            else
            {
                MessageBox.Show(email + " Formato de email inválido");
            }
        }
示例#2
0
        private void BtnSalvar_Click(object sender, RoutedEventArgs e)
        {
            string email    = tbxEmail.Text;
            string telefone = tbxTelefone.Text;

            if (ValidatesCustom.ValidPhone(telefone))
            {
                MessageBox.Show($"{tbxNome.Text.ToUpper()}! O telefone {telefone} é VÁLIDO.", "Informação", MessageBoxButton.OK, MessageBoxImage.Information);
                resTelefone.Text = "True";
            }

            else
            {
                MessageBox.Show($"ATENÇÃO {tbxNome.Text.ToUpper()}, o telefone {tbxTelefone.Text} é INVÁLIDO.", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                resTelefone.Text = "False";
            }

            if (ValidatesCustom.ValidEmail(email))
            {
                MessageBox.Show($"{tbxNome.Text.ToUpper()}! O email {email} é VÁLIDO.", "Informação", MessageBoxButton.OK, MessageBoxImage.Information);
                resEmail.Text = "True";
            }

            else
            {
                MessageBox.Show($"ATENÇÃO {tbxNome.Text.ToUpper()}, o email {tbxEmail.Text} é INVÁLIDO.", "Erro", MessageBoxButton.OK, MessageBoxImage.Error);
                resEmail.Text = "False";
            }
        }
示例#3
0
        private void BtSalvar_Click(object sender, RoutedEventArgs e)
        {
            var email  = tbxEmail.Text;
            var numero = tbxEmail.Text;


            if (ValidatesCustom.ValidEmail(email))
            {
                MessageBox.Show("E-mail correto!");
            }
            else
            {
                MessageBox.Show("E-mail incorreto!");
            }

            if (ValidatesCustom.ValidNumero(numero))
            {
                MessageBox.Show("Número correto!");
            }
            else
            {
                MessageBox.Show("Número incorreto!");
            }
        }