agregado procesos y bd clases

This commit is contained in:
2026-04-28 11:52:16 +02:00
parent 59a774c397
commit cd2e8b8530
251 changed files with 56881 additions and 49 deletions

View File

@@ -0,0 +1,67 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Security.Cryptography;
using System.Text;
namespace bdAsegasa.db
{
public partial class ficheros
{
public string idFicheroEnc
{
get
{
string idStr = this.idFichero.ToString().PadLeft(8, '0');
using (SHA1 sha1 = SHA1.Create())
{
byte[] hash = sha1.ComputeHash(Encoding.ASCII.GetBytes("ASEGASa" + idStr));
string dc = hash[0].ToString("x2");
// Using tsUtilidades for encryption
return tsUtilidades.crypt.FEncS(idStr + dc, "1973122213","",0);
}
}
}
public static int ObtieneidFichero(string idEncriptado)
{
try
{
string idcdc = tsUtilidades.crypt.FEncS(idEncriptado, "1973122213","",0);
if (idcdc.Length < 10) return 0;
string idr = idcdc.Substring(0, 8);
string dc = idcdc.Substring(8, 2);
using (SHA1 sha1 = SHA1.Create())
{
byte[] hash = sha1.ComputeHash(Encoding.ASCII.GetBytes("ASEGASa" + idr));
if (hash[0].ToString("x2") != dc) return 0;
return int.Parse(idr);
}
}
catch
{
return 0;
}
}
}
public class vr_ficheros
{
public int idFichero { get; set; }
public string NombreFichero { get; set; }
public DateTime Fecha { get; set; }
public string Descripcion { get; set; }
public static List<vr_ficheros> Obtiene_vr_ficheros(IQueryable<ficheros> iqFicheros)
{
return iqFicheros.Select(x => new vr_ficheros
{
idFichero = x.idFichero,
NombreFichero = x.NombreFichero,
Fecha = (DateTime)x.Fecha,
Descripcion = x.Descripcion
}).ToList();
}
}
}