--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:
@@ -275,7 +275,7 @@ Public Class ClsTransportes
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function AddDestino(Destino As String, Estatus As String, EsNacional As String, CveUsuario As Integer, CveEmpresa As Integer) As Integer
|
Public Function AddDestino(Destino As String, Estatus As String, EsNacional As String, CveUsuario As Integer, CveEmpresa As Integer, CveEstado As Integer) As Integer
|
||||||
Dim Retorno As Integer = -1
|
Dim Retorno As Integer = -1
|
||||||
|
|
||||||
DataAdapter("PA_Trans_DestinosAdd")
|
DataAdapter("PA_Trans_DestinosAdd")
|
||||||
@@ -286,6 +286,7 @@ Public Class ClsTransportes
|
|||||||
.Add("@Estatus", SqlDbType.Bit).Value = Convert.ToBoolean(Estatus)
|
.Add("@Estatus", SqlDbType.Bit).Value = Convert.ToBoolean(Estatus)
|
||||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
.Add("@CveEstado", SqlDbType.Int).Value = CveEstado
|
||||||
End With
|
End With
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
@@ -297,7 +298,7 @@ Public Class ClsTransportes
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function UpdateDestino(CveDestino As Integer, Destino As String, Estatus As String, EsNacional As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean
|
Public Function UpdateDestino(CveDestino As Integer, Destino As String, Estatus As String, EsNacional As String, CveUsuario As Integer, CveEmpresa As Integer, CveEstado As Integer) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
DataAdapter("PA_Trans_DestinosUpdate")
|
DataAdapter("PA_Trans_DestinosUpdate")
|
||||||
With SqlAdapter.SelectCommand.Parameters
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
@@ -307,6 +308,8 @@ Public Class ClsTransportes
|
|||||||
.Add("@Estatus", SqlDbType.Bit).Value = Convert.ToBoolean(Estatus)
|
.Add("@Estatus", SqlDbType.Bit).Value = Convert.ToBoolean(Estatus)
|
||||||
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
|
||||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||||
|
.Add("@CveEstado", SqlDbType.Int).Value = CveEstado
|
||||||
|
|
||||||
End With
|
End With
|
||||||
Try
|
Try
|
||||||
SqlAdapter.Fill(Data)
|
SqlAdapter.Fill(Data)
|
||||||
|
|||||||
@@ -48,7 +48,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<asp:GridView ID="GvDestinos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado"
|
<asp:GridView ID="GvDestinos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado"
|
||||||
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None"
|
CssClass="table table-striped table-hover Widthall ScrollAD mysmallbtn" GridLines="None"
|
||||||
data-sort="true" DataKeyNames="CveDestino, Destino, EsNacional, Estatus, CveUsuario, FechaIng, CveEmpresa">
|
data-sort="true" DataKeyNames="CveDestino, Destino, EsNacional, Estatus, CveUsuario, FechaIng, CveEmpresa, CveEstado">
|
||||||
<Columns>
|
<Columns>
|
||||||
<asp:TemplateField HeaderText="Destino">
|
<asp:TemplateField HeaderText="Destino">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
@@ -69,6 +69,12 @@
|
|||||||
</ItemTemplate>
|
</ItemTemplate>
|
||||||
</asp:TemplateField>
|
</asp:TemplateField>
|
||||||
|
|
||||||
|
<asp:TemplateField HeaderText="Estado">
|
||||||
|
<ItemTemplate>
|
||||||
|
<asp:Literal ID="LtlEstado" runat="server" Text='<%# Eval("NombreEstado") %>'></asp:Literal>
|
||||||
|
</ItemTemplate>
|
||||||
|
</asp:TemplateField>
|
||||||
|
|
||||||
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
|
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Acciones">
|
||||||
<ItemTemplate>
|
<ItemTemplate>
|
||||||
<asp:LinkButton ID="BtnEditarDestino" runat="server" AlternateText="Editar"
|
<asp:LinkButton ID="BtnEditarDestino" runat="server" AlternateText="Editar"
|
||||||
@@ -215,7 +221,7 @@
|
|||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<asp:DropDownList ID="DdlEsNacional" runat="server" Class="table-group-action-input form-control input-inline select2me"
|
<asp:DropDownList ID="DdlEsNacional" runat="server" Class="table-group-action-input form-control input-inline select2me"
|
||||||
AppendDataBoundItems="true"
|
AppendDataBoundItems="true"
|
||||||
Width="99.9%">
|
Width="99.9%" OnSelectedIndexChanged="OnChangeNacional" AutoPostBack="true">
|
||||||
<asp:ListItem Text="Seleccione" Value="" Selected="True"></asp:ListItem>
|
<asp:ListItem Text="Seleccione" Value="" Selected="True"></asp:ListItem>
|
||||||
<asp:ListItem Text="Sí" Value="True"></asp:ListItem>
|
<asp:ListItem Text="Sí" Value="True"></asp:ListItem>
|
||||||
<asp:ListItem Text="No" Value="False"></asp:ListItem>
|
<asp:ListItem Text="No" Value="False"></asp:ListItem>
|
||||||
@@ -247,6 +253,24 @@
|
|||||||
</ajax:ValidatorCalloutExtender>
|
</ajax:ValidatorCalloutExtender>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="row my-1">
|
||||||
|
<label class="col-md-4">Estado:</label>
|
||||||
|
<div class="col-md-8">
|
||||||
|
<asp:DropDownList ID="DdlEstado" runat="server" Class="table-group-action-input form-control input-inline select2me"
|
||||||
|
DataTextField="NombreEstado"
|
||||||
|
DataValueField="CveEstado"
|
||||||
|
AppendDataBoundItems="true"
|
||||||
|
Width="99.9%">
|
||||||
|
</asp:DropDownList>
|
||||||
|
<asp:RequiredFieldValidator ID="RFVEstado" runat="server" ControlToValidate="DdlEstado"
|
||||||
|
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Estado''</b> es necesario, por favor ingréselo."
|
||||||
|
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||||
|
<ajax:ValidatorCalloutExtender ID="VCEEstado" runat="server" HighlightCssClass="vco"
|
||||||
|
TargetControlID="RFVEstado" Width="400px" BehaviorID="VCEEstado">
|
||||||
|
</ajax:ValidatorCalloutExtender>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</asp:Panel>
|
</asp:Panel>
|
||||||
<%-- Importes --%>
|
<%-- Importes --%>
|
||||||
<asp:Panel ID="PnImporte" runat="server" Visible="false">
|
<asp:Panel ID="PnImporte" runat="server" Visible="false">
|
||||||
|
|||||||
@@ -22,16 +22,7 @@ Partial Class CatRutas
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Sub CargaDatos()
|
Private Sub CargaDatos()
|
||||||
'Lista Rutas'
|
|
||||||
|
|
||||||
Dim ObjRutas As New ClsTransportes()
|
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'
|
'Lista Destinos'
|
||||||
If ObjRutas.GetDestinos() Then
|
If ObjRutas.GetDestinos() Then
|
||||||
|
|
||||||
@@ -60,29 +51,20 @@ Partial Class CatRutas
|
|||||||
|
|
||||||
If ObjDestinos.DtResultados.Rows.Count > 0 Then
|
If ObjDestinos.DtResultados.Rows.Count > 0 Then
|
||||||
|
|
||||||
DdlOrigen.DataSource = ObjDestinos.DtResultados
|
DdlOrigen.DataSource = ObjDestinos.DtResultados : DdlOrigen.DataBind()
|
||||||
DdlOrigen.DataBind()
|
|
||||||
DdlOrigen.Items.Insert(0, New ListItem("Seleccione Partida", ""))
|
DdlOrigen.Items.Insert(0, New ListItem("Seleccione Partida", ""))
|
||||||
|
|
||||||
DdlFinal.DataSource = ObjDestinos.DtResultados
|
DdlFinal.DataSource = ObjDestinos.DtResultados : DdlFinal.DataBind()
|
||||||
DdlFinal.DataBind()
|
|
||||||
DdlFinal.Items.Insert(0, New ListItem("Seleccione Destino", ""))
|
DdlFinal.Items.Insert(0, New ListItem("Seleccione Destino", ""))
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
ObjDestinos.Dispose()
|
ObjDestinos.Dispose()
|
||||||
|
|
||||||
DdlRutas.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveSubProyecto in (12699,12700)")
|
DdlRutas.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltraParametros("CveSubProyecto in (12699,12700)") : DdlRutas.DataBind()
|
||||||
DdlRutas.DataBind()
|
DdlEstado.DataSource = GlobalDTGralEstados("MEX") : DdlEstado.DataBind()
|
||||||
DdlRutas.Items.Insert(0, New ListItem("Seleccione Ruta", ""))
|
DdlEstado.Items.Insert(0, New ListItem("Seleccione Estado", ""))
|
||||||
'Dim ObjRutas As New ClsTransportes()
|
|
||||||
'If ObjRutas.GetRutas(-1, -1, -1, "", True, DateTime.Now) Then
|
|
||||||
|
|
||||||
' 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
|
End Sub
|
||||||
|
|
||||||
Protected Sub MostrarModal(sender As Object, e As EventArgs)
|
Protected Sub MostrarModal(sender As Object, e As EventArgs)
|
||||||
@@ -100,7 +82,6 @@ Partial Class CatRutas
|
|||||||
PnDestino.Visible = False
|
PnDestino.Visible = False
|
||||||
PnImporte.Visible = False
|
PnImporte.Visible = False
|
||||||
Dim id As String = DirectCast(sender, LinkButton).ID
|
Dim id As String = DirectCast(sender, LinkButton).ID
|
||||||
|
|
||||||
If id.Contains("Editar") Then
|
If id.Contains("Editar") Then
|
||||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||||
|
|
||||||
@@ -115,8 +96,18 @@ Partial Class CatRutas
|
|||||||
Case "BtnEditarDestino"
|
Case "BtnEditarDestino"
|
||||||
ModalLabel.Text = "Editar Destino"
|
ModalLabel.Text = "Editar Destino"
|
||||||
TxtDestino.Text = GvRow.DataKey("Destino")
|
TxtDestino.Text = GvRow.DataKey("Destino")
|
||||||
DdlEsNacional.SelectedValue = GvRow.DataKey("EsNacional")
|
|
||||||
DdlDestinoEstatus.SelectedValue = GvRow.DataKey("Estatus")
|
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
|
PnDestino.Visible = True
|
||||||
BtnAddDestino.Visible = True
|
BtnAddDestino.Visible = True
|
||||||
BtnAddDestino.Text = "Editar"
|
BtnAddDestino.Text = "Editar"
|
||||||
@@ -158,48 +149,6 @@ Partial Class CatRutas
|
|||||||
RegistraScript(String.Format("$('#{0}').modal('show');", "Modal"))
|
RegistraScript(String.Format("$('#{0}').modal('show');", "Modal"))
|
||||||
End Sub
|
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"
|
#Region "Destinos"
|
||||||
Protected Sub AddDestino(sender As Object, e As EventArgs)
|
Protected Sub AddDestino(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
@@ -207,14 +156,14 @@ Partial Class CatRutas
|
|||||||
ObjDestino.IniciaTransacSQL()
|
ObjDestino.IniciaTransacSQL()
|
||||||
Try
|
Try
|
||||||
If BtnAddDestino.Text = "Guardar" Then
|
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()
|
ObjDestino.Commit()
|
||||||
Alert("Destino agregado correctamente.")
|
Alert("Destino agregado correctamente.")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If BtnAddDestino.Text = "Editar" Then
|
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()
|
ObjDestino.Commit()
|
||||||
Alert("Destino actualizado correctamente.")
|
Alert("Destino actualizado correctamente.")
|
||||||
End If
|
End If
|
||||||
@@ -239,6 +188,20 @@ Partial Class CatRutas
|
|||||||
|
|
||||||
ObjDestino.Dispose()
|
ObjDestino.Dispose()
|
||||||
End Sub
|
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
|
#End Region
|
||||||
|
|
||||||
#Region "Importes"
|
#Region "Importes"
|
||||||
|
|||||||
@@ -3,9 +3,44 @@
|
|||||||
Inherits="RepViajesCalendario" EnableEventValidation="true" %>
|
Inherits="RepViajesCalendario" EnableEventValidation="true" %>
|
||||||
|
|
||||||
<asp:Content ID="Content1" ContentPlaceHolderID="E" runat="Server">
|
<asp:Content ID="Content1" ContentPlaceHolderID="E" runat="Server">
|
||||||
Prueba
|
Prueba s
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
<asp:Content ID="Content2" ContentPlaceHolderID="C" runat="Server">
|
<asp:Content ID="Content2" ContentPlaceHolderID="C" runat="Server">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
class="btn btn-lg btn-success"
|
||||||
|
data-toggle="modal"
|
||||||
|
data-target="#myModal">
|
||||||
|
Lauch Modal</button>
|
||||||
|
<div class="modal" id="myModal">
|
||||||
|
<div class="modal-dialog">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-header bg-primary">
|
||||||
|
<h5 class="modal-title">Modal Title</h5>
|
||||||
|
<button class="close" data-dismiss="modal">$times;</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-body">
|
||||||
|
aaaa aaaa aaaaaaaa aaaa aaaaaaaa aaaa aaaaaaaa aaaa aaaaaaaa aaaa aaaaaaaa aaaa
|
||||||
|
aaaaaaaa aaaa aaaaaaaa aaaa aaaaaaaa aaaa aaaaaaaa aaaa aaaaaaaa aaaa aaaaaaaa aaaa
|
||||||
|
aaaa
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="modal-footer">
|
||||||
|
<button class="btn btn-danger" data-dismiss="modal">Close</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
</asp:Content>
|
</asp:Content>
|
||||||
|
|
||||||
|
<asp:Content ID="Content3" ContentPlaceHolderID="JS" runat="Server">
|
||||||
|
<script>
|
||||||
|
$['[data-toggle="popover"]'].popover();
|
||||||
|
function showPopover() {
|
||||||
|
$('#hello').popover('show');
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</asp:Content>
|
||||||
|
|||||||
Reference in New Issue
Block a user