From 4fd8c5f522b55ab0c3019e7af0bac0cab913ac7a Mon Sep 17 00:00:00 2001 From: rrene Date: Sat, 16 Dec 2023 11:35:29 -0700 Subject: [PATCH] =?UTF-8?q?--=20correcciones=20de=20acomodo=20de=20informa?= =?UTF-8?q?ci=C3=B3n,=20unificaci=C3=B3n=20de=20criterios?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Transportes/ListadoContratos.aspx | 2 +- Transportes/ListadoContratos.aspx.vb | 56 ++++++++++------------------ 2 files changed, 21 insertions(+), 37 deletions(-) diff --git a/Transportes/ListadoContratos.aspx b/Transportes/ListadoContratos.aspx index 8983e8b47..917465acc 100644 --- a/Transportes/ListadoContratos.aspx +++ b/Transportes/ListadoContratos.aspx @@ -57,7 +57,7 @@ + data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, CveContratoEstatus "> diff --git a/Transportes/ListadoContratos.aspx.vb b/Transportes/ListadoContratos.aspx.vb index d2767391e..ddec16a91 100644 --- a/Transportes/ListadoContratos.aspx.vb +++ b/Transportes/ListadoContratos.aspx.vb @@ -1,46 +1,38 @@ Option Explicit On Option Strict On -Imports ADSNetLibrary.SIGAPI.Helpers -Imports Extensiones.ModExtensiones +Imports Extensiones Partial Class ListadoContratos - Inherits ClsPaginas Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not IsPostBack Then + InicializaCombos() CargaDatos() End If End Sub - Private Sub CargaDatos() - Dim ObjContratos As New ClsContratos - - ObjContratos.IniciaTransacSQL() - - If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then - GvContratos.DataSource = ObjContratos.DtResultados - ObjContratos.Dispose() - GvContratos.DataBind() - Else - Me.GvContratos.DataSource = Nothing - End If - - + Private Sub InicializaCombos() DdlClientes.setEsWebService(True) '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 If ObjAF.DtResultados.Rows.Count > 0 Then DdlTransporte.DataSource = ObjAF.DtResultados - DdlTransporte.DataBind() - - DdlTransporte.Items.Insert(0, New ListItem("Seleccione Transporte", "")) + DdlTransporte.Items.Insert(0, New ListItem("Seleccione", "0")) End If End If ObjAF.Dispose() + DdlTransporte.DataBind() + End Sub + Private Sub CargaDatos() + Dim ObjContratos As New ClsContratos + If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then + GvContratos.DataSource = ObjContratos.DtResultados + End If ObjContratos.Dispose() + GvContratos.DataBind() End Sub Protected Sub MostrarModal(sender As Object, e As System.EventArgs) @@ -56,14 +48,13 @@ Partial Class ListadoContratos Protected Sub AddContrato(sender As Object, e As EventArgs) - Dim ObjContratos As New ClsContratos - - ObjContratos.IniciaTransacSQL() If DdlClientes.SelectedValue = "" Then Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia) Exit Sub End If + Dim ObjContratos As New ClsContratos + ObjContratos.IniciaTransacSQL() Try If BtnGuardar.Text = "Guardar" Then @@ -71,6 +62,7 @@ Partial Class ListadoContratos 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 @@ -117,7 +109,7 @@ Partial Class ListadoContratos ObjContratos.RollBack() Finally ObjContratos.Dispose() - Response.Redirect("ListadoContratos.aspx") + CargaDatos() End Try @@ -150,19 +142,11 @@ Partial Class ListadoContratos Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim ObjContratos As New ClsContratos - ObjContratos.IniciaTransacSQL() - Try - - ObjContratos.RemoveContrato(GvRow.DataKey("CveContrato").ToEntero, UsuarioActual.CveEmpresa) + If ObjContratos.RemoveContrato(GvRow.DataKey("CveContrato").ToEntero, UsuarioActual.CveEmpresa) Then Alert("Contrato eliminado correctamente") + CargaDatos() + End If + ObjContratos.Dispose() - ObjContratos.Commit() - Response.Redirect(Request.RawUrl) - - Catch ex As Exception - Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError) - Finally - ObjContratos.Dispose() - End Try End Sub End Class