Пример #1
0
 private void TxtCorreo_Leave(object sender, EventArgs e)
 {
     if (TxtCorreo.Text == "")
     {
     }
     else
     {
         //Capturar el email
         if (ValidarEmail(TxtCorreo.Text))
         {
         }
         else
         {
             String message = "Dirección de correo no válida";
             String caption = "Validación de email";
             var    result  = MessageBox.Show(message, caption, MessageBoxButtons.OK, MessageBoxIcon.Information);
             TxtCorreo.SelectAll();
             TxtCorreo.Focus();
         }
     }
 }
Пример #2
0
        private bool ValidarCampos()
        {
            if (Editar)
            {
                if (IdSucursal == 0)
                {
                    Soporte.MsgError("Seleccione un registro al que desea Actualizar.");
                    TxtNombre.Focus();
                    return(false);
                }
            }


            if (string.IsNullOrEmpty(TxtNombre.Text) || TxtNombre.Text == "0")
            {
                Soporte.MsgError("Ingrese Nombre de la Sucursal");
                TxtNombre.Focus();
                return(false);
            }
            if (string.IsNullOrEmpty(TxtTelefono.Text) || TxtTelefono.Text == "0")
            {
                Telefono = "Registro Pendiente";
            }

            if (string.IsNullOrEmpty(TxtCorreo.Text) || TxtCorreo.Text == "0")
            {
                Correo = "*****@*****.**";
            }
            else
            {
                if (Soporte.ValidarMail(TxtCorreo.Text) == false)
                {
                    Soporte.MsgError("El correo no cuenta con el Formato correcto");
                    TxtCorreo.Focus();
                    TxtCorreo.SelectAll();
                    return(false);
                }
            }

            if (CmbEmpresa.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione una empresa al que pertenecera la Sucursal");
                CmbEmpresa.Focus();
                CmbEmpresa.SelectAll();
                return(false);
            }
            if (CmbxPais.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione un Pais");
                CmbxPais.Focus();
                CmbxPais.SelectAll();
                return(false);
            }
            if (CmbxEstado.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione un Estado");
                CmbxEstado.Focus();
                CmbxEstado.SelectAll();
                return(false);
            }
            if (CmbxMunicipio.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione un Municipio");
                CmbxMunicipio.Focus();
                CmbxMunicipio.SelectAll();
                return(false);
            }

            if (CmbColonias.SelectedIndex == 0)
            {
                Soporte.MsgError("Seleccione una Colonia");
                CmbColonias.Focus();
                CmbColonias.SelectAll();
                return(false);
            }
            if (TxtCodigoPostal.TextLength < 4)
            {
                Soporte.MsgError("Ingrse un Codigo Postal Valido.");
                TxtCodigoPostal.Focus();
                return(false);
            }
            if (TxtCalle.TextLength < 5)
            {
                Soporte.MsgError("Ingrse una calle valido");
                TxtCalle.Focus();

                return(false);
            }
            if (string.IsNullOrEmpty(TxtEntreCalles.Text) || TxtEntreCalles.Text == "0")
            {
                Entre_Calles = "Sin Registro";
            }
            if (string.IsNullOrEmpty(TxtNumExterno.Text) || TxtNumExterno.Text == "0")
            {
                Numero_Externo = "SIN NUMERO";
            }

            if (string.IsNullOrEmpty(TxtNumInterno.Text) || TxtNumInterno.Text == "0")
            {
                Numero_Interno = "SIN NUMERO";
            }

            return(true);
        }