136 lines
6.1 KiB
C#
136 lines
6.1 KiB
C#
using GPW.CORE.Dto;
|
|
|
|
namespace GPW.CORE.Data.Mappings
|
|
{
|
|
public static class DailyDataMappingExtensions
|
|
{
|
|
public static DailyDataDto ToDto(this GPW.CORE.Data.DTO.DailyDataDTO model)
|
|
{
|
|
return new DailyDataDto
|
|
{
|
|
IdxDipendente = model.IdxDipendente,
|
|
DtRif = model.DtRif,
|
|
ListRA = model.ListRA?.Select(ra => new RegAttivitaDto
|
|
{
|
|
IdxRa = ra.IdxRa,
|
|
IdxDipendente = ra.IdxDipendente,
|
|
IdxFase = ra.IdxFase,
|
|
Inizio = ra.Inizio,
|
|
Fine = ra.Fine,
|
|
Descrizione = ra.Descrizione,
|
|
OreTot = ra.OreTot,
|
|
Importo = ra.Importo
|
|
}).ToList(),
|
|
ListTimbr = model.ListTimbr?.Select(t => new TimbraturaDto
|
|
{
|
|
DataOra = t.DataOra,
|
|
IdxDipendente = t.IdxDipendente,
|
|
Entrata = t.Entrata,
|
|
CodTipoTimb = t.CodTipoTimb,
|
|
Approv = t.Approv
|
|
}).ToList(),
|
|
TimbrExpl = model.TimbrExpl != null ? new TimbraturaExplDto
|
|
{
|
|
DataLav = model.TimbrExpl.DataLav,
|
|
IdxDipendente = model.TimbrExpl.IdxDipendente,
|
|
CognomeNome = model.TimbrExpl.CognomeNome,
|
|
Entrata1 = model.TimbrExpl.Entrata1,
|
|
Uscita1 = model.TimbrExpl.Uscita1,
|
|
Entrata2 = model.TimbrExpl.Entrata2,
|
|
Uscita2 = model.TimbrExpl.Uscita2,
|
|
Entrata3 = model.TimbrExpl.Entrata3,
|
|
Uscita3 = model.TimbrExpl.Uscita3,
|
|
Entrata4 = model.TimbrExpl.Entrata4,
|
|
Uscita4 = model.TimbrExpl.Uscita4,
|
|
HLav = model.TimbrExpl.HLav,
|
|
MinLav = model.TimbrExpl.MinLav,
|
|
MinOrd = model.TimbrExpl.MinOrd,
|
|
MinNonLav = model.TimbrExpl.MinNonLav,
|
|
MinStra = model.TimbrExpl.MinStra,
|
|
MinPerm = model.TimbrExpl.MinPerm,
|
|
MinFer = model.TimbrExpl.MinFer,
|
|
MinMal = model.TimbrExpl.MinMal,
|
|
MinFest = model.TimbrExpl.MinFest,
|
|
MinCassa = model.TimbrExpl.MinCassa,
|
|
Min104 = model.TimbrExpl.Min104,
|
|
MinMpp = model.TimbrExpl.MinMpp,
|
|
MinArcoPres = model.TimbrExpl.MinArcoPres,
|
|
IsOkTim = model.TimbrExpl.IsOkTim,
|
|
IsOkApp = model.TimbrExpl.IsOkApp,
|
|
Block = model.TimbrExpl.Block,
|
|
ChkFunCod = model.TimbrExpl.ChkFunCod,
|
|
ChkFunRes = model.TimbrExpl.ChkFunRes,
|
|
IsOk = model.TimbrExpl.IsOk,
|
|
IsOkLav = model.TimbrExpl.IsOkLav,
|
|
HGiust = model.TimbrExpl.HGiust,
|
|
TempRil = model.TimbrExpl.TempRil
|
|
} : null,
|
|
ListRilTemp = model.ListRilTemp?.Select(r => new RilievoTempDto
|
|
{
|
|
IdxDipendente = r.IdxDipendente,
|
|
DtRilievo = r.DtRilievo,
|
|
TempRil = r.TempRil
|
|
}).ToList(),
|
|
ListCheckC19 = model.ListCheckC19?.Select(c => new CheckVc19Dto
|
|
{
|
|
IdxCheckVc19 = c.IdxCheckVc19,
|
|
DtCheck = c.DtCheck,
|
|
IdxDipendente = c.IdxDipendente,
|
|
Cognome = c.Cognome,
|
|
Nome = c.Nome,
|
|
Dob = c.Dob,
|
|
Payload = c.Payload
|
|
}).ToList(),
|
|
ListFermateAzienda = model.ListFermateAzienda?.Select(f => new CalFesteFerieDto
|
|
{
|
|
Data = f.data,
|
|
CodGiust = f.codGiust,
|
|
Descrizione = f.descrizione
|
|
}).ToList(),
|
|
ListMalattie = model.ListMalattie?.Select(m => new RegMalattieDto
|
|
{
|
|
IdxRegMal = m.IdxRegMal,
|
|
IdxDipendente = m.IdxDipendente,
|
|
DtInizio = m.DtInizio,
|
|
NumGG = m.NumGG,
|
|
CodCert = m.CodCert,
|
|
Conf = m.Conf
|
|
}).ToList(),
|
|
ListFerieDip = model.ListFerieDip?.Select(r => new RegRichiesteDto
|
|
{
|
|
IdxRegRich = r.IdxRegRich,
|
|
IdxDipendente = r.IdxDipendente,
|
|
CodGiust = r.CodGiust,
|
|
DtStart = r.DtStart,
|
|
DtEnd = r.DtEnd,
|
|
Note = r.Note,
|
|
Conf = r.Conf
|
|
}).ToList(),
|
|
ListRichiesteDip = model.ListRichiesteDip?.Select(r => new RegRichiesteDto
|
|
{
|
|
IdxRegRich = r.IdxRegRich,
|
|
IdxDipendente = r.IdxDipendente,
|
|
CodGiust = r.CodGiust,
|
|
DtStart = r.DtStart,
|
|
DtEnd = r.DtEnd,
|
|
Note = r.Note,
|
|
Conf = r.Conf
|
|
}).ToList()
|
|
};
|
|
}
|
|
|
|
public static GPW.CORE.Data.DTO.DailyDataDTO ToModel(this DailyDataDto dto)
|
|
{
|
|
// Nota: Questa conversione è complessa perché il modello EF (DailyDataDTO)
|
|
// è una struttura aggregata che non esiste direttamente come singola tabella.
|
|
// In un'architettura reale, questa operazione verrebbe fatta tramite un servizio
|
|
// che ricostruisce l'oggetto aggregato partendo dai singoli modelli.
|
|
// Per ora restituiamo un oggetto vuoto o implementiamo solo la parte base
|
|
// se necessario, ma solitamente dal DTO non si torna al modello aggregato EF
|
|
// a meno di operazioni di salvataggio specifico.
|
|
|
|
throw new NotImplementedException("Mapping da DailyDataDto a DailyDataDTO (modello aggregato) non implementato. Questa conversione è solitamente gestita dal servizio tramite i singoli modelli.");
|
|
}
|
|
}
|
|
}
|