boletos
This commit is contained in:
130
Transportes/Boletos.aspx.vb
Normal file
130
Transportes/Boletos.aspx.vb
Normal file
@@ -0,0 +1,130 @@
|
||||
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Boletos
|
||||
Inherits ClsPaginas
|
||||
Private Property asientoSeleccionado As String
|
||||
Get
|
||||
Return ViewState("asientoSeleccionado").ToString()
|
||||
End Get
|
||||
Set(value As String)
|
||||
ViewState("asientoSeleccionado") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Importe As Decimal
|
||||
Get
|
||||
Return ViewState("Importe").ToString().ToDecimal
|
||||
End Get
|
||||
Set(value As Decimal)
|
||||
ViewState("Importe") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CveViaje As Decimal
|
||||
Get
|
||||
Return ViewState("CveViaje").ToString().ToDecimal
|
||||
End Get
|
||||
Set(value As Decimal)
|
||||
ViewState("CveViaje") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
If Request.QueryString("CveViaje") Is Nothing Then
|
||||
Response.Redirect("/Transportes/ListadoViajes.aspx")
|
||||
End If
|
||||
CveViaje = Request.QueryString("CveViaje").ToEntero
|
||||
|
||||
DirectCast(Master.FindControl("TSM"), ScriptManager).EnablePageMethods = True
|
||||
CargaDatos()
|
||||
InicializaCombos()
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
'Datos Viaje
|
||||
Dim ObjViaje As New ClsTransportes
|
||||
Dim retorno = ObjViaje.GetViajes(CveViaje.ToEntero, UsuarioActual.CveEmpresa)
|
||||
If retorno Then
|
||||
TxtRuta.Text = ObjViaje.Ruta.ToString
|
||||
TxtFecha.Text = ObjViaje.Fecha.ToString
|
||||
End If
|
||||
'Lista Destinos''carga específicos
|
||||
Dim ObjDestinos As New ClsDestinos()
|
||||
If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then
|
||||
|
||||
If ObjDestinos.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
DdlPartida.DataSource = ObjDestinos.DtResultados
|
||||
DdlPartida.DataBind()
|
||||
DdlPartida.Items.Insert(0, New ListItem("Seleccione Partida", ""))
|
||||
|
||||
DdlDestino.DataSource = ObjDestinos.DtResultados
|
||||
DdlDestino.DataBind()
|
||||
DdlDestino.Items.Insert(0, New ListItem("Seleccione Destino", ""))
|
||||
End If
|
||||
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}"
|
||||
BtnGuardar.Visible = True
|
||||
upPanel.Visible = True
|
||||
Importe = ObjDestinos.Importe.ToEntero
|
||||
Else
|
||||
TxtCosto.Text = ""
|
||||
BtnGuardar.Visible = False
|
||||
upPanel.Visible = False
|
||||
Importe = 0
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Sub OnLinkButtonClick(sender As Object, e As EventArgs)
|
||||
Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
|
||||
Dim buttonID As String = linkButton.ID
|
||||
linkButton.CssClass += " activo"
|
||||
asientoSeleccionado = buttonID
|
||||
End Sub
|
||||
Protected Sub AddBoleto(sender As Object, e As EventArgs)
|
||||
|
||||
If asientoSeleccionado = "" Then
|
||||
Alert("Se requiere seleccionar su asiento")
|
||||
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
|
||||
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)
|
||||
|
||||
If retorno > 1 Then
|
||||
ObjTransporte.Commit()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Alert($"No se pudo generar el boleto {ex}", TipoMensaje.MsgError)
|
||||
Finally
|
||||
ObjTransporte.Dispose()
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
Reference in New Issue
Block a user