-- cambios en revisión

This commit is contained in:
2023-12-21 09:01:18 -07:00
parent 3f184fe79d
commit 69ddbc3e23
2 changed files with 80 additions and 19 deletions

View File

@@ -165,13 +165,14 @@ Public Class ClsTransportes
Return Retorno
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
DataAdapter("PA_Trans_ViajesGet")
If CveViaje > 0 Then
With SqlAdapter.SelectCommand.Parameters
.Add("@CveViajeSeleccionado", SqlDbType.Int).Value = CveViaje
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
End If
Try
@@ -194,6 +195,65 @@ Public Class ClsTransportes
Return Retorno
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
Dim Retorno As Boolean = False

View File

@@ -1,5 +1,4 @@

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