Ancora pulizia codice da campi nullable
This commit is contained in:
@@ -243,45 +243,51 @@ namespace GPW.CORE.WRKLOG.Components
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private List<CORE.Data.DbModels.RegAttivitaModel> ListRegAtt()
|
||||
private List<RegAttivitaModel> ListRegAtt()
|
||||
{
|
||||
// init
|
||||
DateTime currHour = DayDTO.DtRif.AddHours(StartHour);
|
||||
DateTime lastHour = DayDTO.DtRif.AddHours(EndHour);
|
||||
List<CORE.Data.DbModels.RegAttivitaModel> result = new List<CORE.Data.DbModels.RegAttivitaModel>();
|
||||
// ciclo partendo dal primo evento ed aggiungendo eventuali periodi in testa / coda / intermedi
|
||||
foreach (var item in DayDTO.ListRA)
|
||||
List<RegAttivitaModel> result = new List<RegAttivitaModel>();
|
||||
if (DayDTO != null)
|
||||
{
|
||||
// se evento > ora corrente --> aggiungo vuoto...
|
||||
if (item.Inizio > currHour)
|
||||
DateTime currHour = DayDTO.DtRif.AddHours(StartHour);
|
||||
DateTime lastHour = DayDTO.DtRif.AddHours(EndHour);
|
||||
// ciclo partendo dal primo evento ed aggiungendo eventuali periodi in testa / coda / intermedi
|
||||
if (DayDTO.ListRA != null)
|
||||
{
|
||||
CORE.Data.DbModels.RegAttivitaModel? newItem = new CORE.Data.DbModels.RegAttivitaModel()
|
||||
foreach (var item in DayDTO.ListRA)
|
||||
{
|
||||
// se evento > ora corrente --> aggiungo vuoto...
|
||||
if (item.Inizio > currHour)
|
||||
{
|
||||
CORE.Data.DbModels.RegAttivitaModel? newItem = new CORE.Data.DbModels.RegAttivitaModel()
|
||||
{
|
||||
Inizio = currHour,
|
||||
IdxFase = 0,
|
||||
Descrizione = "-",
|
||||
Fine = item.Inizio,
|
||||
OreTot = (decimal)item.Inizio.Subtract(currHour).TotalHours
|
||||
};
|
||||
result.Add(newItem);
|
||||
}
|
||||
|
||||
// ...altrimenti parto con lui...
|
||||
result.Add(item);
|
||||
currHour = item.Fine;
|
||||
}
|
||||
}
|
||||
// se non sono in fondo --> aggiungo!
|
||||
if (currHour < lastHour)
|
||||
{
|
||||
RegAttivitaModel? newItem = new RegAttivitaModel()
|
||||
{
|
||||
Inizio = currHour,
|
||||
IdxFase = 0,
|
||||
Descrizione = "-",
|
||||
Fine = item.Inizio,
|
||||
OreTot = (decimal)item.Inizio.Subtract(currHour).TotalHours
|
||||
Fine = lastHour,
|
||||
OreTot = (decimal)lastHour.Subtract(currHour).TotalHours
|
||||
};
|
||||
result.Add(newItem);
|
||||
}
|
||||
|
||||
// ...altrimenti parto con lui...
|
||||
result.Add(item);
|
||||
currHour = item.Fine;
|
||||
}
|
||||
// se non sono in fondo --> aggiungo!
|
||||
if (currHour < lastHour)
|
||||
{
|
||||
CORE.Data.DbModels.RegAttivitaModel? newItem = new CORE.Data.DbModels.RegAttivitaModel()
|
||||
{
|
||||
Inizio = currHour,
|
||||
IdxFase = 0,
|
||||
Descrizione = "-",
|
||||
Fine = lastHour,
|
||||
OreTot = (decimal)lastHour.Subtract(currHour).TotalHours
|
||||
};
|
||||
result.Add(newItem);
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<div class="px-1 bg-dark">
|
||||
<span>@CurrPeriodo.Inizio.ToString("HH:mm")</span>
|
||||
</div>
|
||||
@if (CurrPeriodo.IsClosed)
|
||||
@if (CurrPeriodo.IsClosed && CurrPeriodo.OreTot != null)
|
||||
{
|
||||
@if ((double)CurrPeriodo.OreTot >= 1.25)
|
||||
{
|
||||
|
||||
@@ -185,7 +185,7 @@ else
|
||||
bool answ = !VetoProj;
|
||||
if (CalcOreFasi != null)
|
||||
{
|
||||
if (!(bool)CalcOreFasi.Attivo)
|
||||
if (CalcOreFasi.Attivo!=null && !(bool)CalcOreFasi.Attivo)
|
||||
{
|
||||
if (VetoInsert)
|
||||
{
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace GPW.CORE.WRKLOG.Components
|
||||
|
||||
|
||||
[Inject]
|
||||
protected GpwDataService GDataServ { get; set; }
|
||||
protected GpwDataService GDataServ { get; set; } = null!;
|
||||
|
||||
protected bool IsUscita { get; set; } = false;
|
||||
|
||||
@@ -107,6 +107,10 @@ namespace GPW.CORE.WRKLOG.Components
|
||||
|
||||
// aggiungo alla lista...
|
||||
ListTimb.Add(currRecord);
|
||||
if (ListTimbRich == null)
|
||||
{
|
||||
ListTimbRich = new List<TimbratureModel>();
|
||||
}
|
||||
ListTimbRich.Add(currRecord);
|
||||
|
||||
|
||||
@@ -137,14 +141,19 @@ namespace GPW.CORE.WRKLOG.Components
|
||||
|
||||
// elimino dalla lista...
|
||||
ListTimb.Remove(currRecord);
|
||||
if (ListTimbAppr.Contains(currRecord))
|
||||
if (ListTimbAppr != null)
|
||||
{
|
||||
ListTimbAppr.Remove(currRecord);
|
||||
if (ListTimbAppr.Contains(currRecord))
|
||||
{
|
||||
ListTimbAppr.Remove(currRecord);
|
||||
}
|
||||
}
|
||||
|
||||
if (ListTimbRich.Contains(currRecord))
|
||||
if (ListTimbRich != null)
|
||||
{
|
||||
ListTimbRich.Remove(currRecord);
|
||||
if (ListTimbRich.Contains(currRecord))
|
||||
{
|
||||
ListTimbRich.Remove(currRecord);
|
||||
}
|
||||
}
|
||||
|
||||
// aggiorno
|
||||
|
||||
@@ -383,7 +383,11 @@ namespace GPW.CORE.WRKLOG.Data
|
||||
var rawData = await AnagProjAll();
|
||||
if (rawData != null)
|
||||
{
|
||||
dbResult = rawData.FirstOrDefault(x => x.IdxProgetto == idxProj);
|
||||
var foundData = rawData.Where(x => x.IdxProgetto == idxProj).FirstOrDefault();
|
||||
if (foundData != null)
|
||||
{
|
||||
dbResult = foundData;
|
||||
}
|
||||
}
|
||||
|
||||
return await Task.FromResult(dbResult);
|
||||
|
||||
@@ -116,8 +116,8 @@
|
||||
{
|
||||
isLoading = true;
|
||||
DateTime oggi = DateTime.Today;
|
||||
var rawData=await GDataServ.DailyDetails(idxDipendente, oggi, oggi.AddDays(1));
|
||||
ListRecords = rawData.Where(x=> x.DtRif==oggi).ToList();
|
||||
var rawData = await GDataServ.DailyDetails(idxDipendente, oggi, oggi.AddDays(1));
|
||||
ListRecords = rawData.Where(x => x.DtRif == oggi).ToList();
|
||||
await Task.Delay(100);
|
||||
checkHourRange();
|
||||
await Task.Delay(100);
|
||||
@@ -139,46 +139,61 @@
|
||||
// per ogni giornata
|
||||
foreach (var giornata in ListRecords)
|
||||
{
|
||||
var minRecTimb = giornata.ListTimbr
|
||||
.Where(x => x.Entrata == true)
|
||||
.OrderBy(x => x.DataOra)
|
||||
.FirstOrDefault();
|
||||
if (minRecTimb != null)
|
||||
if (giornata.ListTimbr != null)
|
||||
{
|
||||
if (minHour > minRecTimb.DataOra.AddMinutes(-roundMin).Hour)
|
||||
var minRecTimb = giornata.ListTimbr
|
||||
.Where(x => x.Entrata == true)
|
||||
.OrderBy(x => x.DataOra)
|
||||
.FirstOrDefault();
|
||||
if (minRecTimb != null)
|
||||
{
|
||||
minHour = minRecTimb.DataOra.AddMinutes(-roundMin).Hour;
|
||||
if (minHour > minRecTimb.DataOra.AddMinutes(-roundMin).Hour)
|
||||
{
|
||||
minHour = minRecTimb.DataOra.AddMinutes(-roundMin).Hour;
|
||||
}
|
||||
}
|
||||
}
|
||||
var minRecRa = giornata.ListRA
|
||||
.OrderBy(x => x.Inizio)
|
||||
.FirstOrDefault();
|
||||
if (minRecRa != null)
|
||||
|
||||
if (giornata.ListRA != null)
|
||||
{
|
||||
if (minHour > minRecRa.Inizio.AddMinutes(-roundMin).Hour)
|
||||
var minRecRa = giornata.ListRA
|
||||
.OrderBy(x => x.Inizio)
|
||||
.FirstOrDefault();
|
||||
if (minRecRa != null)
|
||||
{
|
||||
minHour = minRecRa.Inizio.AddMinutes(-roundMin).Hour;
|
||||
if (minHour > minRecRa.Inizio.AddMinutes(-roundMin).Hour)
|
||||
{
|
||||
minHour = minRecRa.Inizio.AddMinutes(-roundMin).Hour;
|
||||
}
|
||||
}
|
||||
}
|
||||
var maxRecTimb = giornata.ListTimbr
|
||||
.Where(x => x.Entrata == false)
|
||||
.OrderByDescending(x => x.DataOra)
|
||||
.FirstOrDefault();
|
||||
if (maxRecTimb != null)
|
||||
|
||||
if (giornata.ListTimbr != null)
|
||||
{
|
||||
if (maxHour < maxRecTimb.DataOra.AddMinutes(roundMin).Hour + 1)
|
||||
var maxRecTimb = giornata.ListTimbr
|
||||
.Where(x => x.Entrata == false)
|
||||
.OrderByDescending(x => x.DataOra)
|
||||
.FirstOrDefault();
|
||||
if (maxRecTimb != null)
|
||||
{
|
||||
maxHour = maxRecTimb.DataOra.AddMinutes(roundMin).Hour + 1;
|
||||
if (maxHour < maxRecTimb.DataOra.AddMinutes(roundMin).Hour + 1)
|
||||
{
|
||||
maxHour = maxRecTimb.DataOra.AddMinutes(roundMin).Hour + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
var maxRecRa = giornata.ListRA
|
||||
.OrderByDescending(x => x.Fine)
|
||||
.FirstOrDefault();
|
||||
if (maxRecRa != null)
|
||||
|
||||
if (giornata.ListRA != null)
|
||||
{
|
||||
if (maxHour < maxRecRa.Fine.AddMinutes(roundMin).Hour + 1)
|
||||
var maxRecRa = giornata.ListRA
|
||||
.OrderByDescending(x => x.Fine)
|
||||
.FirstOrDefault();
|
||||
if (maxRecRa != null)
|
||||
{
|
||||
maxHour = maxRecRa.Fine.AddMinutes(roundMin).Hour + 1;
|
||||
if (maxHour < maxRecRa.Fine.AddMinutes(roundMin).Hour + 1)
|
||||
{
|
||||
maxHour = maxRecRa.Fine.AddMinutes(roundMin).Hour + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user