-- Selección y deselección de asiento de pasajero y cambio de estilos. Cancelación y Activación de boletos y modificación en boletos.aspx
This commit is contained in:
@@ -14,8 +14,7 @@ Public Class ClsTransportes
|
|||||||
Private Data As DataTable
|
Private Data As DataTable
|
||||||
Private DSet As New DataSet
|
Private DSet As New DataSet
|
||||||
|
|
||||||
Private disposedValue As Boolean = False ' Para detectar llamadas redundantes
|
Private disposedValue As Boolean = False
|
||||||
'REGISTRAR CONEXIÓN
|
|
||||||
Private CveConexion As Integer = 0
|
Private CveConexion As Integer = 0
|
||||||
Public ReadOnly Property DtResultados() As DataTable
|
Public ReadOnly Property DtResultados() As DataTable
|
||||||
Get
|
Get
|
||||||
@@ -164,7 +163,6 @@ Public Class ClsTransportes
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function GetViajes(CveViaje As Integer, CveEmpresa As Integer) As Boolean
|
Public Function GetViajes(CveViaje As Integer, CveEmpresa As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
@@ -194,34 +192,6 @@ Public Class ClsTransportes
|
|||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
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
|
||||||
@@ -271,42 +241,45 @@ Public Class ClsTransportes
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Boletos"
|
#Region "Boletos"
|
||||||
Public Function AddViajePasajeros(CveViaje As Integer, CveDestinoOrigen As Integer, CveDestinoFinal As Integer, Importe As Decimal, Asiento As Integer, Nombre As String, Visa As String, Celular As String, Sexo As Boolean, Observacion As String, CveUsuario As Integer) As Integer
|
Public Function AddViajesPasajeros(CveViaje As Integer, CveDestinoOrigen As Integer, CveDestinoFinal As Integer, Importe As Decimal, Asiento As Integer, Nombre As String, Visa As String, Celular As String, Sexo As Boolean, Observacion As String, CveUsuario As Integer) As Integer
|
||||||
Dim Retorno As Integer = -1
|
Dim Retorno As Integer = -1
|
||||||
|
|
||||||
DataAdapter("PA_Trans_ViajesPasajerosAdd")
|
DataAdapter("PA_Trans_ViajesAdd")
|
||||||
|
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@CveViajePasajero", SqlDbType.Int).Direction = ParameterDirection.Output
|
.Add("@CveViajePasajero", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||||
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
||||||
.Add("@CveDestinoOrigen", SqlDbType.Int).Value = CveDestinoOrigen
|
.Add("@CveDestinoOrigen", SqlDbType.Int).Value = CveDestinoOrigen
|
||||||
.Add("@CveDestinoFinal", SqlDbType.Int).Value = CveDestinoFinal
|
.Add("@CveDestinoFinal", SqlDbType.Int).Value = CveDestinoFinal
|
||||||
.Add("@Importe", SqlDbType.SmallMoney).Value = Importe
|
.Add("@Importe", SqlDbType.Money).Value = Importe
|
||||||
.Add("@Asiento", SqlDbType.TinyInt).Value = Asiento
|
.Add("@Asiento", SqlDbType.Int).Value = Asiento
|
||||||
.Add("@Nombre", SqlDbType.VarChar).Value = Nombre
|
.Add("@Nombre", SqlDbType.VarChar).Value = Nombre
|
||||||
.Add("@Visa", SqlDbType.VarChar).Value = Visa
|
.Add("@Visa", SqlDbType.VarChar).Value = Visa
|
||||||
.Add("@Celular", SqlDbType.VarChar).Value = Celular
|
.Add("@Celular", SqlDbType.VarChar).Value = Celular
|
||||||
.Add("@Sexo", SqlDbType.Bit).Value = Sexo
|
.Add("@Sexo", SqlDbType.Bit).Value = Sexo
|
||||||
.Add("@Observacion", SqlDbType.VarChar).Value = Observacion
|
.Add("@Observacion", SqlDbType.VarChar).Value = Observacion
|
||||||
.Add("@Estatus", SqlDbType.Bit).Value = 1
|
|
||||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
|
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
Retorno = CInt(SqlAdapter.SelectCommand.Parameters("@CveViajePasajero").Value.ToString)
|
Retorno = CInt(SqlAdapter.SelectCommand.Parameters("@CveViajePasajero").Value.ToString)
|
||||||
|
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OnError("Ocurrió un error al guardar el nuevo boleto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
OnError("Ocurrió un error al guardar el nuevo viaje.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
Public Function GetViajesPasajeros(CveViaje As Integer, Optional CveViajePasajero As Integer = 0) As Boolean
|
Public Function GetViajesPasajeros(CveViaje As Integer, Optional CveViajePasajero As Integer = 0, Optional Estatus As Boolean = False) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
DataAdapter("[PA_Trans_ViajesPasajerosGet]")
|
DataAdapter("PA_Trans_ViajesPasajerosGet")
|
||||||
If CveViajePasajero <> 0 Then
|
If Estatus = True Then
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
|
||||||
.Add("@CveViajePasajero", SqlDbType.Int).Value = CveViajePasajero
|
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
|
||||||
End With
|
End With
|
||||||
Else
|
Else
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
@@ -318,11 +291,31 @@ Public Class ClsTransportes
|
|||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
Retorno = True
|
Retorno = True
|
||||||
Catch ex As Exception
|
Catch ex As Exception
|
||||||
OnError("Ocurrió un error al obtener el catálogo de viajes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
OnError("Ocurrió un error al obtener el catálogo de boletos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
End Try
|
End Try
|
||||||
|
|
||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
Public Function UpdateViajesPasajeros(CveViajePasajero As Integer, Optional Estatus As Boolean = True, Optional Activar As Boolean = False) As Boolean
|
||||||
|
|
||||||
|
If Activar Then
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
DataAdapter("PA_Trans_ViajesPasajerosUpdate")
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveViajePasajero", SqlDbType.Int).Value = CveViajePasajero
|
||||||
|
.Add("@Estatus", SqlDbType.Int).Value = Estatus
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al actualizar el boleto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
End Try
|
||||||
|
|
||||||
|
Return Retorno
|
||||||
|
End If
|
||||||
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Tarifas"
|
#Region "Tarifas"
|
||||||
|
|||||||
@@ -23,12 +23,12 @@
|
|||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.disponible:hover {
|
.disponible:hover,.disponible.activo {
|
||||||
background-color: #45b6af;
|
background-color: #45b6af;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.disponible.activo {
|
{
|
||||||
background-color: #45b6af;
|
background-color: #45b6af;
|
||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
@@ -49,17 +49,21 @@
|
|||||||
color: #fff;
|
color: #fff;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chofer {
|
.btnChofer {
|
||||||
align-items: center;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #BFBFBF;
|
|
||||||
width: 45px;
|
width: 45px;
|
||||||
height: 45px;
|
height: 45px;
|
||||||
border-radius: 10px !important;
|
border: 1px solid black;
|
||||||
margin: 5px;
|
text-align: center;
|
||||||
cursor: pointer;
|
color: black
|
||||||
color: black;
|
|
||||||
}
|
}
|
||||||
|
.btnChofer a{
|
||||||
|
color:#2C3E50;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.btnChofer:hover {
|
||||||
|
background-color: #E1E5EC;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
@@ -217,7 +221,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -228,8 +232,8 @@
|
|||||||
<table>
|
<table>
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="5" class="chofer my-1">
|
<td colspan="2" class="btnChofer my-1">
|
||||||
<asp:LinkButton ID="chofer" runat="server" class="chofer"
|
<asp:LinkButton ID="chofer" runat="server"
|
||||||
Text="<i class='fa fa-user'><br/>Chofer</i>" />
|
Text="<i class='fa fa-user'><br/>Chofer</i>" />
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ Partial Class Boletos
|
|||||||
TxtFecha.Text = ObjViaje.Fecha.ToShortDateString
|
TxtFecha.Text = ObjViaje.Fecha.ToShortDateString
|
||||||
'Boletos Vendidos
|
'Boletos Vendidos
|
||||||
Dim dt As DataTable
|
Dim dt As DataTable
|
||||||
If ObjViaje.GetViajesPasajeros(CveViaje) Then
|
If ObjViaje.GetViajesPasajeros(CveViaje, Estatus:=True) Then 'Poner párametro para estatus y cancelado de viajes
|
||||||
dt = ObjViaje.DtResultados
|
dt = ObjViaje.DtResultados
|
||||||
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||||
For Each dr As DataRow In dt.Rows
|
For Each dr As DataRow In dt.Rows
|
||||||
@@ -129,9 +129,13 @@ Partial Class Boletos
|
|||||||
Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
|
Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
|
||||||
Dim buttonID As String = linkButton.ID
|
Dim buttonID As String = linkButton.ID
|
||||||
linkButton.CssClass += " activo"
|
linkButton.CssClass += " activo"
|
||||||
ViewState("AsientoSeleccionado") = buttonID
|
If AsientoSeleccionado <> "" Then
|
||||||
|
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||||
|
Dim lnk As LinkButton = CType(cph.FindControl(AsientoSeleccionado), LinkButton)
|
||||||
|
lnk.CssClass = "disponible"
|
||||||
|
End If
|
||||||
|
AsientoSeleccionado = buttonID
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub AddBoleto(sender As Object, e As EventArgs)
|
Protected Sub AddBoleto(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
If AsientoSeleccionado = "" Then
|
If AsientoSeleccionado = "" Then
|
||||||
@@ -144,7 +148,7 @@ Partial Class Boletos
|
|||||||
|
|
||||||
Try
|
Try
|
||||||
AsientoSeleccionado = AsientoSeleccionado.Replace("A", "")
|
AsientoSeleccionado = AsientoSeleccionado.Replace("A", "")
|
||||||
Dim retorno As Integer = ObjTransporte.AddViajePasajeros(CveViaje, DdlPartida.SelectedValue.ToEntero, DdlDestino.SelectedValue.ToEntero, Importe, AsientoSeleccionado.ToEntero, TxtNombre.Text, TxtVisa.Text, TxtCelular.Text, CBool(RblSexo.SelectedValue), TxtObservaciones.Text, UsuarioActual.CveUsuario)
|
Dim retorno As Integer = ObjTransporte.AddViajesPasajeros(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
|
If retorno > 1 Then
|
||||||
ObjTransporte.Commit()
|
ObjTransporte.Commit()
|
||||||
|
|||||||
@@ -10,7 +10,6 @@
|
|||||||
.my-1 {
|
.my-1 {
|
||||||
margin-block: 1rem;
|
margin-block: 1rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
@@ -42,14 +41,14 @@
|
|||||||
<div class="portlet light xspadding bordered margin-bottom-10">
|
<div class="portlet light xspadding bordered margin-bottom-10">
|
||||||
<asp:GridView ID="GvBoletos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningún boleto registrado"
|
<asp:GridView ID="GvBoletos" runat="server" AutoGenerateColumns="False" EmptyDataText="No se encontró ningún boleto registrado"
|
||||||
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
||||||
data-sort="true">
|
data-sort="true" DataKeyNames="CveViajePasajero,CveViaje,CveDestinoOrigen,CveDestinoFinal,Importe,Asiento,Nombre,Visa,Celular,Sexo,Observacion,Estatus,CveUsuario,FechaIng">
|
||||||
<Columns>
|
<Columns>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="No. Asiento">
|
<asp:TemplateField HeaderText="No. Asiento">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:Literal ID="LtlAsiento" runat="server" Text='<%# Eval("Asiento") %>'></asp:Literal>
|
<asp:Literal ID="LtlAsiento" runat="server" Text='<%# Eval("Asiento") %>'></asp:Literal>
|
||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField HeaderText="Nombre">
|
<asp:TemplateField HeaderText="Nombre">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
@@ -87,10 +86,10 @@
|
|||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:LinkButton ID="BtnEditar" runat="server" AlternateText="Editar"
|
<asp:LinkButton ID="BtnEditar" runat="server" AlternateText="Editar"
|
||||||
CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
|
CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
|
||||||
<asp:LinkButton ID="BtnEliminar" runat="server" AlternateText="Eliminar"
|
<asp:LinkButton ID="BtnToggle" runat="server" AlternateText="Activar/Desactivar"
|
||||||
CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-cancel'></i>"
|
CssClass="btn btn-circle btn-sm red" Text="<i class='fa fa-cancel'></i>"
|
||||||
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar"
|
data-toggle="confirmation" data-popout="true" data-original-title='<%# If(Eval("Estatus").ToString = "True", "Cancelar Boleto", "Reactivar") %>'
|
||||||
data-btn-ok-label="si" />
|
data-btn-ok-label="si" OnClick="ToggleViajesPasajeros" />
|
||||||
<asp:LinkButton ID="BtnViaje" runat="server" AlternateText="Viaje"
|
<asp:LinkButton ID="BtnViaje" runat="server" AlternateText="Viaje"
|
||||||
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-print'></i>" />
|
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-print'></i>" />
|
||||||
|
|
||||||
@@ -99,7 +98,7 @@
|
|||||||
</Columns>
|
</Columns>
|
||||||
</asp:GridView>
|
</asp:GridView>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
Option Explicit On
|
Option Explicit On
|
||||||
Option Strict On
|
Option Strict On
|
||||||
|
Imports ADSNetLibrary.Helpers
|
||||||
Imports ADSNetLibrary.SIGAPI.Helpers
|
Imports ADSNetLibrary.SIGAPI.Helpers
|
||||||
Imports Extensiones.ModExtensiones
|
Imports Extensiones.ModExtensiones
|
||||||
|
|
||||||
@@ -40,4 +41,28 @@ Partial Class ListadoBoletos
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Protected Sub ToggleViajesPasajeros(sender As Object, e As EventArgs)
|
||||||
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
|
Dim CveViajePasajero As String = GvRow.DataKey("CveViajePasajero")
|
||||||
|
Dim Estatus As String = GvRow.DataKey("Estatus")
|
||||||
|
Dim cambiarEstatus As Boolean = Not Estatus.ToBool
|
||||||
|
Dim ObjTransportes As New ClsTransportes
|
||||||
|
|
||||||
|
Try
|
||||||
|
ObjTransportes.IniciaTransacSQL()
|
||||||
|
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero.ToEntero, Activar:=True, Estatus:=cambiarEstatus) Then
|
||||||
|
Alert("El boleto ha sido cancelado correctamente.")
|
||||||
|
End If
|
||||||
|
ObjTransportes.Commit()
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
ObjTransportes.RollBack()
|
||||||
|
Alert($"No se pudo cambiar el estatus del boleto {ex}", TipoMensaje.MsgError)
|
||||||
|
Finally
|
||||||
|
ObjTransportes.Dispose()
|
||||||
|
CargaDatos()
|
||||||
|
End Try
|
||||||
|
|
||||||
|
End Sub
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
Reference in New Issue
Block a user