-- Se pasó fecha inicial abajo, se cambió CveRuta por Ruta descriptiva, se cambio "activo" por sí en la columna de viajes masivos, se quitó generar viajes masivos cuando es update, se implementó buscadores en Listado de viajes y contratos y se usó función cargarDatos() en vez de refrescar la página
This commit is contained in:
@@ -3,7 +3,7 @@ Imports System.Data
|
||||
Imports System.Data.SqlClient
|
||||
Imports Extensiones
|
||||
|
||||
Public Class ClsViajes
|
||||
Public Class ClsTransportes
|
||||
Implements IDisposable
|
||||
|
||||
#Region "Campos"
|
||||
@@ -194,7 +194,7 @@ Public Class ClsViajes
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function RemoveViaje(CveViaje As Integer, Optional CveMasivo As Integer = 0) As Boolean
|
||||
Public Function RemoveViaje(Optional CveViaje As Integer = -1, Optional CveMasivo As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
|
||||
@@ -34,6 +34,9 @@
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
|
||||
<asp:UpdatePanel runat="server">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton ID="LBAgregarContrato" runat="server"><i class='fa fa-plus'></i>Agregar Contrato</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
|
||||
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
|
||||
@@ -42,22 +45,25 @@
|
||||
<asp:HyperLink ID="LBListadoViajes" runat="server" NavigateUrl="ListadoViajes.aspx"
|
||||
Target="_blank"><i class='fa fa-road'></i>Viajes</asp:HyperLink>
|
||||
</li>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<div class="row my-1" style="margin-right: 10px; margin-top: 18px;" align="right">
|
||||
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvContratos.ClientID) %>"
|
||||
style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvContratos.ClientID) %>"
|
||||
style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier">
|
||||
</i></a>
|
||||
</div>
|
||||
<contenttemplate>
|
||||
|
||||
<div class="row" style="margin-block: 10px; margin-right: 10px;" align="right">
|
||||
<asp:LinkButton OnClick="MostrarModal" runat="server" AlternateText="Agregar"
|
||||
CssClass="btn btn-sm blue" align="right" Text="Agregar<i class='fa fa-plus'></i>" />
|
||||
</div>
|
||||
|
||||
<asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado"
|
||||
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
||||
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, CveContratoEstatus ">
|
||||
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF ">
|
||||
<Columns>
|
||||
|
||||
<asp:TemplateField HeaderText="No. Contrato">
|
||||
@@ -264,7 +270,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
</contenttemplate>
|
||||
</asp:Content>
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
Imports Extensiones
|
||||
Imports Extensiones.ModExtensiones
|
||||
|
||||
Partial Class ListadoContratos
|
||||
Inherits ClsPaginas
|
||||
@@ -19,11 +19,11 @@ Partial Class ListadoContratos
|
||||
If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
|
||||
If ObjAF.DtResultados.Rows.Count > 0 Then
|
||||
DdlTransporte.DataSource = ObjAF.DtResultados
|
||||
DdlTransporte.Items.Insert(0, New ListItem("Seleccione", "0"))
|
||||
DdlTransporte.Items.Insert(0, New ListItem("Seleccione", ""))
|
||||
End If
|
||||
End If
|
||||
ObjAF.Dispose()
|
||||
DdlTransporte.DataBind()
|
||||
ObjAF.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
@@ -35,7 +35,7 @@ Partial Class ListadoContratos
|
||||
GvContratos.DataBind()
|
||||
End Sub
|
||||
|
||||
Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
|
||||
Protected Sub MostrarModal()
|
||||
TxtDescripcion.Text = ""
|
||||
TxtFechaSalida.Text = ""
|
||||
TxtFechaRegreso.Text = ""
|
||||
@@ -45,7 +45,9 @@ Partial Class ListadoContratos
|
||||
BtnGuardar.Text = "Guardar"
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
|
||||
End Sub
|
||||
|
||||
Private Sub LBAgregarContrato_Click(sender As Object, e As EventArgs) Handles LBAgregarContrato.Click
|
||||
MostrarModal()
|
||||
End Sub
|
||||
Protected Sub AddContrato(sender As Object, e As EventArgs)
|
||||
|
||||
If DdlClientes.SelectedValue = "" Then
|
||||
@@ -57,51 +59,29 @@ Partial Class ListadoContratos
|
||||
ObjContratos.IniciaTransacSQL()
|
||||
Try
|
||||
|
||||
If BtnGuardar.Text = "Guardar" Then
|
||||
|
||||
Dim CveEstatusInicial As Integer = 10
|
||||
Dim CveContratoHijo As Integer = -1
|
||||
Dim CveContratoTipo As Integer = 2
|
||||
Dim CveEstatusInicial As Integer = 10
|
||||
Dim CveContratoHijo As Integer = -1
|
||||
Dim CveContratoTipo As Integer = 2
|
||||
|
||||
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
|
||||
CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero
|
||||
End If
|
||||
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
|
||||
CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero
|
||||
End If
|
||||
|
||||
CveContratoHijo = ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero)
|
||||
CveContratoHijo = ObjContratos.AddContratos("", TxtDescripcion.Text, "", UsuarioActual.CveProveedor, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, -1, -1, -1, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero)
|
||||
|
||||
|
||||
If CveContratoHijo > 0 Then
|
||||
ObjContratos.Commit()
|
||||
Alert("Agregado Correctamente.")
|
||||
TxtDescripcion.Text = ""
|
||||
TxtFechaSalida.Text = ""
|
||||
TxtFechaRegreso.Text = ""
|
||||
TxtObservaciones.Text = ""
|
||||
TxtUbicacion.Text = ""
|
||||
DdlClientes.SelectedValue = ""
|
||||
DdlTransporte.SelectedValue = ""
|
||||
If CveContratoHijo > 0 Then
|
||||
ObjContratos.Commit()
|
||||
Alert("Agregado Correctamente.")
|
||||
TxtDescripcion.Text = ""
|
||||
TxtFechaSalida.Text = ""
|
||||
TxtFechaRegreso.Text = ""
|
||||
TxtObservaciones.Text = ""
|
||||
TxtUbicacion.Text = ""
|
||||
DdlClientes.SelectedValue = ""
|
||||
DdlTransporte.SelectedValue = ""
|
||||
|
||||
End If
|
||||
Else
|
||||
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveContrato"))
|
||||
|
||||
Dim ContratoEditado As New ClsContratos
|
||||
ContratoEditado.GetContratos(id, UsuarioActual.CveEmpresa)
|
||||
|
||||
Dim CveEstatusInicial As Integer = 10
|
||||
Dim Editar As Boolean = False
|
||||
Dim CveContratoTipo As Integer = 2
|
||||
|
||||
If ContratoEditado.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
|
||||
CveEstatusInicial = ContratoEditado.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero
|
||||
End If
|
||||
|
||||
Editar = ContratoEditado.UpdateContratos(ContratoEditado.CveContrato, id.ToString, TxtDescripcion.Text, ContratoEditado.NumeroLicitacion, ContratoEditado.CveProveedor, ContratoEditado.CveCliente, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", ContratoEditado.CveSubProyecto, ContratoEditado.PorIVA, ContratoEditado.PorAnticipo, ContratoEditado.PorAmortizacionAnticipo, ContratoEditado.PorGarantia, "", "", ContratoEditado.CveContratoPadre, ContratoEditado.CveUsuario, ContratoEditado.CveEmpresa, False, -1, -1, -1, ContratoEditado.CveMoneda, ContratoEditado.ModalidadDetalle, CveContratoTipo:=ContratoEditado.CveContratoTipo, CveContratosEstatus:=ContratoEditado.CveContratosEstatus)
|
||||
|
||||
If Editar = True Then
|
||||
ContratoEditado.Commit()
|
||||
Alert("El contrato se modificó correctamente.")
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
@@ -116,9 +96,9 @@ Partial Class ListadoContratos
|
||||
End Sub
|
||||
|
||||
Protected Sub UpdateContrato(sender As Object, e As EventArgs)
|
||||
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
Page.Response.Write("<script>console.log('El resultado de tu variable" + GvRow.DataKey("CveTipoAF") + "')</script>")
|
||||
Dim fechaInicial As DateTime
|
||||
Dim fechaFinal As DateTime
|
||||
|
||||
@@ -126,7 +106,7 @@ Partial Class ListadoContratos
|
||||
TxtDescripcion.Text = GvRow.DataKey("DescripcionContrato")
|
||||
TxtObservaciones.Text = GvRow.DataKey("DescripcionContrato")
|
||||
TxtUbicacion.Text = GvRow.DataKey("Ubicacion")
|
||||
'DdlTransporte.SelectedValue = GvRow.DataKey("CveActivoFijo")
|
||||
DdlTransporte.SelectedValue = GvRow.DataKey("CveTipoAF")
|
||||
If DateTime.TryParse(GvRow.DataKey("FechaInicial").ToString, fechaInicial) And DateTime.TryParse(GvRow.DataKey("FechaFinal").ToString, fechaFinal) Then
|
||||
TxtFechaSalida.Text = fechaInicial.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
|
||||
TxtFechaRegreso.Text = fechaFinal.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
|
||||
|
||||
@@ -14,17 +14,21 @@
|
||||
.fecha {
|
||||
padding: 3px;
|
||||
}
|
||||
.masivo{
|
||||
color:green;
|
||||
}
|
||||
|
||||
.masivo {
|
||||
color: green;
|
||||
}
|
||||
</style>
|
||||
</asp:Content>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
|
||||
<contenttemplate>
|
||||
<li>
|
||||
<asp:HyperLink ID="LBListadoContratos" runat="server" NavigateUrl="ListadoContratos.aspx"
|
||||
<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"
|
||||
Target="_blank"><i class='fa fa-file'></i>Contratos</asp:HyperLink>
|
||||
</li>
|
||||
<li>
|
||||
@@ -37,20 +41,22 @@
|
||||
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
|
||||
<div class="row" style="margin-block: 10px; margin-right: 10px;" align="right">
|
||||
<asp:LinkButton OnClick="MostrarModal" runat="server" AlternateText="Agregar"
|
||||
CssClass="btn btn-sm blue" align="right" Text="Agregar<i class='fa fa-plus'></i>" />
|
||||
<div class="row my-1" style="margin-right: 10px; margin-top: 18px;" align="right">
|
||||
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvViajes.ClientID) %>"
|
||||
style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvViajes.ClientID) %>"
|
||||
style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier">
|
||||
</i></a>
|
||||
</div>
|
||||
|
||||
<asp:GridView ID="GvViajes" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontró ningún viaje registrado"
|
||||
CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
|
||||
data-sort="true" DataKeyNames="CveViaje, CveRuta, Fecha, CveAF, CvePersonal, CveEmpresa, CvePartida, CveDestino, CveMasivo">
|
||||
data-sort="true" DataKeyNames="CveViaje, CveRuta, Fecha, CveAF, CvePersonal, CveEmpresa, CvePartida, CveDestino, CveMasivo, Ruta">
|
||||
<Columns>
|
||||
|
||||
<asp:TemplateField HeaderText="Ruta">
|
||||
<ItemTemplate>
|
||||
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("CveRuta") %>'></asp:Literal>
|
||||
<asp:Literal ID="LtlRuta" runat="server" Text='<%# Eval("Ruta") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
@@ -139,7 +145,7 @@
|
||||
|
||||
<div class="row margin-bottom-5" id="TrRutas" runat="server">
|
||||
<label class="col-md-4 bold">
|
||||
<asp:Label runat="server" Text="Seleccione Ruta:"></asp:Label></label><div
|
||||
<asp:Label runat="server" Text="Ruta:"></asp:Label></label><div
|
||||
class="col-md-8">
|
||||
|
||||
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
|
||||
@@ -229,22 +235,31 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="row my-1 truncate">
|
||||
<asp:CheckBox CssClass="col-md-4" ID="IsMasivo" runat="server" Text="Generar Viajes Masivo"
|
||||
Visible="true"
|
||||
OnCheckedChanged="ToggleMasivo" AutoPostBack="true" />
|
||||
</div>
|
||||
|
||||
<div class="row my-1 truncate">
|
||||
<asp:Panel ID="DivFechaMasivo" runat="server" Visible="false" CssClass="col-md-8">
|
||||
<div class="row col-md-8">
|
||||
<div class="row my-1 truncate date date-picker">
|
||||
<label class="col-md-4 bold">Fecha Inicial:</label>
|
||||
<asp:TextBox CssClass="col-md-8" ID="TxtFechaInicial" runat="server" type="date"></asp:TextBox>
|
||||
<asp:TextBox CssClass="col-md-8" ID="TxtFechaInicial" runat="server" type="date"
|
||||
Width="150px"></asp:TextBox>
|
||||
</div>
|
||||
<div class="row col-md-8 ">
|
||||
<div class="row my-1 truncate">
|
||||
<label class="col-md-4 bold">Lapso</label>
|
||||
<asp:TextBox CssClass="col-md-8" ID="TxtFrecuencia" runat="server" type="number"></asp:TextBox>
|
||||
<asp:TextBox CssClass="col-md-8" ID="TxtFrecuencia" runat="server" type="number"
|
||||
Width="150px"></asp:TextBox>
|
||||
</div>
|
||||
|
||||
</asp:Panel>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
<div class="modal-footer">
|
||||
|
||||
@@ -10,31 +10,11 @@ Partial Class ListadoViajes
|
||||
|
||||
If Not IsPostBack Then
|
||||
CargaDatos()
|
||||
InicializaCombos()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub GvViajes_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvViajes.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CveMasivo") <> "" Then
|
||||
e.Row.FCLabel("LtlMasivo").Text = "Sí"
|
||||
e.Row.FCLabel("LtlMasivo").ForeColor = Drawing.Color.Green
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
|
||||
Dim ObjViajes As New ClsViajes
|
||||
|
||||
ObjViajes.IniciaTransacSQL()
|
||||
|
||||
If ObjViajes.GetViajes() Then
|
||||
GvViajes.DataSource = ObjViajes.DtResultados
|
||||
ObjViajes.Dispose()
|
||||
GvViajes.DataBind()
|
||||
Else
|
||||
Me.GvViajes.DataSource = Nothing
|
||||
End If
|
||||
Private Sub InicializaCombos()
|
||||
'Lista Activos Fijos'
|
||||
Dim ObjAF As New ClsAF()
|
||||
If ObjAF.GetActivosFijos(-1, 13, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, 1, "-1", -1, -1, -1) Then
|
||||
@@ -81,8 +61,31 @@ Partial Class ListadoViajes
|
||||
DdlChofer.Items.Insert(0, New ListItem("Seleccione Chofer", ""))
|
||||
|
||||
End Sub
|
||||
Private Sub GvViajes_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvViajes.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CveMasivo") <> "" Then
|
||||
e.Row.FCLabel("LtlMasivo").Text = "Sí"
|
||||
e.Row.FCLabel("LtlMasivo").ForeColor = Drawing.Color.Green
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CargaDatos()
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
Protected Sub MostrarModal(sender As Object, e As System.EventArgs)
|
||||
If ObjTransportes.GetViajes() Then
|
||||
GvViajes.DataSource = ObjTransportes.DtResultados
|
||||
ObjTransportes.Dispose()
|
||||
GvViajes.DataBind()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub LBAgregarViaje_Click(sender As Object, e As EventArgs) Handles LBAgregarViaje.Click
|
||||
MostrarModal()
|
||||
End Sub
|
||||
|
||||
Public Sub MostrarModal()
|
||||
IsMasivo.Visible = True
|
||||
DdlRutas.Text = ""
|
||||
DdlTransporte.Text = ""
|
||||
DdlChofer.Text = ""
|
||||
@@ -95,10 +98,10 @@ Partial Class ListadoViajes
|
||||
|
||||
Protected Sub AddViaje(sender As Object, e As EventArgs)
|
||||
|
||||
Dim ObjViajes As New ClsViajes
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
|
||||
ObjViajes.IniciaTransacSQL()
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
|
||||
If IsMasivo.Checked = True Then
|
||||
If TxtFechaInicial.Text = "" Or TxtFrecuencia.Text = "" Then
|
||||
@@ -119,10 +122,10 @@ Partial Class ListadoViajes
|
||||
For Each fecha As DateTime In fechasGeneradas
|
||||
Try
|
||||
Dim CveContratoHijo As Integer = -1
|
||||
CveContratoHijo = ObjViajes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, fecha, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero, IsMasivo:=True, CveMasivo:=CveMasivo)
|
||||
CveContratoHijo = ObjTransportes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, fecha, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero, IsMasivo:=True, CveMasivo:=CveMasivo)
|
||||
|
||||
If CveContratoHijo > 0 Then
|
||||
ObjViajes.Commit()
|
||||
ObjTransportes.Commit()
|
||||
End If
|
||||
Catch ex As Exception
|
||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
@@ -135,18 +138,18 @@ Partial Class ListadoViajes
|
||||
TxtFechaViaje.Text = ""
|
||||
DdlPartida.Text = ""
|
||||
DdlDestino.SelectedValue = ""
|
||||
ObjViajes.Dispose()
|
||||
Response.Redirect("ListadoViajes.aspx")
|
||||
ObjTransportes.Dispose()
|
||||
CargaDatos()
|
||||
Alert("El viaje masivo se registró correctamente.", TipoMensaje.MsgInformacion)
|
||||
|
||||
Else
|
||||
Try
|
||||
If BtnGuardar.Text = "Guardar" Then
|
||||
Dim CveContratoHijo As Integer = -1
|
||||
CveContratoHijo = ObjViajes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
|
||||
CveContratoHijo = ObjTransportes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero)
|
||||
|
||||
If CveContratoHijo > 0 Then
|
||||
ObjViajes.Commit()
|
||||
ObjTransportes.Commit()
|
||||
Alert("El Viaje se registró Correctamente.", TipoMensaje.MsgInformacion)
|
||||
DdlRutas.Text = ""
|
||||
DdlTransporte.Text = ""
|
||||
@@ -160,25 +163,25 @@ Partial Class ListadoViajes
|
||||
Else
|
||||
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveViaje"))
|
||||
|
||||
If ObjViajes.UpdateViajes(id, DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa, TxtFechaViaje.Text.ToDate, DdlPartida.Text.ToEntero, DdlDestino.Text.ToEntero) = True Then
|
||||
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)
|
||||
ObjViajes.Commit()
|
||||
ObjTransportes.Commit()
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
ObjViajes.RollBack()
|
||||
ObjTransportes.RollBack()
|
||||
Finally
|
||||
ObjViajes.Dispose()
|
||||
Response.Redirect("ListadoViajes.aspx")
|
||||
CargaDatos()
|
||||
ObjTransportes.Dispose()
|
||||
End Try
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub UpdateViaje(sender As Object, e As EventArgs)
|
||||
IsMasivo.Visible = False
|
||||
DivFechaMasivo.Visible = False
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
|
||||
DdlTransporte.SelectedValue = GvRow.DataKey("CveAF")
|
||||
@@ -192,42 +195,38 @@ Partial Class ListadoViajes
|
||||
TxtFechaViaje.Text = fecha.ToString("yyyy-MM-dd").Replace(" ", "T")
|
||||
End If
|
||||
|
||||
|
||||
BtnGuardar.Text = "Editar"
|
||||
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "ModalAgregar"))
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub RemoveViaje(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
Dim IsMasivo = GvRow.DataKey("CveMasivo")
|
||||
Dim CveMasivo = GvRow.DataKey("CveMasivo")
|
||||
|
||||
Dim ObjViajes As New ClsViajes
|
||||
Dim ObjTransportes As New ClsTransportes
|
||||
|
||||
ObjViajes.IniciaTransacSQL()
|
||||
If IsMasivo <> "" Then
|
||||
ObjTransportes.IniciaTransacSQL()
|
||||
If CveMasivo = "" Then
|
||||
Try
|
||||
ObjViajes.RemoveViaje(-1, CveMasivo:=IsMasivo.ToEntero)
|
||||
ObjViajes.Commit()
|
||||
Response.Redirect(Request.RawUrl)
|
||||
ObjTransportes.RemoveViaje(CveViaje:=GvRow.DataKey("CveViaje").ToEntero)
|
||||
ObjTransportes.Commit()
|
||||
Catch ex As Exception
|
||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
Finally
|
||||
ObjViajes.Dispose()
|
||||
End Try
|
||||
|
||||
Else
|
||||
Try
|
||||
ObjViajes.RemoveViaje(GvRow.DataKey("CveViaje").ToEntero)
|
||||
ObjViajes.Commit()
|
||||
Response.Redirect(Request.RawUrl)
|
||||
ObjTransportes.RemoveViaje(CveMasivo:=CveMasivo.ToEntero)
|
||||
ObjTransportes.Commit()
|
||||
Catch ex As Exception
|
||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
Finally
|
||||
ObjViajes.Dispose()
|
||||
|
||||
End Try
|
||||
End If
|
||||
|
||||
Alert("Viaje eliminado correctamente")
|
||||
CargaDatos()
|
||||
ObjTransportes.Dispose()
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user