Creado Gestión
This commit is contained in:
77
bdAsegasa/Extensiones/correos.cs
Normal file
77
bdAsegasa/Extensiones/correos.cs
Normal file
@@ -0,0 +1,77 @@
|
||||
using Microsoft.VisualBasic;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Diagnostics;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Linq;
|
||||
using System.Net.Mail;
|
||||
using System.Net.Mime;
|
||||
using tsEFCore8.Extensiones;
|
||||
using tsUtilidades.Extensiones;
|
||||
|
||||
namespace bdAsegasa.db
|
||||
{
|
||||
[NotMapped]
|
||||
public partial class correos
|
||||
{
|
||||
[NotMapped]
|
||||
public virtual string FicheroAdjunto
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.idFicheroAdjunto.HasValue)
|
||||
{
|
||||
return this.idFicheroAdjuntoNavigation.NombreFichero;
|
||||
}
|
||||
else
|
||||
{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void GeneraRegistroCorreon(tscgestionasegasa bd, string Asunto, string Cuerpo, bdAsegasa.db.cuentascorreo cuenta, string Destinatario, string ConCopia, string ConCopiaOculta, byte[] FicheroAdjunto = null, string NombreFicheroAdjunto = "", int? idAplicacion = default, string CodigoAplicacion = "", int? idEntidad = default)
|
||||
{
|
||||
try
|
||||
{
|
||||
string sRutaAdjunto = "";
|
||||
var correo = new correos()
|
||||
{
|
||||
Asunto = Asunto,
|
||||
Cuerpo = Cuerpo,
|
||||
Destinatario = Destinatario,
|
||||
Copia = ConCopia,
|
||||
CopiaOculta = ConCopiaOculta,
|
||||
DireccionRespuesta = cuenta.Remitente,
|
||||
FechaCreacion = bd.AhoraMySql(),
|
||||
idcuenta = cuenta.idCuenta,
|
||||
Remitente = cuenta.Remitente,
|
||||
idAplicacion = idAplicacion,
|
||||
CodigoAplicacion = CodigoAplicacion,
|
||||
// idEntidad = idEntidad
|
||||
};
|
||||
//if (bdAsegasa.db.Utilidades.idUsuario > 0)
|
||||
// correo.idUsuario = bdAsegasa.db.Utilidades.idUsuario;
|
||||
bd.correos.Add(correo);
|
||||
if (FicheroAdjunto is not null)
|
||||
{
|
||||
var fi = new bdAsegasa.db.ficheros();
|
||||
fi.Descripcion = "Fichero Adjunto Correo";
|
||||
fi.NombreFichero = NombreFicheroAdjunto;
|
||||
fi.Fichero = FicheroAdjunto;
|
||||
fi.Fecha = DateTime.Now;
|
||||
fi.idTipo = bd.enumeraciones.First(x => x.Codigo == "TIPFIC.ADJCOR").idEnumeracion;
|
||||
correo.idFicheroAdjuntoNavigation = fi;
|
||||
}
|
||||
bd.GuardarCambios();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.Write(ex.Message);
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user