Files
Antifraude.Net/Antifraude.Net/SwaggerAntifraude/Servicios/ServicioFormularios.cs
2025-10-24 08:46:31 +02:00

820 lines
37 KiB
C#

using bdAntifraude.db;
using bdAntifraude.dbcontext;
using bdAntifraude.DatRecTri;
namespace SwaggerAntifraude.Servicios
{
public class ServicioFormularios
{
public byte[] GenerarFormulario(
string claveFormulario,
string idPersona,
string Motivo,
string texto1,
string texto2,
string FechaEfecto,
string Organo,
string FechaEmision,
string Extra)
{
switch (claveFormulario)
{
case "TomPos":
return DevuelveTomaPosesion(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision);
case "CumTri":
return DevuelveCumplimientoTrienios(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision, "RECTRI");
case "SolTri":
return DevuelveCumplimientoTrienios(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision, "SOLTRI");
case "ComInt":
return DevuelveComunicacionInterna(idPersona, texto1, texto2, FechaEmision);
case "AcuJub":
return DevuelveAcuerdoJubilacion(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision, Extra);
case "AcuBaj":
return DevuelveAcuerdoBaja(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision);
case "AcuCes":
return DevuelveAcuerdoCese(idPersona, Motivo, texto1, FechaEfecto, Organo, FechaEmision);
case "ConGra":
return DevuelveConsolidacionGrado(idPersona, Motivo, texto1, texto2, FechaEfecto, Organo, FechaEmision);
default:
return null;
}
}
private byte[] DevuelveTomaPosesion(
string idPersona,
string motivo,
string texto1,
string fechaEfecto,
string organo,
string fechaEmision)
{
try
{
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false))
{
PERSONAS per = new PERSONAS();
var LisTomPos = new List<bdAntifraude.DatRecTri.RecTri>();
var ForTomPos = new bdAntifraude.DatRecTri.RecTri();
if (!string.IsNullOrEmpty(idPersona))
{
int iDPer = Convert.ToInt32(idPersona);
per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
ForTomPos.Nif = per.NIF;
ForTomPos.Apellidos = per.APELLIDOS;
ForTomPos.Nombre = per.NOMBRE;
ForTomPos.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
ForTomPos.NRP = per.NRP;
if (per.IDSITUACIONADMINISTRATIVARPT != null)
ForTomPos.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
if (per.IDCUERPORPT != null)
ForTomPos.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
ForTomPos.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
PUESTOS PuestoTrabajo = null;
var puestosPersona = context.PUESTOS.Where(x => x.IDPERSONAL == per.IDPERSONA);
if (puestosPersona.Any())
{
PuestoTrabajo = puestosPersona
.OrderByDescending(x => x.IDRPTNavigation.F_PARLAMENTO.Value)
.First();
ForTomPos.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
}
if (per.DEPARTAMENTOACTUAL != null)
ForTomPos.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
if (PuestoTrabajo != null)
{
ForTomPos.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
ForTomPos.ComEsp = Especifico.ToString("##,##0.00") + "€";
ForTomPos.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
ForTomPos.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
ForTomPos.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
}
ForTomPos.MotivoTomaPosesion = motivo;
ForTomPos.texto1 = texto1;
ForTomPos.FechaEfectoTomaPosesion = fechaEfecto;
ForTomPos.OrganoCompetente = organo;
ForTomPos.FechaEmision = fechaEmision;
}
LisTomPos.Add(ForTomPos);
var pl = context.PLANTILLAS.First(x => x.CODIGO == "TOMPOS");
var idPlantilla = pl.IDPLANTILLA;
var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
return tsWPFCore.tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisTomPos).ToArray();
}
}
catch (Exception ex)
{
return null;
}
}
private byte[] DevuelveCumplimientoTrienios(
string idPersona,
string motivo,
string texto1,
string fechaEfecto,
string organo,
string fechaEmision,
string Tipo)
{
try
{
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false))
{
PERSONAS per=null;
var LisCumTri = new List<bdAntifraude.DatRecTri.RecTri>();
var ForCumTri = new bdAntifraude.DatRecTri.RecTri();
if (!string.IsNullOrEmpty(idPersona))
{
int iDPer = Convert.ToInt32(idPersona);
per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
ForCumTri.Nif = per.NIF;
ForCumTri.Apellidos = per.APELLIDOS;
ForCumTri.Nombre = per.NOMBRE;
ForCumTri.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
ForCumTri.NRP = per.NRP;
if (per.IDSITUACIONADMINISTRATIVARPT != null)
ForCumTri.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
if (per.IDCUERPORPT != null)
ForCumTri.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
ForCumTri.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
ForCumTri.Localidad = per.NombrePoblacion;
ForCumTri.Provincia = per.NombreProvincia;
PUESTOS PuestoTrabajo = null;
var iDSitRptAct = context.ENUMERACIONES.First(x => x.CODIGO == "SITRPTMAESTRO.ACT").IDENUMERACION;
var puestosActivos = context.PUESTOS
.Where(x => x.IDPERSONAL == per.IDPERSONA && x.IDRPTNavigation.IDSITUACION == iDSitRptAct);
if (puestosActivos.Any())
{
PuestoTrabajo = puestosActivos.First();
ForCumTri.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
}
if (per.FECHACUMPLIMIENTOPROXTRIENIO.HasValue)
{
//Truncamos la fecha a los primeros 10 caracteres
var fechaProx = per.FECHACUMPLIMIENTOPROXTRIENIO.Value;
ForCumTri.FecVenTri = fechaProx.ToString("yyyy-MM-dd").Substring(0, 10);
if (fechaProx.Day == 1)
{
ForCumTri.FechaEfeEco = fechaProx.ToString("yyyy-MM-dd").Substring(0, 10);
}
else
{
var Fechaefe = fechaProx.AddMonths(1);
var primerDiaMesSiguiente = new DateTime(Fechaefe.Year, Fechaefe.Month, 1);
ForCumTri.FechaEfeEco = primerDiaMesSiguiente.ToString("yyyy-MM-dd").Substring(0, 10);
}
ForCumTri.FecCumProTri = fechaProx.AddYears(3).ToString("yyyy-MM-dd").Substring(0, 10);
}
//Calcular trienios
if (per.TRIENIOS.Any())
{
foreach (var trienio in per.TRIENIOS.ToList())
{
var grupoTrim = trienio.GRUPO.Trim();
switch (grupoTrim)
{
case "A1":
case "I":
ForCumTri.TriA1 = trienio.TC;
if (per.GRUPOFUNCIONARIODESCRIPCION == "A1")
ForCumTri.TriA1 = (int)(trienio.TC + trienio.TOA + 1);
break;
case "A2":
case "II":
ForCumTri.TriA2 = trienio.TC;
if (per.GRUPOFUNCIONARIODESCRIPCION == "A2")
ForCumTri.TriA2 = trienio.TC + trienio.TOA + 1;
break;
case "C1":
case "III":
ForCumTri.TriC1 = trienio.TC;
if (per.GRUPOFUNCIONARIODESCRIPCION == "C1")
ForCumTri.TriC1 = trienio.TC + trienio.TOA + 1;
break;
case "C2":
case "IV":
ForCumTri.TriC2 = trienio.TC;
if (per.GRUPOFUNCIONARIODESCRIPCION == "C2")
ForCumTri.TriC2 = trienio.TC + trienio.TOA + 1;
break;
case "E":
case "V":
ForCumTri.TriE = trienio.TC;
if (per.GRUPOFUNCIONARIODESCRIPCION == "E")
ForCumTri.TriE = trienio.TC + trienio.TOA + 1;
break;
}
}
}
else
{
//No hay trienios, se asigna 1 según el grupo
if (!string.IsNullOrWhiteSpace(per.GRUPOFUNCIONARIODESCRIPCION))
{
switch (per.GRUPOFUNCIONARIODESCRIPCION.Trim())
{
case "A1":
ForCumTri.TriA1 = 1;
break;
case "A2":
ForCumTri.TriA2 = 1;
break;
case "C1":
ForCumTri.TriC1 = 1;
break;
case "C2":
ForCumTri.TriC2 = 1;
break;
case "E":
ForCumTri.TriE = 1;
break;
}
}
else if (PuestoTrabajo != null)
{
//Si no hay grupo en persona, se toma del puesto de trabajo
var grupoPT = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1.Trim();
switch (grupoPT)
{
case "A1":
ForCumTri.TriA1 = 1;
break;
case "A2":
ForCumTri.TriA2 = 1;
break;
case "C1":
ForCumTri.TriC1 = 1;
break;
case "C2":
ForCumTri.TriC2 = 1;
break;
case "E":
ForCumTri.TriE = 1;
break;
}
}
}
//Departamento y otros datos del puesto
if (PuestoTrabajo != null)
{
ForCumTri.Departamento = PuestoTrabajo.IDRPTDESNavigation.DEPARTAMENTO;
ForCumTri.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
ForCumTri.ComEsp = Especifico.ToString("##,##0.00") + "€";
ForCumTri.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
ForCumTri.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
if (per.NIVEL != null)
ForCumTri.Nivel = per.IDNIVELRPTNavigation.NIVEL1;
ForCumTri.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
}
ForCumTri.MotivoTomaPosesion = motivo;
ForCumTri.texto1 = texto1;
if (!string.IsNullOrEmpty(fechaEfecto) && fechaEfecto.Length >= 10)
ForCumTri.FechaEfectoTomaPosesion = fechaEfecto.Substring(0, 10);
ForCumTri.OrganoCompetente = organo;
ForCumTri.FechaEmision = fechaEmision;
ForCumTri.TolTri = per.TRIENIOS.Sum(x => x.TC) + per.TRIENIOS.Sum(x => x.TOA);
ForCumTri.texto1 = (ForCumTri.TolTri + 1).ToString();
if (per.FECHACUMPLIMIENTOPROXTRIENIO.HasValue)
{
var fechaProx = per.FECHACUMPLIMIENTOPROXTRIENIO.Value;
ForCumTri.texto2 = fechaProx.Day.ToString().PadLeft(2, '0') + " de " +
tsUtilidades.Extensiones.DateTimeExtensions.MesCastellano(fechaProx) + " de " +
fechaProx.Year.ToString();
}
}
LisCumTri.Add(ForCumTri);
if (per != null && per.IDADSCRIPCIONRPTNavigation.DESCRIPCION == "LABORAL")
{
switch (ForCumTri.Grupo)
{
case "A1":
ForCumTri.Grupo = "I";
break;
case "A2":
ForCumTri.Grupo = "II";
break;
case "C1":
ForCumTri.Grupo = "III";
break;
case "C2":
ForCumTri.Grupo = "IV";
break;
case "E":
ForCumTri.Grupo = "V";
break;
}
}
PLANTILLAS pl;
if (Tipo == "RECTRI")
{
pl = context.PLANTILLAS.First(x => x.CODIGO == "RECTRI");
if (per.IDADSCRIPCIONRPTNavigation.DESCRIPCION == "LABORAL")
pl = context.PLANTILLAS.First(x => x.CODIGO == "RECTRIL");
}
else
{
pl = context.PLANTILLAS.First(x => x.CODIGO == "RECTRI4");
if (per.IDADSCRIPCIONRPTNavigation.DESCRIPCION == "LABORAL")
pl = context.PLANTILLAS.First(x => x.CODIGO == "RECTRI4L");
}
var idPlantilla = pl.IDPLANTILLA;
var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
return tsWPFCore.tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisCumTri).ToArray();
}
}
catch (Exception ex)
{
return null;
}
}
private byte[] DevuelveComunicacionInterna(
string idPersona,
string texto1,
string texto2,
string fechaEmision)
{
try
{
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false))
{
PERSONAS per;
var LisCumTri = new List<bdAntifraude.DatRecTri.RecTri>();
var ForCumTri = new bdAntifraude.DatRecTri.RecTri();
if (!string.IsNullOrEmpty(idPersona))
{
int iDPer = Convert.ToInt32(idPersona);
per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
ForCumTri.Nif = per.NIF;
ForCumTri.Apellidos = per.APELLIDOS;
ForCumTri.Nombre = per.NOMBRE;
ForCumTri.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
ForCumTri.NRP = per.NRP;
if (per.IDSITUACIONADMINISTRATIVARPT != null)
ForCumTri.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
if (per.IDCUERPORPT != null)
ForCumTri.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
ForCumTri.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
ForCumTri.Localidad = per.NombrePoblacion;
ForCumTri.Provincia = per.NombreProvincia;
if (per.IDDEPARTAMENTO != null)
ForCumTri.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
ForCumTri.FechaEmision = fechaEmision;
ForCumTri.texto1 = texto1;
ForCumTri.texto2 = texto2;
}
LisCumTri.Add(ForCumTri);
var pl = context.PLANTILLAS.First(x => x.CODIGO == "COMUNI");
var idPlantilla = pl.IDPLANTILLA;
var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
return tsWPFCore.tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisCumTri).ToArray();
}
}
catch (Exception ex)
{
return null;
}
}
private byte[] DevuelveAcuerdoJubilacion(
string idPersona,
string motivo,
string texto1,
string fechaEfecto,
string organo,
string fechaEmision,
string fechaEfe)
{
try
{
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false))
{
var LisAcuJub = new List<RecTri>();
var ForAcuJub = new RecTri();
if (!string.IsNullOrEmpty(idPersona))
{
int iDPer = Convert.ToInt32(idPersona);
var per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
int Años = 0;
if (per.TRIENIOS.Any())
{
Años = (int)per.TRIENIOS.Sum(x => x.TC + x.TOA) * 3;
}
var Fechafin = tsUtilidades.Extensiones.DateTimeExtensions.FechaHoraStringADate(fechaEfe);
if (per.FECHACUMPLIMIENTOPROXTRIENIO.HasValue && Fechafin.HasValue)
{
var TiemSer = bdAntifraude.Utilidades.AnosMesesDias(per.FECHACUMPLIMIENTOPROXTRIENIO.Value.AddYears(-3), Fechafin.Value);
if (TiemSer != null)
{
TiemSer.Anos += Años;
//Construcción del texto1 según años, meses, días
string tiempo = "";
if (TiemSer.Anos == 1) tiempo += TiemSer.Anos.ToString() + " AÑO ";
else if (TiemSer.Anos > 1) tiempo += TiemSer.Anos.ToString() + " AÑOS ";
if (TiemSer.Meses == 1) tiempo += TiemSer.Meses.ToString() + " MES ";
else if (TiemSer.Meses > 1) tiempo += TiemSer.Meses.ToString() + " MESES ";
if (TiemSer.Dias == 1) tiempo += TiemSer.Dias.ToString() + " DIA ";
else if (TiemSer.Dias > 1) tiempo += TiemSer.Dias.ToString() + " DIAS ";
ForAcuJub.texto1 = tiempo.Trim();
}
}
ForAcuJub.Nif = per.NIF;
ForAcuJub.Apellidos = per.APELLIDOS;
ForAcuJub.Nombre = per.NOMBRE;
ForAcuJub.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
ForAcuJub.NRP = per.NRP;
if (per.IDSITUACIONADMINISTRATIVARPT != null)
ForAcuJub.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
if (per.IDCUERPORPT != null)
ForAcuJub.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
ForAcuJub.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
var puestosPersona = context.PUESTOS.Where(x => x.IDPERSONAL == per.IDPERSONA);
PUESTOS PuestoTrabajo = null;
if (puestosPersona.Any())
{
PuestoTrabajo = puestosPersona
.OrderByDescending(x => x.IDRPTNavigation.F_PARLAMENTO.Value)
.First();
ForAcuJub.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
}
if (per.IDDEPARTAMENTO != null)
ForAcuJub.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
if (PuestoTrabajo != null)
{
ForAcuJub.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
ForAcuJub.ComEsp = Especifico.ToString("##,##0.00") + "€";
ForAcuJub.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
ForAcuJub.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
ForAcuJub.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
}
ForAcuJub.MotivoTomaPosesion = motivo;
ForAcuJub.texto3 = motivo;
if (per.FECHANACIMIENTO.HasValue)
{
var fechaNac = per.FECHANACIMIENTO.Value;
string dia = fechaNac.Day.ToString().PadLeft(2, '0');
string mes = tsUtilidades.Extensiones.DateTimeExtensions.MesCastellano(fechaNac);
string anio = fechaNac.Year.ToString();
ForAcuJub.FecVenTri = $"{dia} de {mes} de {anio}";
}
ForAcuJub.FechaEfeEco = fechaEfecto;
ForAcuJub.OrganoCompetente = organo;
}
LisAcuJub.Add(ForAcuJub);
var pl = context.PLANTILLAS.First(x => x.CODIGO == "ACUJUBI");
var idPlantilla = pl.IDPLANTILLA;
var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
return tsWPFCore.tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisAcuJub).ToArray();
}
}
catch (Exception ex)
{
return null;
}
}
private byte[] DevuelveAcuerdoBaja(
string idPersona,
string motivo,
string texto1,
string fechaEfecto,
string organo,
string fechaEmision)
{
try
{
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false))
{
PERSONAS per;
var LisAcuJub = new List<RecTri>();
var ForAcuJub = new RecTri();
if (!string.IsNullOrEmpty(idPersona))
{
int iDPer = Convert.ToInt32(idPersona);
per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
ForAcuJub.Nif = per.NIF;
ForAcuJub.Apellidos = per.APELLIDOS;
ForAcuJub.Nombre = per.NOMBRE;
ForAcuJub.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
ForAcuJub.NRP = per.NRP;
if (per.IDSITUACIONADMINISTRATIVARPT != null)
ForAcuJub.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
if (per.IDCUERPORPT != null)
ForAcuJub.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
ForAcuJub.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
PUESTOS PuestoTrabajo = null;
var puestosPersona = context.PUESTOS.Where(x => x.IDPERSONAL == per.IDPERSONA);
if (puestosPersona.Any())
{
PuestoTrabajo = puestosPersona
.OrderByDescending(x => x.IDRPTNavigation.F_PARLAMENTO.Value)
.First();
ForAcuJub.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
if (per.IDDEPARTAMENTO != null)
ForAcuJub.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
ForAcuJub.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
ForAcuJub.ComEsp = Especifico.ToString("##,##0.00") + "€";
ForAcuJub.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
ForAcuJub.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
ForAcuJub.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
}
ForAcuJub.MotivoTomaPosesion = motivo;
ForAcuJub.texto1 = texto1;
ForAcuJub.FechaEfectoTomaPosesion = fechaEfecto;
ForAcuJub.FechaEfeEco = fechaEfecto;
ForAcuJub.OrganoCompetente = organo;
ForAcuJub.FecVenTri = fechaEmision;
}
LisAcuJub.Add(ForAcuJub);
var pl = context.PLANTILLAS.First(x => x.CODIGO == "ACUBAJA");
var idPlantilla = pl.IDPLANTILLA;
var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
return tsWPFCore.tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisAcuJub).ToArray();
}
}
catch (Exception)
{
return null;
}
}
private byte[] DevuelveAcuerdoCese(
string idPersona,
string motivo,
string texto1,
string fechaEfecto,
string organo,
string fechaEmision)
{
try
{
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false))
{
PERSONAS per;
var LisAcuJub = new List<RecTri>();
var ForAcuJub = new RecTri();
if (!string.IsNullOrEmpty(idPersona))
{
int iDPer = Convert.ToInt32(idPersona);
per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
ForAcuJub.Nif = per.NIF;
ForAcuJub.Apellidos = per.APELLIDOS;
ForAcuJub.Nombre = per.NOMBRE;
ForAcuJub.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
ForAcuJub.NRP = per.NRP;
if (per.IDSITUACIONADMINISTRATIVARPT != null)
ForAcuJub.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
if (per.IDCUERPORPT != null)
ForAcuJub.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
ForAcuJub.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
PUESTOS PuestoTrabajo = null;
var puestosPersona = context.PUESTOS.Where(x => x.IDPERSONAL == per.IDPERSONA);
if (puestosPersona.Any())
{
PuestoTrabajo = puestosPersona
.OrderByDescending(x => x.IDRPTNavigation.F_PARLAMENTO.Value)
.First();
ForAcuJub.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
}
if (per.IDDEPARTAMENTO != null)
ForAcuJub.Departamento = per.IDDEPARTAMENTONavigation.DESCRIPCION;
if (PuestoTrabajo != null)
{
ForAcuJub.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
ForAcuJub.ComEsp = Especifico.ToString("##,##0.00") + "€";
ForAcuJub.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
ForAcuJub.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
ForAcuJub.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
}
ForAcuJub.MotivoTomaPosesion = motivo;
ForAcuJub.texto1 = texto1;
ForAcuJub.FechaEfectoTomaPosesion = fechaEfecto;
ForAcuJub.FechaEfeEco = fechaEfecto;
ForAcuJub.OrganoCompetente = organo;
ForAcuJub.FecVenTri = fechaEmision;
}
LisAcuJub.Add(ForAcuJub);
var pl = context.PLANTILLAS.First(x => x.CODIGO == "ACUCESE");
var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
return tsWPFCore.tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisAcuJub).ToArray();
}
}
catch (Exception)
{
return null;
}
}
private byte[] DevuelveConsolidacionGrado(
string idPersona,
string motivo,
string texto1,
string texto2,
string fechaEfecto,
string organo,
string fechaEmision)
{
try
{
using (var context = tsGestionAntifraude.NuevoContexto(SoloLectura: true, UseLazyLoadingProxies: false))
{
PERSONAS per;
var LisCumTri = new List<RecTri>();
var ForCumTri = new RecTri();
if (!string.IsNullOrEmpty(idPersona))
{
int iDPer = Convert.ToInt32(idPersona);
per = context.PERSONAS.First(x => x.IDPERSONA == iDPer);
ForCumTri.Nif = per.NIF;
ForCumTri.Apellidos = per.APELLIDOS;
ForCumTri.Nombre = per.NOMBRE;
ForCumTri.Adscripcion = per.IDADSCRIPCIONRPTNavigation.DESCRIPCION;
ForCumTri.NRP = per.NRP;
if (per.IDSITUACIONADMINISTRATIVARPT != null)
ForCumTri.SitAdm = per.IDSITUACIONADMINISTRATIVARPTNavigation.LITERAL_SITUACION;
if (per.IDCUERPORPT != null)
ForCumTri.Cuerpo = per.IDCUERPORPTNavigation.DESCRIPCION;
ForCumTri.Grupo = per.GRUPOFUNCIONARIODESCRIPCION;
ForCumTri.Localidad = per.NombrePoblacion;
ForCumTri.Provincia = per.NombreProvincia;
var iDSitRptAct = context.ENUMERACIONES.First(x => x.CODIGO == "SITRPTMAESTRO.ACT").IDENUMERACION;
PUESTOS PuestoTrabajo = null;
var puestoActivo = context.PUESTOS
.Where(x => x.IDPERSONAL == per.IDPERSONA && x.IDRPTNavigation.IDSITUACION == iDSitRptAct);
if (puestoActivo.Any())
{
PuestoTrabajo = puestoActivo.First();
ForCumTri.DesPuesTrab = PuestoTrabajo.IDRPTDESNavigation.DENOMINACION;
}
ForCumTri.FechaEfeEco = fechaEfecto;
if (PuestoTrabajo != null)
{
ForCumTri.CuerpoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.CUERPO1Navigation.DESCRIPCION;
double Especifico = double.Parse(PuestoTrabajo.IDRPTDESNavigation.ESPECIFICO.ToString());
ForCumTri.ComEsp = Especifico.ToString("##,##0.00") + "€";
ForCumTri.GrupoPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.GRUPO1Navigation.GRUPO1;
ForCumTri.NivelPuestoTrabajo = PuestoTrabajo.IDRPTDESNavigation.IDNIVEL_RPTNavigation.NIVEL1;
ForCumTri.CarOcu = PuestoTrabajo.IDOCUPACIONNavigation.DESCRIPCION;
}
ForCumTri.texto1 = texto1;
ForCumTri.texto2 = texto2;
ForCumTri.texto3 = motivo;
}
LisCumTri.Add(ForCumTri);
var pl = context.PLANTILLAS.First(x => x.CODIGO == "CONGRA");
var idPlantilla = pl.IDPLANTILLA;
var sFicherohtmlTmp = tsUtilidades.Utilidades.ObtieneFicheroAleatorio("pdf");
return tsWPFCore.tsXtraReport.ExportarAPDF(pl.IDFICHERONavigation.FICHERO, LisCumTri).ToArray();
}
}
catch (Exception)
{
return null;
}
}
}
}