--Se ajusta el método de UpdateViajesPasajeros a todas las variables. Se hacen ajustes visualizes en Boletos y se arregla visibilidad de avisos. Se agrega la columna de vendedor a ViajesPasajeros y en el PA_VPGet y algunas modificaciones estéticas. Se crea la función updateBoleto para poder cambiar de asiento y ruta.
This commit is contained in:
@@ -9,6 +9,7 @@ Imports Microsoft.Reporting.WebForms
|
||||
|
||||
Partial Class RepContratoDetalle
|
||||
Inherits ClsPaginas
|
||||
#Region "Propiedades"
|
||||
Private Property CveContrato As Integer
|
||||
Get
|
||||
Return CType(ViewState("CveContrato"), Integer)
|
||||
@@ -17,6 +18,14 @@ Partial Class RepContratoDetalle
|
||||
ViewState("CveContrato") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property CveViajePasajero As Integer
|
||||
Get
|
||||
Return CType(ViewState("CveViajePasajero"), Integer)
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveViajePasajero") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property Contrato As DataTable
|
||||
Get
|
||||
Return CType(ViewState("Contrato"), DataTable)
|
||||
@@ -25,6 +34,14 @@ Partial Class RepContratoDetalle
|
||||
ViewState("Contrato") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property ViajeActual As DataTable
|
||||
Get
|
||||
Return CType(ViewState("ViajeActual"), DataTable)
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("ViajeActual") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property SubProyecto As String
|
||||
Get
|
||||
Return CType(ViewState("SubProyecto"), String)
|
||||
@@ -41,15 +58,19 @@ Partial Class RepContratoDetalle
|
||||
ViewState("AsientoSeleccionado") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Request("CveContrato") Is Nothing Then
|
||||
Response.Redirect($"~/Transportes/RepContratos.aspx")
|
||||
End If
|
||||
CveContrato = Request("CveContrato").ToEntero
|
||||
|
||||
If Not IsPostBack Then
|
||||
InicializaCombos()
|
||||
CargaDatos()
|
||||
AsientoSeleccionado = ""
|
||||
CveViajePasajero = 0
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Private Sub InicializaCombos()
|
||||
@@ -97,55 +118,66 @@ Partial Class RepContratoDetalle
|
||||
End If
|
||||
ObjContratos.Dispose()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnCancelar_Click(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
|
||||
CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero
|
||||
LbPartida.Text = GvRow.DataKey("Partida").ToString()
|
||||
LbDestino.Text = GvRow.DataKey("Destino").ToString()
|
||||
LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C")
|
||||
LbNombre.Text = GvRow.DataKey("Nombre").ToString()
|
||||
LbVisa.Text = GvRow.DataKey("Visa").ToString()
|
||||
LbCelular.Text = GvRow.DataKey("Celular").ToString()
|
||||
LbSexo.Text = GvRow.DataKey("Sexo").ToString()
|
||||
LbObservacion.Text = GvRow.DataKey("Observacion").ToString()
|
||||
LbEstatus.Text = GvRow.DataKey("Estatus").ToString()
|
||||
LbCreado.Text = GvRow.DataKey("FechaIng").ToString()
|
||||
TxtAsiento.Text = GvRow.DataKey("Asiento").ToString()
|
||||
Dim Estatus As Boolean = Not LbEstatus.Text.ToBool
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
Try
|
||||
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero.ToEntero, Activar:=cambiarEstatus, Estatus:=cambiarEstatus) Then
|
||||
If Not cambiarEstatus Then
|
||||
Alert($"El boleto ha sido cancelado correctamente.")
|
||||
Else
|
||||
Alert($"El boleto ha sido reactivado correctamente.")
|
||||
End If
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
|
||||
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, CveContrato, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, LbNombre.Text, LbVisa.Text, LbCelular.Text, LbObservacion.Text, Estatus, UsuarioActual.CveUsuario, LbSexo.Text.ToBool) Then
|
||||
Alert($"El boleto ha modificado el estatus de su boleto correctamente.")
|
||||
|
||||
ObjTransportes.Commit()
|
||||
End If
|
||||
ObjTransportes.Commit()
|
||||
|
||||
Catch ex As Exception
|
||||
ObjTransportes.RollBack()
|
||||
Alert($"No se pudo cambiar el estatus del boleto {ex}", TipoMensaje.MsgError)
|
||||
Alert($"No se pudo cambiar el estatus del boleto", TipoMensaje.MsgError)
|
||||
Finally
|
||||
ObjTransportes.Dispose()
|
||||
CargaDatos()
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Protected Sub CambiarBoleto(sender As Object, e As EventArgs)
|
||||
DdlRuta.ClearSelection()
|
||||
PnEditarViaje.Visible = True
|
||||
PnEditarUsuario.Visible = False
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
CveViajePasajero = GvRow.DataKey("CveViajePasajero").ToEntero
|
||||
LbPartida.Text = GvRow.DataKey("Partida").ToString()
|
||||
LbDestino.Text = GvRow.DataKey("Destino").ToString()
|
||||
LbImporte.Text = GvRow.DataKey("Importe").ToString()
|
||||
LbImporte.Text = Convert.ToDecimal(GvRow.DataKey("Importe")).ToString("C")
|
||||
LbNombre.Text = GvRow.DataKey("Nombre").ToString()
|
||||
LbVisa.Text = GvRow.DataKey("Visa").ToString()
|
||||
LbCelular.Text = GvRow.DataKey("Celular").ToString()
|
||||
LbSexo.Text = GvRow.DataKey("Sexo").ToString()
|
||||
LbObservacion.Text = GvRow.DataKey("Observacion").ToString()
|
||||
LbEstatus.Text = GvRow.DataKey("Estatus").ToString()
|
||||
LbCreado.Text = GvRow.DataKey("FechaIng").ToString()
|
||||
LbAsiento.Text = GvRow.DataKey("Asiento").ToString()
|
||||
TxtAsiento.Text = GvRow.DataKey("Asiento").ToString()
|
||||
|
||||
'Seleccionamos la ruta que tiene el usuario actual
|
||||
DdlRuta.ClearSelection()
|
||||
Dim ObjContratos As New ClsContratos
|
||||
If ObjContratos.GetContratosReporte(UsuarioActual.CveEmpresa, MinFecha, MaxFecha, -1, CveEstatus:=-1, CveTipoContrato:=35) Then
|
||||
For Each row As DataRow In ObjContratos.DtResultados.Rows
|
||||
Dim fecha As DateTime = row("FechaInicial").ToString.ToDateTime
|
||||
' Asigna los valores de la columna deseada al ListItem
|
||||
Dim listItem As New ListItem(row("SubProyecto").ToString() + " - " + row("FechaInicial").ToString(), row("CveContrato").ToString())
|
||||
|
||||
Dim listItem As New ListItem(row("SubProyecto").ToString() + " - " + fecha.ToShortDateString + " - " + fecha.ToShortTimeString, row("CveContrato").ToString())
|
||||
' Agrega el ListItem al DropDownList
|
||||
DdlRuta.Items.Add(listItem)
|
||||
Next
|
||||
@@ -154,53 +186,76 @@ Partial Class RepContratoDetalle
|
||||
ObjContratos.Dispose()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar"))
|
||||
End Sub
|
||||
|
||||
Protected Sub UpdateBoleto(sender As Object, e As EventArgs)
|
||||
For Each boleto As DataRow In ViajeActual.Rows
|
||||
If (boleto.Item("Asiento").ToString = TxtAsiento.Text) Then
|
||||
Alert($"El asiento {boleto.Item("Asiento")} ya ha está ocupado", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
Next
|
||||
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
Try
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
|
||||
If ObjTransportes.UpdateViajesPasajeros(CveViajePasajero, DdlRuta.SelectedValue.ToEntero, UsuarioActual.CveVendedor, LbImporte.Text.ToDecimal, TxtAsiento.Text.ToEntero, LbNombre.Text, LbVisa.Text, LbCelular.Text, LbObservacion.Text, LbEstatus.Text.ToBool, UsuarioActual.CveUsuario, LbSexo.Text.ToBool) Then
|
||||
ObjTransportes.Commit()
|
||||
End If
|
||||
Catch ex As ArgumentException
|
||||
Alert($"Ocurrió un ocurrió un error al actualizar su boleto", TipoMensaje.MsgError)
|
||||
ObjTransportes.RollBack()
|
||||
Finally
|
||||
Alert("Su asiento fue actualizado correctamente")
|
||||
ObjTransportes.Dispose()
|
||||
CargaDatos()
|
||||
End Try
|
||||
End Sub
|
||||
Protected Sub EditarBoleto(sender As Object, e As EventArgs)
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub OnLinkButtonClick(sender As Object, e As EventArgs)
|
||||
'quitamos la selección anterior, en caso de existir.
|
||||
'Limpiamos la selección anterior
|
||||
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
|
||||
|
||||
'Seleccionamos un asiento
|
||||
Dim linkButton As LinkButton = DirectCast(sender, LinkButton)
|
||||
Dim buttonID As String = linkButton.ID
|
||||
linkButton.CssClass += " activo"
|
||||
AsientoSeleccionado = buttonID
|
||||
TxtAsiento.Text = buttonID.Substring(1)
|
||||
|
||||
UpBoletos.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar"))
|
||||
End Sub
|
||||
|
||||
Protected Sub OnChangeRuta(sender As Object, e As EventArgs)
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
If ObjTransportes.GetViajesPasajeros(DdlRuta.SelectedValue.ToEntero) Then
|
||||
BusquedaSeleccionada(ObjTransportes.DtResultados)
|
||||
End If
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalEditar"))
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BusquedaSeleccionada(dt As DataTable)
|
||||
'Limpiamos autobus
|
||||
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||
|
||||
For i As Integer = 1 To 50
|
||||
Dim lnk As LinkButton = CType(cph.FindControl($"A{i}"), LinkButton)
|
||||
If lnk IsNot Nothing Then
|
||||
lnk.Enabled = True
|
||||
lnk.CssClass = "disponible"
|
||||
End If
|
||||
Next
|
||||
'Si la dt DataTable tiene algo llenamos los asientos
|
||||
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
|
||||
Dim cph As ContentPlaceHolder = CType(Me.Master.FindControl("C"), ContentPlaceHolder)
|
||||
|
||||
For i As Integer = 1 To 50
|
||||
Dim lnk As LinkButton = CType(cph.FindControl($"A{i}"), LinkButton)
|
||||
If lnk IsNot Nothing Then
|
||||
lnk.Enabled = True
|
||||
lnk.CssClass = "disponible"
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each dr As DataRow In dt.Rows
|
||||
Dim lnk As LinkButton = CType(cph.FindControl($"A{dr("Asiento")}"), LinkButton)
|
||||
|
||||
If lnk IsNot Nothing Then
|
||||
lnk.Enabled = False
|
||||
lnk.CssClass = "nodisponible"
|
||||
@@ -208,6 +263,7 @@ Partial Class RepContratoDetalle
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
ViajeActual = dt
|
||||
End Sub
|
||||
Protected Sub ImprimirBoleto(sender As Object, e As EventArgs)
|
||||
Dim dtResult As New DataTable()
|
||||
@@ -236,8 +292,6 @@ Partial Class RepContratoDetalle
|
||||
'Empresas/188/Formatos/Boleto.mrt
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user