From 5194963509dfaccb22371f48982e6b755f65d47c Mon Sep 17 00:00:00 2001 From: Rakcsle Supertramp Date: Tue, 15 Oct 2019 14:14:14 -0700 Subject: [PATCH] IE cahcar error en treger al eliminar --- App_Code/ClsBancos.vb | 38 ++++++++++++++++++++++++++++---------- Bancos/IE.aspx.vb | 19 ++++++++++++++++--- 2 files changed, 44 insertions(+), 13 deletions(-) diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index 25443bfa0..b95ac1cd8 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -171,8 +171,11 @@ Public Class ClsBancos Public Property FacturaProveedor As String Public Property FacturaSerieFolio As String Public Property FacturaDescripcion As String - Public Property FacturaFecha As Date + Public Property FacturaFecha As Date #End Region + + + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) If TransaccionCompartida Is Nothing Then @@ -240,6 +243,18 @@ Public Class ClsBancos End Sub #End Region + + + Public Function ExisteConeccion() As Boolean + + If SqlTransacc.Connection Is Nothing Then + Return False + Else + Return True + End If + + End Function + Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) With SqlCommand .Parameters.Clear() @@ -1612,18 +1627,21 @@ Public Class ClsBancos With SqlAdapter.SelectCommand.Parameters .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@TerminoCorrecto", SqlDbType.Bit).Direction = ParameterDirection.Output End With Try - SqlAdapter.Fill(Data) - Retorno = True - 'Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 2627;") Then - ' Alert("Ya existe un Banco con el mismo nombre: " & Banco & ".", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If + SqlAdapter.Fill(Data) + + + Retorno = Boolean.Parse(SqlAdapter.SelectCommand.Parameters("@TerminoCorrecto").Value.ToString) + + + 'Catch Ex1 As SqlException + + ' Me.OnError("Ocurrió un error al guardar los cambios en el Banco", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Catch ex As Exception OnError("Ocurrió un error al cancelar el movimiento en bancos.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) End Try diff --git a/Bancos/IE.aspx.vb b/Bancos/IE.aspx.vb index ca4d6bf13..b4a14655d 100644 --- a/Bancos/IE.aspx.vb +++ b/Bancos/IE.aspx.vb @@ -4752,13 +4752,26 @@ Partial Class Bancos_IE End If If Not ErrorCompra Then - Alert("El documento bancario quedó eliminado.", TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") + If ObjAC IsNot Nothing Then ObjAC.Commit() - Banc.Commit() + + If Banc.ExisteConeccion Then + Banc.Commit() + Alert("El documento bancario quedó eliminado.", TipoMensaje.MsgInformacion, "document.location.href=""/Bancos/RepIE.aspx""") + End If + Else + Alert("El documento no ha sido eliminado.", TipoMensaje.MsgAdvertencia) + If ObjAC IsNot Nothing Then ObjAC.RollBack() - Banc.RollBack() + + If Banc.ExisteConeccion Then + Banc.RollBack() + + + End If + End If If ObjAC IsNot Nothing Then ObjAC.Dispose()