This commit is contained in:
AbrahamCastilloV
2023-12-21 09:02:54 -07:00
2 changed files with 80 additions and 19 deletions

View File

@@ -166,13 +166,14 @@ Public Class ClsTransportes
Return Retorno Return Retorno
End Function End Function
Public Function GetViajes(Optional CveViaje As Integer = 0) As Boolean Public Function GetViajes(CveViaje As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Trans_ViajesGet") DataAdapter("PA_Trans_ViajesGet")
If CveViaje > 0 Then If CveViaje > 0 Then
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@CveViajeSeleccionado", SqlDbType.Int).Value = CveViaje .Add("@CveViajeSeleccionado", SqlDbType.Int).Value = CveViaje
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With End With
End If End If
Try Try
@@ -195,6 +196,65 @@ Public Class ClsTransportes
Return Retorno Return Retorno
End Function End Function
Public Function GetDestinosTarifas(CveDestinoOrigen As Integer, CveDestinoFinal As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Trans_ViajesGet")
If CveViaje > 0 Then
With SqlAdapter.SelectCommand.Parameters
.Add("@CveDestinoOrigen", SqlDbType.Int).Value = CveDestinoOrigen
.Add("@CveDestinoFinal", SqlDbType.Int).Value = CveDestinoFinal
End With
End If
Try
SqlAdapter.Fill(Data)
If CveViaje > 0 AndAlso Data IsNot Nothing AndAlso Data.Rows.Count > 0 Then
CveRuta = Data.Rows(0)("CveRuta").ToString.ToEntero
CveAF = Data.Rows(0)("CveAF").ToString.ToEntero
CvePersonal = Data.Rows(0)("CvePersonal").ToString.ToEntero
CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero
CvePartida = Data.Rows(0)("CvePartida").ToString.ToEntero
CveDestino = Data.Rows(0)("CveDestino").ToString.ToEntero
CveMasivo = Data.Rows(0)("CveMasivo").ToString.ToEntero
Fecha = Data.Rows(0)("Fecha").ToString.ToDate
End If
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el catálogo de viajes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function AddViajePasajero(CveRuta As Integer, CveAF As Integer, CvePersonal As Integer, CveEmpresa As Integer, Fecha As DateTime, CvePartida As Integer, CveDestino As Integer, Optional IsMasivo As Boolean = False, Optional CveMasivo As Integer = -1) As Integer
Dim Retorno As Integer = -1
DataAdapter("PA_Trans_ViajesAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveViaje", SqlDbType.Int).Direction = ParameterDirection.Output
.Add("@CveRuta", SqlDbType.Int).Value = CveRuta
.Add("@CveAF", SqlDbType.Int).Value = CveAF
.Add("@CvePersonal", SqlDbType.Int).Value = CvePersonal
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@Fecha", SqlDbType.DateTime).Value = Fecha
.Add("@CvePartida", SqlDbType.Int).Value = CvePartida
.Add("@CveDestino", SqlDbType.Int).Value = CveDestino
.Add("@IsMasivo", SqlDbType.Bit).Value = IsMasivo
.Add("@CveMasivo", SqlDbType.Int).Value = CveMasivo
End With
Try
SqlAdapter.Fill(Data)
Retorno = CInt(SqlAdapter.SelectCommand.Parameters("@CveViaje").Value.ToString)
Catch ex As Exception
OnError("Ocurrió un error al guardar el nuevo viaje.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function RemoveViaje(Optional CveViaje As Integer = -1, Optional CveMasivo As Integer = -1) As Boolean Public Function RemoveViaje(Optional CveViaje As Integer = -1, Optional CveMasivo As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False

View File

@@ -1,5 +1,4 @@
 Imports Extensiones
Imports Extensiones
Partial Class Boletos Partial Class Boletos
Inherits ClsPaginas Inherits ClsPaginas
@@ -20,11 +19,11 @@ Partial Class Boletos
End Set End Set
End Property End Property
Private Property CveViaje As Decimal Private Property CveViaje As Integer
Get Get
Return ViewState("CveViaje").ToString().ToDecimal Return ViewState("CveViaje").ToString().toentero
End Get End Get
Set(value As Decimal) Set(value As Integer)
ViewState("CveViaje") = value ViewState("CveViaje") = value
End Set End Set
End Property End Property
@@ -38,8 +37,8 @@ Partial Class Boletos
CveViaje = Request.QueryString("CveViaje").ToEntero CveViaje = Request.QueryString("CveViaje").ToEntero
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
CargaDatos()
InicializaCombos() InicializaCombos()
CargaDatos()
End If End If
End Sub End Sub
@@ -47,11 +46,15 @@ Partial Class Boletos
Private Sub CargaDatos() Private Sub CargaDatos()
'Datos Viaje 'Datos Viaje
Dim ObjViaje As New ClsTransportes Dim ObjViaje As New ClsTransportes
Dim retorno = ObjViaje.GetViajes(CveViaje.ToEntero, UsuarioActual.CveEmpresa) Dim retorno As Boolean = ObjViaje.GetViajes(CveViaje.ToEntero, UsuarioActual.CveEmpresa)
If retorno Then If retorno Then
TxtRuta.Text = ObjViaje.Ruta.ToString 'TxtRuta.Text = ObjViaje.Ruta.ToString
TxtFecha.Text = ObjViaje.Fecha.ToString TxtFecha.Text = ObjViaje.Fecha.ToString
End If End If
End Sub
Protected Sub InicializaCombos()
'Lista Destinos''carga específicos 'Lista Destinos''carga específicos
Dim ObjDestinos As New ClsDestinos() Dim ObjDestinos As New ClsDestinos()
If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then
@@ -69,21 +72,17 @@ Partial Class Boletos
End If End If
End Sub End Sub
Protected Sub InicializaCombos()
End Sub
Protected Sub CotizarTarifa(sender As Object, e As EventArgs) Protected Sub CotizarTarifa(sender As Object, e As EventArgs)
If DdlDestino.SelectedValue <> "" And DdlPartida.SelectedValue <> "" Then If DdlDestino.SelectedValue <> "" And DdlPartida.SelectedValue <> "" Then
Dim ObjDestinos As New ClsTransportes() Dim ObjDestinos As New ClsTransportes()
If ObjDestinos.GetDestinosTarifas(DdlDestino.SelectedValue.ToEntero, DdlPartida.SelectedValue.ToEntero) Then If ObjDestinos.GetDestinosTarifas(DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero) Then
Dim tImporte As Decimal = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal
If ObjDestinos.Importe > 0 Then If tImporte > 0 Then
TxtCosto.Text = $"El precio de su boleto es ${ObjDestinos.Importe}" TxtCosto.Text = $"El precio de su boleto es ${tImporte}"
BtnGuardar.Visible = True BtnGuardar.Visible = True
upPanel.Visible = True upPanel.Visible = True
Importe = ObjDestinos.Importe.ToEntero Importe = tImporte
Else Else
TxtCosto.Text = "" TxtCosto.Text = ""
BtnGuardar.Visible = False BtnGuardar.Visible = False
@@ -114,7 +113,9 @@ Partial Class Boletos
ObjTransporte.IniciaTransacSQL() ObjTransporte.IniciaTransacSQL()
Try Try
Dim retorno As Integer = ObjTransporte.AddViajePasajero(CveViaje.ToEntero, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero, 0.0, asientoSeleccionado, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario) asientoSeleccionado = asientoSeleccionado.Replace("A", "")
Dim retorno As Integer = ObjTransporte.AddViajePasajero(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, 0.0, asientoSeleccionado.ToEntero,
TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario)
If retorno > 1 Then If retorno > 1 Then
ObjTransporte.Commit() ObjTransporte.Commit()