This commit is contained in:
AbrahamCastilloV
2023-12-16 11:38:15 -07:00
2 changed files with 21 additions and 37 deletions

View File

@@ -57,7 +57,7 @@
<asp:GridView ID="GvContratos" runat="server" AutoGenerateColumns="false" EmptyDataText="No se Encontró Contrato Registrado" <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" CssClass="table table-striped table-hover Widthall ScrollAD text-center" GridLines="None"
data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF"> data-sort="true" DataKeyNames="CveContrato, DescripcionContrato, Ubicacion, FechaInicial, FechaFinal, CveCliente, CveTipoAF, CveContratoEstatus ">
<Columns> <Columns>
<asp:TemplateField HeaderText="No. Contrato"> <asp:TemplateField HeaderText="No. Contrato">

View File

@@ -1,46 +1,38 @@
Option Explicit On Option Explicit On
Option Strict On Option Strict On
Imports ADSNetLibrary.SIGAPI.Helpers Imports Extensiones
Imports Extensiones.ModExtensiones
Partial Class ListadoContratos Partial Class ListadoContratos
Inherits ClsPaginas Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
InicializaCombos()
CargaDatos() CargaDatos()
End If End If
End Sub End Sub
Private Sub CargaDatos() Private Sub InicializaCombos()
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
DdlClientes.setEsWebService(True) DdlClientes.setEsWebService(True)
'Lista Activos Fijos' 'Lista Activos Fijos'
Dim ObjAF As New ClsAF() 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.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 If ObjAF.DtResultados.Rows.Count > 0 Then
DdlTransporte.DataSource = ObjAF.DtResultados DdlTransporte.DataSource = ObjAF.DtResultados
DdlTransporte.DataBind() DdlTransporte.Items.Insert(0, New ListItem("Seleccione", "0"))
DdlTransporte.Items.Insert(0, New ListItem("Seleccione Transporte", ""))
End If End If
End If End If
ObjAF.Dispose() 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() ObjContratos.Dispose()
GvContratos.DataBind()
End Sub End Sub
Protected Sub MostrarModal(sender As Object, e As System.EventArgs) 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) Protected Sub AddContrato(sender As Object, e As EventArgs)
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
If DdlClientes.SelectedValue = "" Then If DdlClientes.SelectedValue = "" Then
Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia) Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
Try Try
If BtnGuardar.Text = "Guardar" Then If BtnGuardar.Text = "Guardar" Then
@@ -71,6 +62,7 @@ Partial Class ListadoContratos
Dim CveEstatusInicial As Integer = 10 Dim CveEstatusInicial As Integer = 10
Dim CveContratoHijo As Integer = -1 Dim CveContratoHijo As Integer = -1
Dim CveContratoTipo As Integer = 2 Dim CveContratoTipo As Integer = 2
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero
End If End If
@@ -117,7 +109,7 @@ Partial Class ListadoContratos
ObjContratos.RollBack() ObjContratos.RollBack()
Finally Finally
ObjContratos.Dispose() ObjContratos.Dispose()
Response.Redirect("ListadoContratos.aspx") CargaDatos()
End Try End Try
@@ -150,19 +142,11 @@ Partial Class ListadoContratos
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim ObjContratos As New ClsContratos Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL() If ObjContratos.RemoveContrato(GvRow.DataKey("CveContrato").ToEntero, UsuarioActual.CveEmpresa) Then
Try
ObjContratos.RemoveContrato(GvRow.DataKey("CveContrato").ToEntero, UsuarioActual.CveEmpresa)
Alert("Contrato eliminado correctamente") 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 Sub
End Class End Class