--Se agrego variable de CveEstado a métodos y PA. Se agregó columna de estado y DdlEstado. Se agregó funcionalidad OnChange para cambiar si el viaje es nacional o no y mostrar diferentes estados y se modificaron métodos para poder incluir CveEstado y NombreEstado
This commit is contained in:
@@ -22,16 +22,7 @@ Partial Class CatRutas
|
||||
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
'Lista Rutas'
|
||||
|
||||
Dim ObjRutas As New ClsTransportes()
|
||||
'If ObjRutas.GetRutas(-1, -1, -1, "", True, DateTime.Now) Then
|
||||
|
||||
' If ObjRutas.DtResultados.Rows.Count > 0 Then
|
||||
' GvRutas.DataSource = ObjRutas.DtResultados
|
||||
' GvRutas.DataBind()
|
||||
' End If
|
||||
'End If
|
||||
'Lista Destinos'
|
||||
If ObjRutas.GetDestinos() Then
|
||||
|
||||
@@ -60,29 +51,20 @@ Partial Class CatRutas
|
||||
|
||||
If ObjDestinos.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
DdlOrigen.DataSource = ObjDestinos.DtResultados
|
||||
DdlOrigen.DataBind()
|
||||
DdlOrigen.DataSource = ObjDestinos.DtResultados : DdlOrigen.DataBind()
|
||||
DdlOrigen.Items.Insert(0, New ListItem("Seleccione Partida", ""))
|
||||
|
||||
DdlFinal.DataSource = ObjDestinos.DtResultados
|
||||
DdlFinal.DataBind()
|
||||
DdlFinal.DataSource = ObjDestinos.DtResultados : DdlFinal.DataBind()
|
||||
DdlFinal.Items.Insert(0, New ListItem("Seleccione Destino", ""))
|
||||
End If
|
||||
End If
|
||||
ObjDestinos.Dispose()
|
||||
|
||||
DdlRutas.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveSubProyecto in (12699,12700)")
|
||||
DdlRutas.DataBind()
|
||||
DdlRutas.Items.Insert(0, New ListItem("Seleccione Ruta", ""))
|
||||
'Dim ObjRutas As New ClsTransportes()
|
||||
'If ObjRutas.GetRutas(-1, -1, -1, "", True, DateTime.Now) Then
|
||||
DdlRutas.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveSubProyecto in (12699,12700)") : DdlRutas.DataBind()
|
||||
DdlEstado.DataSource = GlobalDTGralEstados("MEX") : DdlEstado.DataBind()
|
||||
DdlEstado.Items.Insert(0, New ListItem("Seleccione Estado", ""))
|
||||
|
||||
|
||||
' If ObjRutas.DtResultados.Rows.Count > 0 Then
|
||||
' DdlRutas.DataSource = ObjRutas.DtResultados
|
||||
' DdlRutas.DataBind()
|
||||
' DdlRutas.Items.Insert(0, New ListItem("Seleccione Ruta", ""))
|
||||
' End If
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Protected Sub MostrarModal(sender As Object, e As EventArgs)
|
||||
@@ -100,7 +82,6 @@ Partial Class CatRutas
|
||||
PnDestino.Visible = False
|
||||
PnImporte.Visible = False
|
||||
Dim id As String = DirectCast(sender, LinkButton).ID
|
||||
|
||||
If id.Contains("Editar") Then
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
@@ -115,8 +96,18 @@ Partial Class CatRutas
|
||||
Case "BtnEditarDestino"
|
||||
ModalLabel.Text = "Editar Destino"
|
||||
TxtDestino.Text = GvRow.DataKey("Destino")
|
||||
DdlEsNacional.SelectedValue = GvRow.DataKey("EsNacional")
|
||||
DdlDestinoEstatus.SelectedValue = GvRow.DataKey("Estatus")
|
||||
DdlEsNacional.SelectedValue = GvRow.DataKey("EsNacional")
|
||||
|
||||
If Convert.ToBoolean(DdlEsNacional.SelectedValue) Then
|
||||
DdlEstado.DataSource = GlobalDTGralEstados("MEX") : DdlEstado.DataBind()
|
||||
Else
|
||||
DdlEstado.DataSource = GlobalDTGralEstados("USA") : DdlEstado.DataBind()
|
||||
End If
|
||||
UpModal.Update()
|
||||
|
||||
DdlEstado.SelectedValue = GvRow.DataKey("CveEstado")
|
||||
|
||||
PnDestino.Visible = True
|
||||
BtnAddDestino.Visible = True
|
||||
BtnAddDestino.Text = "Editar"
|
||||
@@ -158,48 +149,6 @@ Partial Class CatRutas
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "Modal"))
|
||||
End Sub
|
||||
|
||||
|
||||
'#Region "Rutas"
|
||||
' Protected Sub AddRuta(sender As Object, e As EventArgs)
|
||||
|
||||
' Dim ObjRuta As New ClsTransportes
|
||||
' ObjRuta.IniciaTransacSQL()
|
||||
' Try
|
||||
' If BtnAddRuta.Text = "Guardar" Then
|
||||
' If ObjRuta.AddRuta(TxtRuta.Text, DdlRutaEstatus.SelectedValue, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) > 1 Then
|
||||
' ObjRuta.Commit()
|
||||
' Alert("Ruta Agregada Correctamente.")
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' If BtnAddRuta.Text = "Editar" Then
|
||||
' If ObjRuta.UpdateRuta(Cve, TxtRuta.Text, DdlRutaEstatus.SelectedValue, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
' ObjRuta.Commit()
|
||||
' Alert("Ruta Actualizada Correctamente.")
|
||||
' End If
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' ObjRuta.RollBack()
|
||||
' Finally
|
||||
' CargaDatos()
|
||||
' ObjRuta.Dispose()
|
||||
' End Try
|
||||
|
||||
|
||||
' End Sub
|
||||
' Protected Sub RemoveRuta(sender As Object, e As EventArgs)
|
||||
' Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
' Dim ObjRuta As New ClsTransportes
|
||||
|
||||
' If ObjRuta.RemoveRuta(GvRow.DataKey("CveRuta").ToEntero) Then
|
||||
' Alert("Ruta eliminada correctamente")
|
||||
' CargaDatos()
|
||||
' End If
|
||||
|
||||
' ObjRuta.Dispose()
|
||||
' End Sub
|
||||
'#End Region
|
||||
|
||||
#Region "Destinos"
|
||||
Protected Sub AddDestino(sender As Object, e As EventArgs)
|
||||
|
||||
@@ -207,14 +156,14 @@ Partial Class CatRutas
|
||||
ObjDestino.IniciaTransacSQL()
|
||||
Try
|
||||
If BtnAddDestino.Text = "Guardar" Then
|
||||
If ObjDestino.AddDestino(TxtDestino.Text, DdlDestinoEstatus.SelectedValue, DdlEsNacional.SelectedValue, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) > 1 Then
|
||||
If ObjDestino.AddDestino(TxtDestino.Text, DdlDestinoEstatus.SelectedValue, DdlEsNacional.SelectedValue, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlEstado.SelectedValue.ToEntero) > 1 Then
|
||||
ObjDestino.Commit()
|
||||
Alert("Destino agregado correctamente.")
|
||||
End If
|
||||
End If
|
||||
|
||||
If BtnAddDestino.Text = "Editar" Then
|
||||
If ObjDestino.UpdateDestino(Cve, TxtDestino.Text, DdlDestinoEstatus.SelectedValue, DdlEsNacional.SelectedValue, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
If ObjDestino.UpdateDestino(Cve, TxtDestino.Text, DdlDestinoEstatus.SelectedValue, DdlEsNacional.SelectedValue, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlEstado.SelectedValue.ToEntero) Then
|
||||
ObjDestino.Commit()
|
||||
Alert("Destino actualizado correctamente.")
|
||||
End If
|
||||
@@ -239,6 +188,20 @@ Partial Class CatRutas
|
||||
|
||||
ObjDestino.Dispose()
|
||||
End Sub
|
||||
Protected Sub OnChangeNacional(sender As Object, e As EventArgs, Optional EsNacional As Boolean = True)
|
||||
DdlEstado.Items.Clear()
|
||||
|
||||
If Convert.ToBoolean(DdlEsNacional.SelectedValue.ToString) And EsNacional Then
|
||||
DdlEstado.DataSource = GlobalDTGralEstados("MEX") : DdlEstado.DataBind()
|
||||
DdlEstado.Items.Insert(0, New ListItem("Seleccione Estado", ""))
|
||||
|
||||
Else
|
||||
DdlEstado.DataSource = GlobalDTGralEstados("USA") : DdlEstado.DataBind()
|
||||
DdlEstado.Items.Insert(0, New ListItem("Seleccione Estado", ""))
|
||||
End If
|
||||
|
||||
UpModal.Update()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
#Region "Importes"
|
||||
|
||||
Reference in New Issue
Block a user