Exemplo n.º 1
0
        //Ingresar alumno
        protected void OnButton21Clicked(object sender, EventArgs e)
        {
            if (RutAlumno.Text != "" &&
                NombreAlumno.Text != "" &&
                ApellidoAlumno.Text != "" &&
                CarreraAlumno.Text != "" &&
                DescripcionAlumno.Text != "")
            {
                int           rut         = Convert.ToInt32(RutAlumno.Text);
                string        nombre      = NombreAlumno.Text;
                string        apellido    = ApellidoAlumno.Text;
                string        carrera     = CarreraAlumno.Text;
                string        descripcion = DescripcionAlumno.Text;
                int           ano         = Convert.ToInt32(AnoAlumno.Text);
                int           edad        = Convert.ToInt32(EdadAlumno.Text);
                List <string> comentario  = new List <string>();
                List <int>    ranking     = new List <int>();
                ranking.Add(5);

                Usuario usuario = new Alumno(rut, nombre, apellido, edad, 5, ranking, comentario, descripcion, carrera, ano, OLI);
                if (usuario.IngresarUsuario(OLI))
                {
                    usuario.IngresarUsuario(OLI);
                    System.Windows.Forms.MessageBox.Show("Usuario Ingresado correctamente, su Nº de credencial " + usuario.Rut);
                    ST.WriteLine("El usuario Nº " + rut + " fue registrado");


                    FourthWindow w4 = new FourthWindow(this.OLI, CodOf, CodPost, ST);
                    this.Destroy();
                    w4.Show();
                }

                else
                {
                    System.Windows.Forms.MessageBox.Show("Este usuario ya se encuentra ingresado");
                    this.Destroy();
                    SecondWindow w2 = new SecondWindow(this.OLI, CodOf, CodPost, ST);
                    w2.Show();
                }
            }

            else
            {
                System.Windows.Forms.MessageBox.Show("No ha ingresado todo los datos");
            }
        }