- FIX Utente (CapoareaId null) in Utenti_Edit + IsEliminato == false in ClienteImport
This commit is contained in:
@ -69,22 +69,23 @@
|
||||
model.RagioneSociale = firstRow.RagSocCliente;
|
||||
model.PartitaIva = firstRow.PartitaIva;
|
||||
|
||||
var capoArea = await _managerService.UtenteService.RicercaPer(filtro: x => x.CodiceAgente == firstRow.CapoArea, solaLettura: false) ?? new Utente();
|
||||
var capoArea = await _managerService.UtenteService.RicercaPer(filtro: x => x.CodiceAgente == firstRow.CapoArea && x.Eliminato == false, solaLettura: false) ?? new Utente();
|
||||
capoArea = await mapCapoArea(capoArea, firstRow);
|
||||
if (capoArea.Id == Guid.Empty) capoArea.Password = "";
|
||||
var savedCapoArea = await _managerService.UtenteService.Salva(capoArea, idClaim);
|
||||
model.CapoareaId = savedCapoArea.Id;
|
||||
|
||||
var agente = await _managerService.UtenteService.RicercaPer(filtro: x => x.CodiceAgente == firstRow.Agente, solaLettura: false) ?? new Utente();
|
||||
var agente = await _managerService.UtenteService.RicercaPer(filtro: x => x.CodiceAgente == firstRow.Agente && x.Eliminato == false, solaLettura: false) ?? new Utente();
|
||||
agente = await mapAgente(agente, firstRow, model.CapoareaId);
|
||||
if (agente.Id == Guid.Empty) agente.Password = "";
|
||||
var savedAgente = await _managerService.UtenteService.Salva(agente, idClaim);
|
||||
model.AgenteId = savedAgente.Id;
|
||||
|
||||
// TODO: Problema nel salvataggio delle destinazioni
|
||||
model.Destinazioni ??= new();
|
||||
foreach (var destinazioneRiga in rows)
|
||||
{
|
||||
var destinazione = model.Destinazioni.FirstOrDefault(x => x.Rid == destinazioneRiga.CodCli) ?? new Destinazione();
|
||||
var destinazione = model.Destinazioni.FirstOrDefault(x => x.Rid == destinazioneRiga.CodDes) ?? new Destinazione();
|
||||
destinazione = await mapDestinazione(destinazione, model.Id, destinazioneRiga, model.AgenteId);
|
||||
if (destinazione.Id == Guid.Empty)
|
||||
model.Destinazioni.Add(destinazione);
|
||||
|
||||
@ -154,7 +154,7 @@
|
||||
}
|
||||
|
||||
model.RuoloId = utente.RuoloId;
|
||||
model.CapoareaId = utente.CapoareaId;
|
||||
model.CapoareaId = utente.CapoareaId != Guid.Empty ? utente.CapoareaId : null;
|
||||
|
||||
await _managerService.UtenteService.Salva(model, Guid.Parse(idClaim));
|
||||
_navManager.NavigateTo("/management/Utenti");
|
||||
|
||||
Reference in New Issue
Block a user