Creado Gestión

This commit is contained in:
2026-02-19 08:35:01 +01:00
parent 2d17179401
commit 1da1412c5f
16 changed files with 1109 additions and 25 deletions

View 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;
}
}
}
}

View File

@@ -7,8 +7,8 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.DynamicLinq" Version="8.6.7" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.20" />
<PackageReference Include="Microsoft.EntityFrameworkCore.DynamicLinq" Version="8.7.1" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="8.0.24" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.3" />
<PackageReference Include="PropertyChanged.Fody" Version="4.1.0" />
<PackageReference Include="tsEFCore8" Version="1.0.1" />

View File

@@ -6,6 +6,7 @@ using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;
using tsUtilidades.Enumeraciones;
using System.Drawing.Imaging;
using System.IO;
namespace bdAsegasa.dbcontext
{
@@ -40,8 +41,12 @@ namespace bdAsegasa.dbcontext
var cn = lc.First(x => x.Nombre == NombreConexion);
string servidor = "";
if (Environment.MachineName.ToUpper() == "VISDIG1")
servidor = "localhost";
if (Directory.Exists("c:\\tecnosis.tfs")) {
servidor = "sevilla.asegasa.com";
}
//if (Environment.MachineName.ToUpper() == "VISDIG1")
else
{
servidor = cn.Servidor;