--Se volvió a poner todo lo que eliminé. Se hizo el select para los destinos específicos por ruta, se agregaron boletos

This commit is contained in:
AbrahamCastilloV
2023-12-21 17:44:32 -07:00
parent f02ad6a2a3
commit 567a2c9263
7 changed files with 180 additions and 152 deletions

View File

@@ -2,12 +2,12 @@
Partial Class Boletos
Inherits ClsPaginas
Private Property asientoSeleccionado As String
Private Property AsientoSeleccionado As String
Get
Return ViewState("asientoSeleccionado").ToString()
Return ViewState("AsientoSeleccionado").ToString()
End Get
Set(value As String)
ViewState("asientoSeleccionado") = value
ViewState("AsientoSeleccionado") = value
End Set
End Property
Private Property Importe As Decimal
@@ -21,12 +21,20 @@ Partial Class Boletos
Private Property CveViaje As Integer
Get
Return ViewState("CveViaje").ToString().toentero
Return ViewState("CveViaje").ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveViaje") = value
End Set
End Property
Private Property CveRuta As Integer
Get
Return ViewState("CveRuta").ToString().ToEntero
End Get
Set(value As Integer)
ViewState("CveRuta") = value
End Set
End Property
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -34,11 +42,13 @@ Partial Class Boletos
If Request.QueryString("CveViaje") Is Nothing Then
Response.Redirect("/Transportes/ListadoViajes.aspx")
End If
AsientoSeleccionado = ""
CveRuta = 0
CveViaje = Request.QueryString("CveViaje").ToEntero
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
InicializaCombos()
CargaDatos()
InicializaCombos()
End If
End Sub
@@ -47,8 +57,9 @@ Partial Class Boletos
'Datos Viaje
Dim ObjViaje As New ClsTransportes
Dim retorno As Boolean = ObjViaje.GetViajes(CveViaje.ToEntero, UsuarioActual.CveEmpresa)
ViewState("CveRuta") = ObjViaje.CveRuta
If retorno Then
'TxtRuta.Text = ObjViaje.Ruta.ToString
TxtRuta.Text = ObjViaje.Ruta
TxtFecha.Text = ObjViaje.Fecha.ToString
End If
@@ -57,7 +68,7 @@ Partial Class Boletos
Protected Sub InicializaCombos()
'Lista Destinos''carga específicos
Dim ObjDestinos As New ClsDestinos()
If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then
If ObjDestinos.GetDestinos(CveRuta:=CveRuta) Then
If ObjDestinos.DtResultados.Rows.Count > 0 Then
@@ -76,18 +87,20 @@ Partial Class Boletos
If DdlDestino.SelectedValue <> "" And DdlPartida.SelectedValue <> "" Then
Dim ObjDestinos As New ClsTransportes()
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}"
Dim retorno As Boolean = ObjDestinos.GetDestinosTarifas(DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero)
Dim ImporteR As Decimal = ObjDestinos.DtResultados.FiltroPrimeroValor("Importe").ToDecimal
If retorno Then
If ImporteR > 0 Then
Dim redondeado As String = CStr(Math.Round(ImporteR, 2))
ViewState("Importe") = redondeado
TxtCosto.Text = $"El precio de su boleto es ${Importe}"
BtnGuardar.Visible = True
upPanel.Visible = True
Importe = tImporte
Else
TxtCosto.Text = ""
BtnGuardar.Visible = False
upPanel.Visible = False
Importe = 0
ViewState("Importe") = 0
End If
End If
End If
@@ -97,25 +110,21 @@ Partial Class Boletos
Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
Dim buttonID As String = linkButton.ID
linkButton.CssClass += " activo"
asientoSeleccionado = buttonID
ViewState("AsientoSeleccionado") = buttonID
End Sub
Protected Sub AddBoleto(sender As Object, e As EventArgs)
If asientoSeleccionado = "" Then
Alert("Se requiere seleccionar su asiento")
If AsientoSeleccionado = "" Then
Alert("Se requiere seleccionar su asiento", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
'Page.Response.Write("<script>console.log('El resultado de tu variable" + CveViaje.GetType.ToString + "')</script>")
'Page.Response.Write("<script>console.log('El resultado de tu variable" + CveViaje.ToEntero.ToString + "')</script>")
Dim ObjTransporte As New ClsTransportes()
ObjTransporte.IniciaTransacSQL()
Try
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)
AsientoSeleccionado = AsientoSeleccionado.Replace("A", "")
Dim retorno As Integer = ObjTransporte.AddViajePasajero(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, AsientoSeleccionado.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario)
If retorno > 1 Then
ObjTransporte.Commit()