diff --git a/Bancos/PagoElectronicoGrupos.aspx.vb b/Bancos/PagoElectronicoGrupos.aspx.vb index 625754b4d..d8e72ec53 100644 --- a/Bancos/PagoElectronicoGrupos.aspx.vb +++ b/Bancos/PagoElectronicoGrupos.aspx.vb @@ -3344,39 +3344,43 @@ Partial Class Bancos_PagoElectronicoGrupos End Sub Private Sub MandaCorreo(Para As String, Asunto As String, Body As String, CveIE As Integer, Comprobante As String, File As Byte()) + Try + Dim Mail As New ClsSisMail() + Para = If(Para IsNot Nothing, Para, "") + Asunto = If(Asunto IsNot Nothing, Asunto, "") + Body = If(Body IsNot Nothing, Body, "") - Dim Mail As New ClsSisMail() - Para = If(Para IsNot Nothing, Para, "") - Asunto = If(Asunto IsNot Nothing, Asunto, "") - Body = If(Body IsNot Nothing, Body, "") - - Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail) - If Comprobante IsNot Nothing AndAlso Comprobante <> "" Then - ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.Ruta = Comprobante}) - End If - - If File IsNot Nothing Then - ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoCuentaCxP.pdf"}) - End If - - Dim separador As Char() = {";"c, ","c} - Dim strArray As String() = Para.Split(separador) - - Para = "" - - For Each sCorreo As String In strArray - If ClsSisMail.IsMailShared(sCorreo) And sCorreo.Trim.Length > 0 Then - Para = $"{Para}{sCorreo};" + Dim ListaArchivos As New List(Of ClsSisMail.ArchivoMail) + If Comprobante IsNot Nothing AndAlso Comprobante <> "" Then + ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.Ruta = Comprobante}) End If - Next - Para = Para.Substring(0, Para.Length - 1) + If File IsNot Nothing Then + ListaArchivos.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoCuentaCxP.pdf"}) + End If + + Dim separador As Char() = {";"c, ","c} + Dim strArray As String() = Para.Split(separador) + + Para = "" + + For Each sCorreo As String In strArray + If ClsSisMail.IsMailShared(sCorreo) And sCorreo.Trim.Length > 0 Then + Para = $"{Para}{sCorreo};" + End If + Next + + Para = Para.Substring(0, Para.Length - 1) + + If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=ListaArchivos, Displayname:=$"SIG Notificaciones: Pago de {UsuarioActual.Empresa.Empresa}") Then + Dim objIE As New ClsBancos + objIE.UpdateBancos_IENotificaciones(1, "-1", "-1", CveIE) + objIE.Dispose() + End If + Catch ex As Exception + OnError("Ocurrio un error al enviar el correo", ex) + End Try - If Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=ListaArchivos, Displayname:=$"SIG Notificaciones: Pago de {UsuarioActual.Empresa.Empresa}") Then - Dim objIE As New ClsBancos - objIE.UpdateBancos_IENotificaciones(1, "-1", "-1", CveIE) - objIE.Dispose() - End If End Sub