Se creo el CRUD para ClsViajes con sus modelos y Procedimientos Almacenados
This commit is contained in:
56
Transportes/ListadoViajes.aspx.vb
Normal file
56
Transportes/ListadoViajes.aspx.vb
Normal file
@@ -0,0 +1,56 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
|
||||
Partial Class ListadoViajes
|
||||
Inherits ClsPaginas
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaDatos()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjViajes As New ClsViajes
|
||||
|
||||
|
||||
If ObjViajes.GetViajes() Then
|
||||
GvViajes.DataSource = ObjViajes.DtResultados
|
||||
Else
|
||||
Me.GvViajes.DataSource = Nothing
|
||||
End If
|
||||
|
||||
ObjViajes.Dispose()
|
||||
GvViajes.DataBind()
|
||||
Page.Response.Write("<script>console.log('El resultado de tu variable" + GvViajes.ToString + "')</script>")
|
||||
End Sub
|
||||
|
||||
Protected Sub GvViajes_Comandos(sender As Object, e As GridViewCommandEventArgs)
|
||||
Dim id As Integer = Convert.ToInt32(e.CommandArgument)
|
||||
Dim url As String = $"CrearViaje.aspx?CveViaje={id}"
|
||||
|
||||
If e.CommandName = "Editar" Then
|
||||
Dim script As String = $"window.open('{url}', '_blank');"
|
||||
Page.ClientScript.RegisterStartupScript(Me.GetType(), "OpenWindow", script, True)
|
||||
End If
|
||||
|
||||
If e.CommandName = "Eliminar" Then
|
||||
Dim ObjViajes As New ClsViajes
|
||||
ObjViajes.IniciaTransacSQL()
|
||||
|
||||
Try
|
||||
ObjViajes.RemoveViaje(id)
|
||||
ObjViajes.Commit()
|
||||
Catch ex As Exception
|
||||
ObjViajes.RollBack()
|
||||
Finally
|
||||
ObjViajes.Dispose()
|
||||
Response.Redirect("ListadoViajes.aspx")
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user