--Se hace cambio en CargaEventos para acceder a la CveAF. Se hace cambio igual en valores del DdlTransporte , agrega un valor oculto para guardar la clave del contrato para poder editarlo y se guarda el valor al abrir el modal. Se elimina la propiedad CveContrato, ya que se cambia por el valor oculto, se eliminan las partes para guardar un contrato nuevo, ya que no se usan y se simplifica al simple retorno del método UpdateContratos
This commit is contained in:
@@ -7,14 +7,6 @@ Partial Class RepContratosCalendario
|
||||
Inherits ClsPaginas
|
||||
|
||||
#Region "PROPIEDADES"
|
||||
Private Property CveContrato As Integer
|
||||
Get
|
||||
Return ViewState("CveContrato").ToString().ToEntero
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveContrato") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
@@ -71,33 +63,19 @@ Partial Class RepContratosCalendario
|
||||
Dim ObjContratos As New ClsContratos
|
||||
ObjContratos.IniciaTransacSQL()
|
||||
Try
|
||||
If ObjContratos.UpdateContratos(CveContrato.Value.ToEntero, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1, CveChofer:=DdlChofer.SelectedValue.ToEntero, CveTipoAF:=DdlTransporte.SelectedValue.ToEntero) Then
|
||||
|
||||
Dim CveEstatusInicial As Integer = 10
|
||||
Dim CveContratoHijo As Integer = -1
|
||||
Dim CveContratoTipo As Integer = 2
|
||||
Dim retorno As Boolean = False
|
||||
|
||||
If ObjContratos.GetContratosEstatus(UsuarioActual.CveEmpresa) Then
|
||||
CveEstatusInicial = ObjContratos.DtResultados.FiltroPrimeroValor("CveContratoEstatus", "TipoEstatus=1").ToEntero
|
||||
End If
|
||||
|
||||
'Actualizar contrato
|
||||
If BtnActualizar.Text = "Editar" Then
|
||||
retorno = ObjContratos.UpdateContratos(CveContrato, "", TxtDescripcion.Text, "", -1, DdlClientes.SelectedValue.ToEntero, -1, TxtFechaSalida.Text.ToDate, TxtFechaRegreso.Text.ToDate, TxtUbicacion.Text, "", 10, -1, -1, -1, -1, "", "", -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, False, TxtAnticipo.Text.ToDecimal, TxtPesos.Text.ToDecimal, TxtDolares.Text.ToDecimal, -1, 0, CveContratoTipo:=2, CveContratosEstatus:=1)
|
||||
End If
|
||||
|
||||
If retorno Then
|
||||
ObjContratos.Commit()
|
||||
Alert("Actualizado Correctamente.")
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
Alert($"Ocurrió un error {ex}", TipoMensaje.MsgError)
|
||||
Alert("Ocurrió un error al actualizar el contrato", TipoMensaje.MsgError)
|
||||
ObjContratos.RollBack()
|
||||
Finally
|
||||
ObjContratos.Dispose()
|
||||
CargaDatos()
|
||||
|
||||
End Try
|
||||
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user