コード例 #1
0
 private void Limpiar()
 {
     ProfesorIdNumericUpDown.Value = 0;
     NombreTextBox.Text            = string.Empty;
     TelefonoMaskedTextBox.Text    = string.Empty;
     CelularMaskedTextBox.Text     = string.Empty;
     CedulaMaskedTextBox.Text      = string.Empty;
     GeneroComboBox.ResetText();
     EmailTextBox.Text      = string.Empty;
     DireccionTextBox.Text  = string.Empty;
     ImagenPictureBox.Image = ImagenOriginal;
 }
コード例 #2
0
 private void Limpiar()
 {
     MyErrorProvider.Clear();
     UsuarioIdNumericUpDown.Value = 0;
     NombreTextBox.Text           = string.Empty;
     CelularMaskedTextBox.Text    = string.Empty;
     CedulaMaskedTextBox.Text     = string.Empty;
     GeneroComboBox.ResetText();
     TipoComboBox.ResetText();
     EmailTextBox.Text            = string.Empty;
     UsuarioTextBox.Text          = string.Empty;
     ContraseñaTextBox.Text       = string.Empty;
     UsuarioConectadoTextBox.Text = string.Empty;
 }
コード例 #3
0
        private bool Validar()
        {
            MyErrorProvider.Clear();

            bool paso = true;

            if (string.IsNullOrWhiteSpace(NombreTextBox.Text))
            {
                MyErrorProvider.SetError(NombreTextBox, "El campo nombre no puede estar vacío");
                NombreTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(TelefonoMaskedTextBox.Text.Replace("-", string.Empty)) || string.IsNullOrWhiteSpace(CelularMaskedTextBox.Text.Replace("-", string.Empty)))
            {
                MyErrorProvider.SetError(TelefonoMaskedTextBox, "Debe de suministrar un numero de telefono o celular");
                MyErrorProvider.SetError(CelularMaskedTextBox, "Debe de suministrar un numero de telefono o celular");
                TelefonoMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CedulaMaskedTextBox.Text.Replace("-", string.Empty)))
            {
                MyErrorProvider.SetError(CedulaMaskedTextBox, "El campo cedula no puede estar vacío");
                CedulaMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(GeneroComboBox.Text))
            {
                MyErrorProvider.SetError(GeneroComboBox, "Debe de seleccionar su genero");
                GeneroComboBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(EmailTextBox.Text))
            {
                MyErrorProvider.SetError(EmailTextBox, "El campo email no puede estar vacío");
                EmailTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(DireccionTextBox.Text))
            {
                MyErrorProvider.SetError(DireccionTextBox, "El campo direccion no puede estar vacío");
                DireccionTextBox.Focus();
                paso = false;
            }

            if (ImagenPictureBox.Image == ImagenOriginal)
            {
                MyErrorProvider.SetError(InsertarImagenButton, "Debe de suministrar una imagen de usuario");
                InsertarImagenButton.Focus();
                paso = false;
            }

            if (!EmailTextBox.Text.Contains("@"))
            {
                MyErrorProvider.SetError(EmailTextBox, "El email debe de tener arroba '@'. ");
                EmailTextBox.Focus();
                paso = false;
            }

            return(paso);
        }
コード例 #4
0
        private bool Validar()
        {
            MyErrorProvider.Clear();
            bool paso = true;

            if (string.IsNullOrWhiteSpace(NombreTextBox.Text))
            {
                MyErrorProvider.SetError(NombreTextBox, "El campo nombre no puede estar vacio");
                NombreTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CelularMaskedTextBox.Text))
            {
                MyErrorProvider.SetError(CelularMaskedTextBox, "El campo celular no puede estar vacio");
                CelularMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(CedulaMaskedTextBox.Text))
            {
                MyErrorProvider.SetError(CedulaMaskedTextBox, "El campo celular no puede estar vacio");
                CedulaMaskedTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(GeneroComboBox.Text))
            {
                MyErrorProvider.SetError(GeneroComboBox, "Debe seleccionar un genero");
                GeneroComboBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(TipoComboBox.Text))
            {
                MyErrorProvider.SetError(TipoComboBox, "Debe seleccionar un Ttipo de usuario");
                TipoComboBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(EmailTextBox.Text))
            {
                MyErrorProvider.SetError(EmailTextBox, "El campo email no puede estar vacio");
                EmailTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(UsuarioTextBox.Text))
            {
                MyErrorProvider.SetError(UsuarioTextBox, "El campo usuario no puede estar vacio");
                UsuarioTextBox.Focus();
                paso = false;
            }

            if (string.IsNullOrWhiteSpace(ContraseñaTextBox.Text))
            {
                MyErrorProvider.SetError(ContraseñaTextBox, "El campo contraseña no puede estar vacio");
                ContraseñaTextBox.Focus();
                paso = false;
            }

            if (!EmailTextBox.Text.EndsWith("@gmail.com") && !EmailTextBox.Text.EndsWith("@outlook.com"))
            {
                MyErrorProvider.SetError(EmailTextBox, "El email debe de ser de @gmail.com o @outlook.com \npara poder realizar futuras recuperaciones");
                EmailTextBox.Focus();
                paso = false;
            }

            if (ContraseñaTextBox.Text.Length < 4)
            {
                MyErrorProvider.SetError(ContraseñaTextBox, "La contraseña debe de tener 4 o mas caracteres");
                ContraseñaTextBox.Focus();
                paso = false;
            }

            return(paso);
        }