--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

@@ -130,19 +130,15 @@ Public Class ClsDestinos
GC.SuppressFinalize(Me)
End Sub
#End Region
Public Function GetDestinos(CveDestino As Integer, CveUsuario As Integer, CveEmpresa As Integer, Destino As String, Estatus As Boolean, EsNacional As Boolean, FechaIng As DateTime) As Boolean
Public Function GetDestinos(Optional CveRuta As Integer = 0) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Trans_DestinosGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveDestino", SqlDbType.Int).Value = CveDestino
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@Destino", SqlDbType.VarChar).Value = Destino
.Add("@Estatus", SqlDbType.Bit).Value = Estatus
.Add("@EsNacional", SqlDbType.Bit).Value = EsNacional
.Add("@FechaIng", SqlDbType.DateTime).Value = FechaIng
If CveRuta <> 0 Then
With SqlAdapter.SelectCommand.Parameters
.Add("@CveRuta", SqlDbType.Int).Value = CveRuta
End With
End If
End With
Try
SqlAdapter.Fill(Data)
Retorno = True

View File

@@ -9468,10 +9468,9 @@ Public Class ClsPaginas
#End Region
#Region "Transportes"
PaginaDict.Add("/Transportes/ContratoTransporte.aspx".ToUpper(), 598)
PaginaDict.Add("/Transportes/ListadoContratos.aspx".ToUpper(), 598)
PaginaDict.Add("/Transportes/CrearViaje.aspx".ToUpper(), 598)
PaginaDict.Add("/Transportes/ListadoViajes.aspx".ToUpper(), 598)
PaginaDict.Add("/Transportes/Boletos.aspx".ToUpper(), 598)
#End Region
'Antes de aquí.

View File

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

Imports System.Data
Imports System.Data
Imports System.Data.SqlClient
Imports Extensiones
@@ -136,7 +135,7 @@ Public Class ClsTransportes
End Sub
#End Region
#Region "Métodos"
#Region "Viajes"
Public Function AddViajes(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
@@ -170,90 +169,59 @@ Public Class ClsTransportes
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
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 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("@CveViaje", SqlDbType.Int).Value = CveViaje
.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)
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
Ruta = Data.Rows(0)("Ruta").ToString
End If
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al guardar el nuevo viaje.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
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
@@ -301,4 +269,55 @@ Public Class ClsTransportes
Return Retorno
End Function
#End Region
#Region "Boletos"
Public Function AddViajePasajero(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
DataAdapter("PA_Trans_ViajesPasajerosAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveViajePasajero", SqlDbType.Int).Direction = ParameterDirection.Output
.Add("@CveViaje", SqlDbType.Int).Value = CveViaje
.Add("@CveDestinoOrigen", SqlDbType.Int).Value = CveDestinoOrigen
.Add("@CveDestinoFinal", SqlDbType.Int).Value = CveDestinoFinal
.Add("@Importe", SqlDbType.SmallMoney).Value = Importe
.Add("@Asiento", SqlDbType.TinyInt).Value = Asiento
.Add("@Nombre", SqlDbType.VarChar).Value = Nombre
.Add("@Visa", SqlDbType.VarChar).Value = Visa
.Add("@Celular", SqlDbType.VarChar).Value = Celular
.Add("@Sexo", SqlDbType.Bit).Value = Sexo
.Add("@Observacion", SqlDbType.VarChar).Value = Observacion
.Add("@Estatus", SqlDbType.Bit).Value = 1
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
End With
Try
SqlAdapter.Fill(Data)
Retorno = CInt(SqlAdapter.SelectCommand.Parameters("@CveViajePasajero").Value.ToString)
Catch ex As Exception
OnError("Ocurrió un error al guardar el nuevo boleto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#End Region
#Region "Tarifas"
Public Function GetDestinosTarifas(CveDestinoOrigen As Integer, CveDestinoFinal As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Trans_DestinosTarifasGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveDestinoOrigen", SqlDbType.Int).Value = CveDestinoOrigen
.Add("@CveDestinoFinal", SqlDbType.Int).Value = CveDestinoFinal
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener la tarifa de los destinos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#End Region
End Class

View File

@@ -42,8 +42,13 @@
margin: 5px;
cursor: pointer;
color: white;
text-align: center;
}
.nodisponible:hover {
color: #fff;
}
.chofer {
align-items: center;
text-align: center;
@@ -163,26 +168,6 @@
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="upPanel">
<ContentTemplate>
<div class="row margin-bottom-5" id="TrDestino" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
AutoPostBack="true"
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
OnTextChanged="CotizarTarifa"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDestino" runat="server" ControlToValidate="DdlDestino"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Destino''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDestino" runat="server" HighlightCssClass="vco"
TargetControlID="RFVDestino" Width="400px" BehaviorID="_content_VCEDestino">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row margin-bottom-5" id="TrPartida" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Partida:"></asp:Label></label><div
@@ -203,10 +188,30 @@
</div>
</div>
<asp:Label runat="server" ID="TxtCosto" CssClass="tarifa"></asp:Label>
<asp:Button ID="BtnGuardar" Visible="False" OnClick="AddBoleto" runat="server" CssClass="btn btn-success"
Text="Comprar Boleto"
ValidationGroup="GrpGuardar"></asp:Button>
<div class="row margin-bottom-5" id="TrDestino" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
AutoPostBack="true"
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
OnTextChanged="CotizarTarifa"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDestino" runat="server" ControlToValidate="DdlDestino"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Destino''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDestino" runat="server" HighlightCssClass="vco"
TargetControlID="RFVDestino" Width="400px" BehaviorID="_content_VCEDestino">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<asp:Label runat="server" ID="TxtCosto" CssClass="tarifa"></asp:Label>
<asp:Button ID="BtnGuardar" Visible="False" OnClick="AddBoleto" runat="server" CssClass="btn btn-success"
Text="Comprar Boleto"
ValidationGroup="GrpGuardar"></asp:Button>
</ContentTemplate>
</asp:UpdatePanel>
@@ -217,7 +222,7 @@
</div>
<div class="col-md-2">
<div class="col-md-3">
<div class="portlet light xspadding bordered margin-bottom-10">
<contenttemplate>
@@ -241,7 +246,7 @@
</td>
<td>&nbsp;&nbsp;&nbsp;&nbsp;</td>
<td>
<asp:LinkButton OnClick="OnLinkButtonClick" CssClass="nodisponible" ID="A3" runat="server"
<asp:LinkButton OnClick="OnLinkButtonClick" CssClass="disponible" ID="A3" runat="server"
Text="<i class='fa fa-user my-1'><br/>3</i>" />
</td>
<td>

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()

View File

@@ -24,11 +24,10 @@
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
<contenttemplate>
<li>
<asp:LinkButton ID="LBAgregarViaje" runat="server"
><i class='fa fa-plus'></i>Agregar viaje</asp:LinkButton>
<asp:LinkButton ID="LBAgregarViaje" runat="server"><i class='fa fa-plus'></i>Agregar viaje</asp:LinkButton>
</li>
<li>
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
</li>
<li>
@@ -104,6 +103,9 @@
CssClass="btn btn-circle btn-sm red" OnClick="RemoveViaje" Text="<i class='fa fa-trash'></i>"
data-toggle="confirmation" data-popout="true" data-original-title='<%# If(Eval("CveMasivo").ToString <> "", "Eliminación masiva", "Confirmar") %>'
data-btn-ok-label="si" />
<asp:LinkButton ID="BtnViaje" runat="server" AlternateText="Viaje"
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-arrow-right'></i>" OnClick="GoViaje"
/>
</ItemTemplate>
</asp:TemplateField>

View File

@@ -41,10 +41,9 @@ Partial Class ListadoViajes
'Lista Destinos'
Dim ObjDestinos As New ClsDestinos()
If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then
If ObjDestinos.GetDestinos() Then
If ObjDestinos.DtResultados.Rows.Count > 0 Then
DdlPartida.DataSource = ObjDestinos.DtResultados
DdlPartida.DataBind()
DdlPartida.Items.Insert(0, New ListItem("Seleccione Partida", ""))
@@ -72,7 +71,7 @@ Partial Class ListadoViajes
Private Sub CargaDatos()
Dim ObjTransportes As New ClsTransportes
If ObjTransportes.GetViajes() Then
If ObjTransportes.GetViajes(-1, UsuarioActual.CveEmpresa) Then
GvViajes.DataSource = ObjTransportes.DtResultados
ObjTransportes.Dispose()
GvViajes.DataBind()
@@ -97,10 +96,8 @@ Partial Class ListadoViajes
End Sub
Protected Sub AddViaje(sender As Object, e As EventArgs)
Dim ObjTransportes As New ClsTransportes
ObjTransportes.IniciaTransacSQL()
If IsMasivo.Checked = True Then
@@ -109,7 +106,7 @@ Partial Class ListadoViajes
Exit Sub
End If
Dim CveMasivo = DateTimeOffset.Now.ToUnixTimeSeconds().ToEntero
Dim CveMasivo As Integer = DateTimeOffset.Now.ToUnixTimeSeconds().ToEntero
Dim fechaInicial As DateTime = DateTime.Parse(TxtFechaInicial.Text)
Dim frecuencia As Integer = Integer.Parse(TxtFrecuencia.Text)
@@ -141,7 +138,6 @@ Partial Class ListadoViajes
ObjTransportes.Dispose()
CargaDatos()
Alert("El viaje masivo se registró correctamente.", TipoMensaje.MsgInformacion)
Else
Try
If BtnGuardar.Text = "Guardar" Then
@@ -157,18 +153,14 @@ Partial Class ListadoViajes
TxtFechaViaje.Text = ""
DdlPartida.Text = ""
DdlDestino.SelectedValue = ""
End If
Else
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveViaje"))
If ObjTransportes.UpdateViajes(id, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
Alert("El viaje se modificó correctamente.", TipoMensaje.MsgInformacion)
ObjTransportes.Commit()
End If
End If
Catch ex As Exception
ObjTransportes.RollBack()
@@ -203,7 +195,7 @@ Partial Class ListadoViajes
Protected Sub RemoveViaje(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveMasivo = GvRow.DataKey("CveMasivo")
Dim CveMasivo As String = GvRow.DataKey("CveMasivo")
Dim ObjTransportes As New ClsTransportes
@@ -233,6 +225,12 @@ Partial Class ListadoViajes
Protected Sub ToggleMasivo(sender As Object, e As EventArgs)
DivFechaMasivo.Visible = IsMasivo.Checked
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
End Sub
Protected Sub GoViaje(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim CveViaje As String = GvRow.DataKey("CveViaje")
Response.Redirect(String.Format("~/Transportes/Boletos.aspx?CveViaje={0}", CveViaje))
End Sub
End Class