Se trabajo en los modelos y PA de Rutas y Destinos. Se trabajó en la lista de choferes. Se trabajó en la creación de viajes

This commit is contained in:
AbrahamCastilloV
2023-12-08 09:30:40 -07:00
parent 1ce8ac1d39
commit b8896b961a
9 changed files with 953 additions and 34 deletions

View File

@@ -0,0 +1,159 @@
<%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Site.master" CodeFile="ContratoTransporte.aspx.vb"
Inherits="ContratoTransportes" %>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Registro de Contratos
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.my-1 {
margin-block: 1rem;
}
</style>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<contenttemplate>
<div class="col-md-12 ">
<div class="portlet smmallpadding light bordered">
<div class="portlet-title">
<div class="caption uppercase" style="position: relative;">
<i class="fa fa-info-circle"></i>Datos del Contrato
</div>
<a href="../SAT/">../SAT/</a>
</div>
<div class="portlet-body">
<%-- cveCliente--%>
<div class="row my-1" id="TrCliente" runat="server">
<label class="col-md-4 bold">
<asp:Label ID="Label1" runat="server" Text="Cliente:"></asp:Label></label><div class="col-md-8">
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="100%" data-metodo="getcliente"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"
UsaWebService="true"></ADS:Dropdownlost>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Servicio:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtDescripcion" runat="server" MaxLength="70" Width="400px"
TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVDescripcion" runat="server" ControlToValidate="TxtDescripcion"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripcion''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDescripcion" runat="server" HighlightCssClass="vco"
TargetControlID="RFVDescripcion" Width="400px" BehaviorID="_content_VCEDescripcion">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row">
<label class="col-md-4 bold">Lugar de Salida:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtUbicacion" runat="server" MaxLength="70" Width="400px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVUbicacion" runat="server" ControlToValidate="TxtUbicacion"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Ubicación''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEUbicacion" runat="server" HighlightCssClass="vco"
TargetControlID="RFVUbicacion" Width="400px" BehaviorID="_content_VCEUbicacion">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Fecha Salida:</label>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker">
<asp:TextBox ID="TxtFechaSalida" runat="server" CssClass="form-control" CausesValidation="True"
type="datetime-local"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtFechaSalida" runat="server" ControlToValidate="TxtFechaSalida"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Salida''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETxtFechaSalida" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTxtFechaSalida" Width="400px" BehaviorID="_content_VCETxtFechaSalida">
</ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Fecha Regreso:</label>
<div class="col-md-8">
<div class="input-group input-sm input-small date date-picker">
<asp:TextBox ID="TxtFechaRegreso" runat="server" CssClass="form-control" CausesValidation="True"
type="datetime-local"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVTxtFechaRegreso" runat="server" ControlToValidate="TxtFechaRegreso"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Regreso''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco"
TargetControlID="RFVTxtFechaRegreso" Width="400px" BehaviorID="_content_VCETxtFechaRegreso">
</ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="row my-1" id="TrTipoUnidad" runat="server">
<label class="col-md-4 bold">
<asp:Label ID="Label2" runat="server" Text="Tipo de Unidad:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlUnidad"
runat="server" DataTextField="NombreComercial" DataValueField="CveCliente"
Class="table-group-action-input form-control input-inline input-sm select2me"
Width="75%" ValidationGroup="GrpGuardar">
</asp:DropDownList>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Observaciones:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtObservaciones" runat="server" MaxLength="70" Width="400px"
TextMode="MultiLine"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVObservaciones" runat="server" ControlToValidate="TxtObservaciones"
Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Descripcion''</b> es necesario, por favor ingréselo."
ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEObservaciones" runat="server" HighlightCssClass="vco"
TargetControlID="RFVObservaciones" Width="400px" BehaviorID="_content_VCEObservaciones">
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Costo dólares:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtDolares" runat="server" type="number"></asp:TextBox>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Costo pesos:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtPesos" runat="server" type="number"></asp:TextBox>
</div>
</div>
<div class="row my-1">
<label class="col-md-4 bold">Anticipo:</label>
<div class="col-md-8">
<asp:TextBox ID="TxtAnticipo" runat="server" type="number"></asp:TextBox>
</div>
</div>
</div>
</div>
<contenttemplate>
<asp:Button ID="BtnGuardar" runat="server" Text="Guardar" ValidationGroup="GrpGuardar"
CssClass="btn btn-success" OnClick="AddContrato" />
</contenttemplate>
</div>
</contenttemplate>
</asp:Content>

View File

@@ -0,0 +1,116 @@
Option Explicit On
Option Strict On
Imports ADSNetLibrary.SIGAPI.Helpers
Imports Extensiones
Imports Extensiones.ModExtensiones
Partial Class ContratoTransportes
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
DdlClientes.setEsWebService(True)
If Not String.IsNullOrEmpty(Request.QueryString("CveContrato")) Then
Dim id As Integer = Convert.ToInt32(Request.QueryString("CveContrato"))
Dim ObjContratos As New ClsContratos
ObjContratos.GetContratos(id, UsuarioActual.CveEmpresa)
Dim fechaSalida As DateTime
Dim fechaRegreso As DateTime
If DateTime.TryParse(ObjContratos.FechaInicial.ToString, fechaSalida) And DateTime.TryParse(ObjContratos.FechaFinal.ToString, fechaRegreso) Then
TxtFechaSalida.Text = fechaSalida.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
TxtFechaRegreso.Text = fechaRegreso.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
End If
TxtDescripcion.Text = ObjContratos.DescripcionContrato
TxtObservaciones.Text = ObjContratos.DescripcionContrato
TxtUbicacion.Text = ObjContratos.Ubicacion
DdlClientes.DataValueField = ObjContratos.CveCliente.ToString
BtnGuardar.Text = "Editar"
End If
End If
End Sub
Protected Sub AddContrato(sender As Object, e As EventArgs)
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
Page.Response.Write("<script>console.log('El resultado de tu variable" + TxtFechaSalida.Text + "')</script>")
If DdlClientes.SelectedValue = "" Then
Alert("Debe seleccionar al cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
Else
Try
If BtnGuardar.Text = "Guardar" Then
Page.Response.Write("<script>console.log('El resultado de tu variable" + "Guardando" + "')</script>")
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
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)
If CveContratoHijo > 0 Then
ObjContratos.Commit()
Alert("El Contrato se registró Correctamente.", TipoMensaje.MsgInformacion)
TxtDescripcion.Text = ""
TxtFechaSalida.Text = ""
TxtFechaRegreso.Text = ""
TxtObservaciones.Text = ""
TxtUbicacion.Text = ""
DdlClientes.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)
Page.Response.Write("<script>console.log('El resultado de tu variable" + Editar.ToString + "')</script>")
If Editar = True Then
ContratoEditado.Commit()
Alert("El Contrato se modificó Correctamente.", TipoMensaje.MsgInformacion)
End If
End If
Catch ex As Exception
ObjContratos.RollBack()
Finally
ObjContratos.Dispose()
Response.Redirect("ListadoContratos.aspx")
End Try
End If
End Sub
End Class

View File

@@ -36,7 +36,7 @@
class="col-md-8">
<asp:DropDownList ID="DdlRutas" AppendDataBoundItems="true" DataTextField="Ruta"
DataValueField="CveEmpresa" Class="table-group-action-input form-control input-inline text-center"
DataValueField="CveRuta" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVRutas" runat="server" ControlToValidate="DdlRutas"
@@ -47,13 +47,14 @@
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row margin-bottom-5" id="TrDestino" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Partida:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Ruta"
DataValueField="CveEmpresa" Class="table-group-action-input form-control input-inline text-center"
<asp:DropDownList ID="DdlDestino" AppendDataBoundItems="true" DataTextField="Destino"
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDestino" runat="server" ControlToValidate="DdlDestino"
@@ -64,13 +65,14 @@
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row margin-bottom-5" id="TrPartida" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Destino:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlPartida" AppendDataBoundItems="true" DataTextField="Ruta"
DataValueField="CveEmpresa" Class="table-group-action-input form-control input-inline text-center"
<asp:DropDownList ID="DdlPartida" AppendDataBoundItems="true" DataTextField="Destino"
DataValueField="CveDestino" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVPartida" runat="server" ControlToValidate="DdlPartida"
@@ -81,13 +83,14 @@
</ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row margin-bottom-5" id="TrChofer" runat="server">
<label class="col-md-4 bold">
<asp:Label runat="server" Text="Chofer:"></asp:Label></label><div
class="col-md-8">
<asp:DropDownList ID="DdlChofer" AppendDataBoundItems="true" DataValueField="CveChofer"
DataTextField="Chofer" Class="table-group-action-input form-control input-inline text-center"
<asp:DropDownList ID="DdlChofer" AppendDataBoundItems="true" DataValueField="CvePersonal"
DataTextField="NombreCompleto" Class="table-group-action-input form-control input-inline text-center"
Width="200px" runat="server">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVChofer" runat="server" ControlToValidate="DdlChofer"

View File

@@ -1,4 +1,8 @@
Partial Class CrearViaje
Imports ADSNetLibrary.Helpers
Imports ADSNetLibrary.SIGAPI.Helpers
Imports Extensiones.ModExtensiones
Partial Class CrearViaje
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
@@ -16,50 +20,53 @@
DdlTransporte.DataSource = ObjAF.DtResultados
DdlTransporte.DataBind()
DdlTransporte.Items.Insert(0, New ListItem("<--Seleccione Transporte-->", ""))
DdlTransporte.Items.Insert(0, New ListItem("Seleccione Transporte", ""))
End If
End If
ObjAF.Dispose()
'Lista Rutas'
Dim ObjRutas As New ClsRH()
If ObjRutas.GetRutas(7) Then
Dim ObjRutas As New ClsRutas()
If ObjRutas.GetRutas(-1, -1, -1, "", True, DateTime.Now) Then
Page.Response.Write("<script>console.log('El resultado de tu variable" + ObjRutas.DtResultados.Rows.ToString + "')</script>")
If ObjRutas.DtResultados.Rows.Count > 0 Then
DdlRutas.DataSource = ObjRutas.DtResultados
DdlRutas.DataBind()
DdlRutas.Items.Insert(0, New ListItem("<--Seleccione Ruta-->", ""))
DdlPartida.DataSource = ObjRutas.DtResultados
DdlPartida.DataBind()
DdlPartida.Items.Insert(0, New ListItem("<--Seleccione Partida-->", ""))
DdlDestino.DataSource = ObjRutas.DtResultados
DdlDestino.DataBind()
DdlDestino.Items.Insert(0, New ListItem("<--Seleccione Destino-->", ""))
DdlRutas.Items.Insert(0, New ListItem("Seleccione Ruta", ""))
End If
End If
ObjRutas.Dispose()
'Lista Chofer'
'GlobalDTRHPersonal()'
'CvePersonal - Text Nombre COmpleto'
Dim ObjAcar As New ClsAcarreos()
If ObjAcar.GetChofer(-1, UsuarioActual.CveEmpresa, 1, -1) Then
DdlChofer.DataSource = ObjAcar.DtResultados
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("<--Seleccione Chofer-->", ""))
'Lista Destinos'
Dim ObjDestinos As New ClsDestinos()
If ObjDestinos.GetDestinos(-1, -1, -1, "", True, True, DateTime.Now) Then
Page.Response.Write("<script>console.log('El resultado de tu variable" + ObjDestinos.DtResultados.Rows.ToString + "')</script>")
If ObjDestinos.DtResultados.Rows.Count > 0 Then
DdlPartida.DataSource = ObjDestinos.DtResultados
DdlPartida.DataBind()
DdlPartida.Items.Insert(0, New ListItem("Seleccione Partida", ""))
DdlDestino.DataSource = ObjDestinos.DtResultados
DdlDestino.DataBind()
DdlDestino.Items.Insert(0, New ListItem("Seleccione Destino", ""))
End If
End If
ObjAcar.Dispose()
ObjRutas.Dispose()
'Lista Chofer'
DdlChofer.DataSource = GlobalDTRHPersonal(UsuarioActual.CveEmpresa)
DdlChofer.DataBind()
DdlChofer.Items.Insert(0, New ListItem("Seleccione Chofer", ""))
End Sub
Protected Sub AddViaje(sender As Object, e As EventArgs)
'Dónde están los PA para agregar viajes?'
'Dónde están los PA para consultar Destinos y rutas viajes?'
'Por qué siempre cambia el aside de Transportes V&A?'
Page.Response.Write("<script>console.log('clits')</script>")
Dim ObjViajes As New ClsViajes()
If ObjViajes.AddViajes(DdlRutas.Text.ToEntero, DdlTransporte.Text.ToEntero, DdlChofer.Text.ToEntero, UsuarioActual.CveEmpresa.ToEntero, TxtFechaViaje.Text.ToDate) = -1 Then
Alert("El Contrato se agregó correctamente.", TipoMensaje.MsgAdvertencia)
End If
End Sub
End Class

View File

@@ -0,0 +1,108 @@
<%@ Page Language="VB" AutoEventWireup="false" MasterPageFile="~/Site.master" CodeFile="ListadoContratos.aspx.vb"
Inherits="ListadoContratos" %>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Listado de Contratos
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
.my-1 {
margin-block: 1rem;
}
.dataTables_scrollHead {
background-color: #DDD;
color: white;
}
.table-scrollable {
margin-top: 0px !important;
margin-bottom: 0px !important;
}
.Texto {
text-align: left !important
}
.boton {
background: red;
}
</style>
</asp:Content>
<asp:Content ID="Content1" ContentPlaceHolderID="HB" runat="Server">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<li>
<asp:HyperLink ID="LBAgregarContrato" runat="server" NavigateUrl="ContratoTransporte.aspx"
Target="_blank"><i class='fa fa-plus'></i> Agregar Contrato</asp:HyperLink>
</li>
<li>
<asp:HyperLink ID="LBCrearViaje" runat="server" NavigateUrl="CrearViaje.aspx"
Target="_blank"><i class='fa fa-car'></i> Crear Viaje</asp:HyperLink>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<contenttemplate>
<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" OnRowCommand="GvContratos_Comandos">
<Columns>
<asp:TemplateField HeaderText="No. Contrato">
<ItemTemplate>
<asp:Literal ID="LtlCveContrato" runat="server" Text='<%# Eval("CveContrato") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Descripcion">
<ItemTemplate>
<asp:Literal ID="LtlDescripcionContrato" runat="server" Text='<%# Eval("DescripcionContrato") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ubicación" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Literal ID="LtUbicacion" runat="server" Text='<%# Eval("Ubicacion") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<HeaderTemplate>
Fecha<br />
Salida
</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFechaIng" runat="server" Text='<%# Eval("FechaInicial", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Fecha Final" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100px">
<HeaderTemplate>
Fecha<br />
Regreso
</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFechaFinal" runat="server" Text='<%# Eval("FechaFinal", "{0:d}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Acciones">
<ItemTemplate>
<asp:Button ID="btnEditar" runat="server" Text="Editar" CommandName="Editar" class="btn btn-primary"
CommandArgument='<%# Eval("CveContrato") %>' />
<asp:Button ID="btnEliminar" runat="server" Text="Eliminar" CommandName="Eliminar"
class="btn btn-danger" CommandArgument='<%# Eval("CveContrato") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</contenttemplate>
</asp:Content>

View File

@@ -0,0 +1,57 @@
Option Explicit On
Option Strict On
Partial Class ListadoContratos
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
CargaDatos()
End If
End Sub
Private Sub CargaDatos()
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, TipoContrato:=2) Then
GvContratos.DataSource = ObjContratos.DtResultados
Else
Me.GvContratos.DataSource = Nothing
End If
ObjContratos.Dispose()
GvContratos.DataBind()
End Sub
Protected Sub GvContratos_Comandos(sender As Object, e As GridViewCommandEventArgs)
Dim id As Integer = Convert.ToInt32(e.CommandArgument)
Dim url As String = $"ContratoTransporte.aspx?CveContrato={id}"
If e.CommandName = "Editar" Then
Dim script As String = $"window.open('{url}', '_blank');"
Page.ClientScript.RegisterStartupScript(Me.GetType(), "OpenWindow", script, True)
End If
If e.CommandName = "Eliminar" Then
Dim ObjContratos As New ClsContratos
ObjContratos.IniciaTransacSQL()
Try
ObjContratos.RemoveContrato(id, UsuarioActual.CveEmpresa)
ObjContratos.Commit()
Catch ex As Exception
ObjContratos.RollBack()
Finally
ObjContratos.Dispose()
Response.Redirect("ListadoContratos.aspx")
End Try
End If
End Sub
End Class