Exemplo n.º 1
0
        private bool esValido()
        {
            Negocio.Alumnos oAlumnos = new Negocio.Alumnos();
            string errores = "";

            if (tipoOperacion != General.TipoOperacion.Alta)
            {
                if ((txtLegajo.Text == "") || (!oAlumnos.ExisteLegajo(Convert.ToInt32(txtLegajo.Text) - 30000)))
                {
                    errores += "-Nº de legajo incorrecto.\n";
                }
            }

            if (!((Utilidades.Validaciones.validarNumero(txtNroDoc.Text)) &&
                (txtNroDoc.Text.Length <=8))) {
                errores += "-El Nº de documento no es válido.\n";
            }

            if (txtDireccion.Text == "") {
                errores += "-La dirección no es válida.\n";
            }

            if (txtApellido.Text == "") {
                errores += "-El apellido no es válido.\n";
            }

            if (txtNombre.Text == "") {
                errores += "-El nombre no es válido.\n";
            }

            if (!Utilidades.Validaciones.validarEmail(txtEmail.Text))
            {
                errores += "-El email no es válido.\n";
            }

            if (!fechaNacValida)
            {
                errores += "-La fecha de nacimiento no es válida.\n";
            }

            if (txtTelefono.Text == "") {
                errores += "-El teléfono no es válido.\n";
            }

            if (txtCelular.Text == "") {
                errores += "-El celular no es válido.\n";
            }

            if (!((Utilidades.Validaciones.validarNumero(txtAnioInicio.Text)) &&
                (txtAnioInicio.Text.Length == 4)))
            {
                errores += "-El año de inicio no es válido.\n";
            }

            if ((txtUsuario.Text.Length < 5) || (txtUsuario.Text.Length > 30))
            {
                errores += "-El nombre de usuario debe tener entre 5 y 30 caracteres.\n";
            }

            //Verificar si se cambio el nombre de usuario
            else if ((oAlumnos.ExisteNombreUsuario(txtUsuario.Text)) &&
                      (this.nombreUsuario != this.txtUsuario.Text))
            {
                errores += "-El nombre de usuario ya existe.\n";
            }

            if (this.tipoOperacion == General.TipoOperacion.Alta)
            {
                if (txtContrasenia.Text == txtRepetirContrasenia.Text)
                {
                    if (txtContrasenia.Text.Length < 5)
                    {
                        errores += "-La contraseña debe tener por lo menos 5 caracteres.\n";
                    }
                }
                else
                {
                    errores += "-Las contraseñas no coinciden.\n";
                }
            }
            else
            {
                if (!((txtContrasenia.Text == "") && (txtRepetirContrasenia.Text == "")))
                {
                    if (txtContrasenia.Text == txtRepetirContrasenia.Text)
                    {
                        if (txtContrasenia.Text.Length < 5)
                        {
                            errores += "-La contraseña debe tener por lo menos 5 caracteres.\n";
                        }
                    }
                    else
                    {
                        errores += "-Las contraseñas no coinciden.\n";
                    }
                }
            }

            if (errores == "")
            {
                return true;
            }
            else
            {
                MessageBox.Show(errores, "Error");
                return false;
            }
        }
Exemplo n.º 2
0
        private void buscarAlumno()
        {
            Negocio.Alumnos oAlumnos = new Negocio.Alumnos();

            if ((txtLegajo.Text != "") && (oAlumnos.ExisteLegajo(Convert.ToInt32(txtLegajo.Text) - 30000)))
            {
                try
                {
                    Entidades.Alumno oAlumno = oAlumnos.RecuperarUno(int.Parse(txtLegajo.Text) - 30000)[0];
                    cbxTipoDoc.SelectedItem = oAlumno.TipoDoc;
                    txtNroDoc.Text = oAlumno.NroDoc.ToString();
                    txtApellido.Text = oAlumno.Apellido;
                    txtDireccion.Text = oAlumno.Direccion;
                    txtNombre.Text = oAlumno.Nombre;
                    txtEmail.Text = oAlumno.Email;
                    txtNacimiento.Text = oAlumno.FechaNacimiento.ToShortDateString();
                    txtTelefono.Text = oAlumno.TelefonoFijo;
                    txtCelular.Text = oAlumno.TelefonoCelular;
                    txtAnioInicio.Text = oAlumno.AnioInicio.ToString();
                    cbxPlan.SelectedValue = oAlumno.plan.IdPlan;
                    cbxEstado.SelectedItem = (Entidades.Alumno.EstadoAlumno)oAlumno.Estado;
                    txtUsuario.Text = oAlumno.usuario.NombreUsuario;
                    this.nombreUsuario = oAlumno.usuario.NombreUsuario;
                    this.fechaNacValida = true;
                    this.legajo_buscado = txtLegajo.Text;
                }

                finally
                {
                    oAlumnos = null;
                }

            }
            else
            {
                MessageBox.Show("Legajo incorrecto", "Error");
            }
        }