Se creo el CRUD para ClsViajes con sus modelos y Procedimientos Almacenados

This commit is contained in:
AbrahamCastilloV
2023-12-11 08:53:56 -07:00
parent b8896b961a
commit 47caaa3997
8 changed files with 305 additions and 23 deletions

View 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