Nuget Update redis + code cleanup

This commit is contained in:
Samuele Locatelli
2022-04-21 18:07:59 +02:00
parent 6fd7cfdc38
commit 132e857da0
18 changed files with 88 additions and 89 deletions
+7
View File
@@ -0,0 +1,7 @@
[*.cs]
# CS8602: Dereference of a possibly null reference.
dotnet_diagnostic.CS8602.severity = none
# CS8629: Nullable value type may be null.
dotnet_diagnostic.CS8629.severity = none
@@ -125,7 +125,6 @@ namespace GPW.CORE.Api.Controllers
StringBuilder sbMain = new StringBuilder();
StringBuilder sbActions = new StringBuilder();
StringBuilder sbAllProj = new StringBuilder();
string sepaMsg = "-----------------------------------";
int numFix = 0;
int numProj = 0;
int numFasi = 0;
+14 -8
View File
@@ -14,9 +14,9 @@ namespace GPW.CORE.Api.Data
{
#region Private Fields
private static IConfiguration _configuration;
private static IConfiguration _configuration = null!;
private static ILogger<ApiDataService> _logger;
private static ILogger<ApiDataService> _logger = null!;
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
@@ -61,7 +61,7 @@ namespace GPW.CORE.Api.Data
/// <summary>
/// Classe Accesso metodi DB
/// </summary>
public static CORE.Data.Controllers.GPWController dbController;
public static CORE.Data.Controllers.GPWController dbController = null!;
#endregion Public Fields
@@ -175,7 +175,7 @@ namespace GPW.CORE.Api.Data
/// <returns></returns>
public async Task<List<AnagProgettiModel>> AnagProjActiv()
{
List<AnagProgettiModel> dbResult = new List<AnagProgettiModel>();
List<AnagProgettiModel>? dbResult = new List<AnagProgettiModel>();
string cacheKey = $"{rKeyProjAct}";
trackCache(cacheKey);
string rawData = await getRSV(cacheKey);
@@ -194,7 +194,10 @@ namespace GPW.CORE.Api.Data
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagProjActiv: {ts.TotalMilliseconds} ms");
}
if (dbResult == null)
{
dbResult = new List<AnagProgettiModel>();
}
return await Task.FromResult(dbResult);
}
@@ -204,7 +207,7 @@ namespace GPW.CORE.Api.Data
/// <returns></returns>
public async Task<List<AnagFasiModel>> AnagFasiActiv()
{
List<AnagFasiModel> dbResult = new List<AnagFasiModel>();
List<AnagFasiModel>? dbResult = new List<AnagFasiModel>();
string cacheKey = $"{rKeyFasiAct}";
trackCache(cacheKey);
string rawData = await getRSV(cacheKey);
@@ -223,7 +226,10 @@ namespace GPW.CORE.Api.Data
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per AnagFasiActiv: {ts.TotalMilliseconds} ms");
}
if (dbResult == null)
{
dbResult = new List<AnagFasiModel>();
}
return await Task.FromResult(dbResult);
}
@@ -285,7 +291,7 @@ namespace GPW.CORE.Api.Data
#if false
await _redisCacheClient.GetDbFromConfiguration().RemoveAsync(item);
#endif
await redisDb.StringSetAsync(item,"", TimeSpan.FromMilliseconds(5));
await redisDb.StringSetAsync(item, "", TimeSpan.FromMilliseconds(5));
}
cachedDataList = new List<string>();
}
+2 -2
View File
@@ -17,10 +17,10 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
<PackageReference Include="StackExchange.Redis" Version="2.5.43" />
<PackageReference Include="StackExchange.Redis" Version="2.5.61" />
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="8.0.4" />
<PackageReference Include="StackExchange.Redis.Extensions.Core" Version="8.0.4" />
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="8.0.4" />
+13 -5
View File
@@ -236,7 +236,7 @@ namespace GPW.CORE.Data.Controllers
// recupero intero set....
dbResult = localDbCtx
.DbSetAnagProgetti
.Where(x => ((bool)x.Attivo == true && onlyActive == true) || !onlyActive)
.Where(x => ((bool)(x.Attivo ?? false) == true && onlyActive == true) || !onlyActive)
.Include(c => c.ClienteNav)
.Include(g => g.GruppiNav)
.OrderBy(x => x.NomeProj)
@@ -258,7 +258,7 @@ namespace GPW.CORE.Data.Controllers
/// <returns></returns>
public AnagOrariModel AnagOrarioByDip(int idxDip)
{
AnagOrariModel dbResult = new AnagOrariModel();
AnagOrariModel? dbResult = new AnagOrariModel();
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
try
@@ -266,7 +266,7 @@ namespace GPW.CORE.Data.Controllers
// recupero intero set....
dbResult = localDbCtx
.DbSetAnagOrari
.Where(x => x.DipendentiNav.FirstOrDefault().IdxDipendente == idxDip)
.Where(x => x.DipendentiNav.Count > 0 && x.DipendentiNav.First().IdxDipendente == idxDip)
.FirstOrDefault();
}
catch (Exception exc)
@@ -274,6 +274,10 @@ namespace GPW.CORE.Data.Controllers
Log.Error($"Errore in AnagOrarioByDip:{Environment.NewLine}{exc}");
}
}
if (dbResult == null)
{
dbResult = new AnagOrariModel();
}
return dbResult;
}
@@ -530,7 +534,7 @@ namespace GPW.CORE.Data.Controllers
/// <returns></returns>
public RegAttivitaModel RegAttLastByDip(int IdxDipendente, bool onlyActive)
{
RegAttivitaModel dbResult = new RegAttivitaModel();
RegAttivitaModel? dbResult = new RegAttivitaModel();
using (GPWContext localDbCtx = new GPWContext(_configuration))
{
try
@@ -550,6 +554,10 @@ namespace GPW.CORE.Data.Controllers
dbResult = new RegAttivitaModel();
}
}
if (dbResult == null)
{
dbResult = new RegAttivitaModel();
}
return dbResult;
}
@@ -858,7 +866,7 @@ namespace GPW.CORE.Data.Controllers
try
{
int idxDip = 0;
DipendentiModel currUser = new DipendentiModel()
DipendentiModel? currUser = new DipendentiModel()
{
IdxDipendente = 0
};
+15 -15
View File
@@ -11,27 +11,27 @@ namespace GPW.CORE.Data
{
public class DCCDecode
{
public List<certVal> v { get; set; }
public List<certVal> v { get; set; } = null!;
public userVal nam { get; set; }
public userVal nam { get; set; } = null!;
public DateTime dob { get; set; }
public string ver { get; set; }
public string ver { get; set; } = "";
public class certVal
{
public string @is { get; set; }
public string ci { get; set; }
public string co { get; set; }
public string @is { get; set; } = "";
public string ci { get; set; } = "";
public string co { get; set; } = "";
public int dn { get; set; }
public string dt { get; set; }
public string ma { get; set; }
public string mp { get; set; }
public string dt { get; set; } = "";
public string ma { get; set; } = "";
public string mp { get; set; } = "";
public int sd { get; set; }
public string tg { get; set; }
public string vp { get; set; }
public string tg { get; set; } = "";
public string vp { get; set; } = "";
}
@@ -41,16 +41,16 @@ namespace GPW.CORE.Data
/// <summary>
/// Cognome
/// </summary>
public string fn { get; set; }
public string fn { get; set; } = "";
public string fnt { get; set; }
public string fnt { get; set; } = "";
/// <summary>
/// Nome
/// </summary>
public string gn { get; set; }
public string gn { get; set; } = "";
public string gnt { get; set; }
public string gnt { get; set; } = "";
}
+1 -1
View File
@@ -30,7 +30,7 @@ namespace GPW.CORE.Data.DTO
{
valore = TimeSpan.FromHours((double)OreTot);
}
catch (Exception exc)
catch
{ }
}
return valore;
+1 -1
View File
@@ -35,7 +35,7 @@ namespace GPW.CORE.Data.DbModels
{
valore = Utils.TSpanRounded(TimeSpan.FromHours((double)OreTot), 5, true);
}
catch (Exception exc)
catch
{ }
}
return valore;
@@ -14,6 +14,11 @@ namespace GPW.CORE.Data
public MailKitEmailSenderOptions()
{
Host_SecureSocketOptions = SecureSocketOptions.Auto;
Host_Address = "127.0.0.1";
Host_Password = "";
Host_Username = "";
Sender_EMail = "info@steamware.net";
Sender_Name = "Info Steamware";
}
#endregion Public Constructors
+6 -1
View File
@@ -7,7 +7,12 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GPW.CORE.WRKLOG", "GPW.CORE
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GPW.CORE.Data", "GPW.CORE.Data\GPW.CORE.Data.csproj", "{718B275D-7573-4CE2-87AF-57FCAAD71BD8}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "GPW.CORE.Api", "GPW.CORE.Api\GPW.CORE.Api.csproj", "{5204CC6B-88E2-4EFB-9DC8-2C74F32991D0}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "GPW.CORE.Api", "GPW.CORE.Api\GPW.CORE.Api.csproj", "{5204CC6B-88E2-4EFB-9DC8-2C74F32991D0}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{845EC4A6-7460-4897-8571-494E0EBB617E}"
ProjectSection(SolutionItems) = preProject
.editorconfig = .editorconfig
EndProjectSection
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -63,38 +63,7 @@ namespace GPW.CORE.WRKLOG.Components
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
if (true)
{
var updFase = Task.Run(async () =>
{
if (value != null)
{
if (value.FasiNav != null && value.FasiNav.ProgettoNav != null)
{
gruppoSel = value.FasiNav.ProgettoNav.Gruppo;
idxProj = value.FasiNav.IdxProgetto != null ? (int)value.FasiNav.IdxProgetto : 0;
}
else
{
// effettuo selezione manuale...
var currFase = await GDataServ.AnagFasiByKey(value.IdxFase);
if (currFase != null)
{
if (currFase.ProgettoNav != null)
{
gruppoSel = currFase.ProgettoNav.Gruppo;
}
idxProj = currFase.IdxProgetto != null ? (int)currFase.IdxProgetto : 0;
}
value.IdxFase = 0;
}
}
await ReloadData(false, false);
});
updFase.Wait();
}
else
var updFase = Task.Run(async () =>
{
if (value != null)
{
@@ -106,26 +75,22 @@ namespace GPW.CORE.WRKLOG.Components
else
{
var updFase = Task.Run(async () =>
{
// effettuo selezione manuale...
var currFase = await GDataServ.AnagFasiByKey(value.IdxFase);
if (currFase != null)
if (currFase != null)
{
if (currFase.ProgettoNav != null)
{
if (currFase.ProgettoNav != null)
{
gruppoSel = currFase.ProgettoNav.Gruppo;
}
idxProj = currFase.IdxProgetto != null ? (int)currFase.IdxProgetto : 0;
gruppoSel = currFase.ProgettoNav.Gruppo;
}
value.IdxFase = 0;
});
updFase.Wait();
idxProj = currFase.IdxProgetto != null ? (int)currFase.IdxProgetto : 0;
}
value.IdxFase = 0;
}
}
var pUpd = Task.Run(async () => await ReloadData(false, false));
pUpd.Wait();
}
await ReloadData(false, false);
});
updFase.Wait();
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
+1 -1
View File
@@ -11,7 +11,7 @@
<div class="col-4">
@if (ListTimb != null && ListTimb.Count > 0)
{
<b>@ListTimb.FirstOrDefault().DataOra.ToString("ddd dd.MM.yyyy")</b>
<b>@(ListTimb.FirstOrDefault()).DataOra.ToString("ddd dd.MM.yyyy")</b>
}
</div>
<div class="col-4 py-1">
+4 -3
View File
@@ -2,7 +2,7 @@
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<Version>3.0.2204.2117</Version>
<Version>3.0.2204.2118</Version>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
</PropertyGroup>
@@ -17,16 +17,17 @@
</ItemGroup>
<ItemGroup>
<None Include="..\.editorconfig" Link=".editorconfig" />
<None Include="compilerconfig.json" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Authentication.Negotiate" Version="6.0.4" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.4" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog" Version="4.7.15" />
<PackageReference Include="RestSharp" Version="107.3.0" />
<PackageReference Include="StackExchange.Redis" Version="2.5.43" />
<PackageReference Include="StackExchange.Redis" Version="2.5.61" />
</ItemGroup>
<ItemGroup>
+1 -1
View File
@@ -77,7 +77,7 @@
<tbody>
@foreach (var item in ListRecords.OrderByDescending(x => x.DtRif))
{
if (item.ListRA.Count() + item.ListTimbr.Count() > 0)
if (item.ListRA != null && item.ListTimbr != null && (item.ListRA.Count() + item.ListTimbr.Count() > 0))
{
<tr class="@cssRiga(item.DtRif)">
<td>@item.DtRif.ToString("dd MMM yyyy"), <b>@item.DtRif.ToString("dddd")</b></td>
+4 -1
View File
@@ -266,7 +266,10 @@ namespace GPW.CORE.WRKLOG.Pages
{
isLoading = true;
UITimer.Stop();
ListRecords = await DataService.DailyDetails(IdxDipendente, weekStatList.First().Inizio, weekStatList.Last().Fine);
if (weekStatList != null)
{
ListRecords = await DataService.DailyDetails(IdxDipendente, weekStatList.First().Inizio, weekStatList.Last().Fine);
}
await Task.Delay(100);
lastRefresh = DateTime.Now;
UITimer.Start();
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>GPW - Gestione Presenze Web</i>
<h4>Versione: 3.0.2204.2117</h4>
<h4>Versione: 3.0.2204.2118</h4>
<br /> Note di rilascio:
<ul>
<li>
+1 -1
View File
@@ -1 +1 @@
3.0.2204.2117
3.0.2204.2118
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>3.0.2204.2117</version>
<version>3.0.2204.2118</version>
<url>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/GWMS.UI.zip</url>
<changelog>http://nexus.steamware.net/repository/SWS/GWMS/stable/0/ChangeLog.html</changelog>
<mandatory>false</mandatory>