예제 #1
0
        void PopulateGridView()
        {
            List <Alumno> alumnos = AlumnoLN.getInstance().ListarAlumnos();

            listAlumnos.DataSource = alumnos;
            listAlumnos.DataBind();

            /*DataTable dtbl = new DataTable();
             * using (SqlConnection sqlCon= new SqlConnection(connectionString))
             * {
             *  sqlCon.Open();
             *  SqlDataAdapter sqlDa = new SqlDataAdapter("Select * from Alumno", sqlCon);
             *  sqlDa.Fill(dtbl);
             * }
             * if(dtbl.Rows.Count > 0)
             * {
             *  listAlumnos.DataSource = dtbl;
             *  listAlumnos.DataBind();
             * }
             * else
             * {
             *  dtbl.Rows.Add(dtbl.NewRow());
             *  listAlumnos.DataSource = dtbl;
             *  listAlumnos.DataBind();
             *  listAlumnos.Rows[0].Cells.Clear();
             *  listAlumnos.Rows[0].Cells.Add(new TableCell());
             *  listAlumnos.Rows[0].Cells[0].ColumnSpan = dtbl.Columns.Count;
             *  listAlumnos.Rows[0].Cells[0].Text = "No data";
             *  listAlumnos.Rows[0].Cells[0].HorizontalAlign = HorizontalAlign.Center;
             * }*/
        }
예제 #2
0
        protected void btnRegistrar_Click(object sender, EventArgs e)
        {
            //Registro del alumno
            Alumno objAlumno = GetEntity();
            //Enviar a la capa Logica de Negocio
            bool response = AlumnoLN.getInstance().RegistrarAlumno(objAlumno);

            if (response == true)
            {
                Response.Write("<script>alert('REGISTRO CORRECTO.')</script>");
            }
            else
            {
                Response.Write("< script > alert('REGISTRO INCORRECTO.') </ script > ");
            }
        }