-
Notifications
You must be signed in to change notification settings - Fork 0
/
Inicio.aspx.vb
41 lines (30 loc) · 1.26 KB
/
Inicio.aspx.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
Public Class Inicio
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargarLibros()
End If
End Sub
Protected Sub btnIrAAgregarLibro_Click(sender As Object, e As EventArgs) Handles btnIrAAgregarLibro.Click
Response.Redirect("~/Pages/Libros/AgregarLibro.aspx")
End Sub
Private Sub CargarLibros()
Dim conexioBD As New ConexionBD()
Dim libroDao As New LibroDAO(conexioBD)
Dim listaLibros As List(Of Libro) = libroDao.ObtenerTodosLosLibros()
GridViewLibros.DataSource = listaLibros
GridViewLibros.DataBind()
End Sub
Protected Sub lnkEliminar_Click(sender As Object, e As EventArgs)
Dim lnkButton As LinkButton = CType(sender, LinkButton)
Dim libroId As Integer = Convert.ToInt32(lnkButton.CommandArgument)
Dim conexionBD As New ConexionBD()
Dim libroDao As New LibroDAO(conexionBD)
libroDao.EliminarLibro(libroId)
CargarLibros()
End Sub
Protected Sub GridViewLibros_PageIndexChanging(sender As Object, e As GridViewPageEventArgs)
GridViewLibros.PageIndex = e.NewPageIndex
CargarLibros()
End Sub
End Class