94 Commits

Author SHA1 Message Date
Samuele Locatelli 317508f37b Merge branch 'develop' into SDK 2024-08-08 17:34:46 +02:00
Samuele Locatelli 00e6b19eba Aggiunta chiamate con versione limitata 2024-08-08 17:34:40 +02:00
Samuele Locatelli a566e94c88 Merge tag 'AddAppRelMgmt03' into develop
Aggiunta oggetto versione (nativo) + chiamata nuova x controllo num
versione
2024-08-08 17:32:21 +02:00
Samuele Locatelli 64beb99dba Merge branch 'release/AddAppRelMgmt03' 2024-08-08 17:32:07 +02:00
Samuele Locatelli 6d190dd95c Merge branch 'develop' into SDK 2024-08-08 17:31:45 +02:00
Samuele Locatelli 2d3cfabdf1 Aggiunto oggetto versione (nativo) + permesso con nuovo metodo ricerca 2024-08-08 17:31:37 +02:00
Samuele Locatelli 8bde0ce0cd Merge tag 'AddAppRelMgmt02' into develop
Fix modalità comparazione num versioni: string sbaglia x cui usato obj
Version in c# (non translabile in SQL da EF)
2024-08-08 17:00:57 +02:00
Samuele Locatelli 30dd6cbd51 Merge branch 'release/AddAppRelMgmt02' 2024-08-08 17:00:17 +02:00
Samuele Locatelli fcdb23d281 Fix confronto numero versione: non come stringa ma come obj version 2024-08-08 16:59:56 +02:00
Samuele Locatelli 493215ee33 Conferma ok ping x versione nuova SDK nuget 2024-08-07 18:58:00 +02:00
Samuele Locatelli 912dd3579b Merge branch 'develop' into SDK 2024-08-07 18:48:48 +02:00
Samuele Locatelli 6d7214a274 Fix ping server 2024-08-07 18:48:42 +02:00
Samuele Locatelli 56785369ab Merge tag 'AddAppRelMgmt01' into develop
Aggiunta gestione edit/delete/insert delle releases
2024-08-07 18:43:49 +02:00
Samuele Locatelli 301b69026d Merge branch 'release/AddAppRelMgmt01' 2024-08-07 18:43:32 +02:00
Samuele Locatelli 7a0bc3a9f9 Completato editing releases applicazone 2024-08-07 18:41:05 +02:00
Samuele Locatelli 2c1919c290 Bozza gestione release applicativi 2024-08-07 17:34:12 +02:00
Samuele Locatelli 5274068c09 Merge tag 'WinFormNuget02' into develop
Update link pacchetto stabile nuget
2024-08-07 09:36:20 +02:00
Samuele Locatelli 281e24423b Merge branch 'release/WinFormNuget02' 2024-08-07 09:35:42 +02:00
Samuele Locatelli 26acf3c185 Merge branch 'SDK' into develop 2024-08-07 09:34:23 +02:00
Samuele Locatelli 8d0adc92ee Update nuget a apcchetto stabile 2024-08-07 09:34:09 +02:00
Samuele Locatelli 0d919556ad Merge tag 'WinFormNuget01' into develop
Completamento x release primo nuget stabile di comunicazione
2024-08-07 09:14:55 +02:00
Samuele Locatelli 7bb56a9f1c Merge branch 'release/WinFormNuget01' 2024-08-07 09:14:41 +02:00
Samuele Locatelli 3a391b090c Completata winform x test 2024-08-07 09:14:06 +02:00
Samuele Locatelli 122fd0bf0e Fix restore su WinForm 2024-08-07 09:07:45 +02:00
Samuele Locatelli ae174cb094 Fix compilazione con dipendenze RestSharp 111.2 2024-08-07 09:03:54 +02:00
Samuele Locatelli 93f284790b Merge branch 'feature/TestWinFormNuget' into develop 2024-08-07 08:58:35 +02:00
Samuele Locatelli 5b8c294136 Update nuspec generico 2024-08-07 08:56:58 +02:00
Samuele Locatelli 32c75cdd05 update vers restsharp x WinForm 2024-08-07 08:56:49 +02:00
Samuele Locatelli ff8f86c9ca update target framework 2024-08-07 08:54:38 +02:00
Samuele Locatelli 4b6218ff75 Ancora update progetto VF (framework 4.7.2) 2024-08-07 08:54:26 +02:00
Samuele Locatelli b409e698b7 Aggiunta nuget proxy x WinFormVB 2024-08-07 08:38:20 +02:00
Samuele Locatelli 927a89d388 fix deploy stage x nuget 2024-08-07 08:35:04 +02:00
Samuele Locatelli 5e172e1022 Inizio setup app winform 2024-08-07 08:30:44 +02:00
Samuele Locatelli fcd1f16071 Fix yaml x componenti nuspec 2024-08-07 08:29:41 +02:00
Samuele Locatelli ba91bd9edb Update yaml x produrre nuget package 2024-08-07 08:26:42 +02:00
Samuele Locatelli 9fbd8600ab Update controller output dati filtrati 2024-08-06 19:14:07 +02:00
Samuele Locatelli f6a91943b0 Update insomnia test file 2024-08-06 19:13:56 +02:00
Samuele Locatelli 3f90dc6016 Completato ConsoleTestApp con tutto e filtrato 2024-08-06 19:13:45 +02:00
Samuele Locatelli a4b4b47231 Merge tag 'AddRelVersMan02' into develop
pubblicazione metodi x ricerca filtrata x version number minimo
2024-08-06 18:33:45 +02:00
Samuele Locatelli 21ef7c6e73 Merge branch 'release/AddRelVersMan02' 2024-08-06 18:33:34 +02:00
Samuele Locatelli f5a6ad0033 TypoFix 2024-08-06 18:33:19 +02:00
Samuele Locatelli c38445b1cd Bozza EgwProxy x chaimate REST controllo licenze 2024-08-06 18:32:56 +02:00
Samuele Locatelli e90c52a744 LiMan: ReleasesVers:
- Aggiunta ricerca filtrata per versione minima
- Update API controller
2024-08-06 18:32:36 +02:00
Samuele Locatelli c7fcfa748c Merge tag 'AddRelVersMan01' into develop
Gestione preliminare elenco RelVers
2024-08-06 17:04:25 +02:00
Samuele Locatelli c3c81755b0 Merge branch 'release/AddRelVersMan01' 2024-08-06 17:04:10 +02:00
Samuele Locatelli 97d9395f4a Completato primo metodo x recupero di TUTTE Le versioni registrate di un applicativo 2024-08-06 16:56:24 +02:00
Samuele Locatelli c787b575b4 Aggiunta preliminare controller release (da completare)
Aggiunta DTO
2024-08-06 16:41:33 +02:00
Samuele Locatelli 0a91b1413f Aggiunta modello Release x gest segnalazione aggiornamenti 2024-08-06 16:41:11 +02:00
Samuele Locatelli 2a2b2b3f31 Merge tag 'AddSyncApiRestCall' into develop
Aggiunte call REST API x sync tabelle DB di conf
2024-07-18 17:58:31 +02:00
Samuele Locatelli aaba44f575 Merge branch 'release/AddSyncApiRestCall' 2024-07-18 17:58:20 +02:00
Samuele Locatelli 5d6de5e7fc Completato nuove chiamate x fare sync tabelle DB (x ora conf solo MAPO) 2024-07-18 17:57:52 +02:00
Samuele Locatelli e857b8a714 update file rest x chiamate aggiornate 2024-07-18 17:14:43 +02:00
Samuele Locatelli 96b9402bf4 Completata implementazione iniziale show config da LiMan 2024-07-18 16:19:30 +02:00
Samuele Locatelli b5568d6d7e Merge tag 'AddUserManAndLicSearch03' into develop
Completato editing utenti
2024-07-15 19:38:27 +02:00
Samuele Locatelli 60f961d5dd Merge branch 'release/AddUserManAndLicSearch03' 2024-07-15 19:37:52 +02:00
Samuele Locatelli 9842dcd70d Fix 2 altri topic x user std 2024-07-15 19:37:40 +02:00
Samuele Locatelli 1a6b7093c0 COmpletato editing claims/ruoli x utente AD 2024-07-15 19:32:34 +02:00
Samuele Locatelli 7974b9c2a9 Fix search licenze 2024-07-15 17:58:44 +02:00
Samuele Locatelli a58513d719 Update display info licenza 2024-07-15 17:40:48 +02:00
Samuele Locatelli 4a9e129071 Update condizioni ricerca x licenza e relazioni 2024-07-15 16:53:12 +02:00
Samuele Locatelli 57bd776be3 Merge tag 'AddUserManAndLicSearch02' into develop
Continuo gest editing utenti (mostra chi esiste...)
2024-07-15 12:06:00 +02:00
Samuele Locatelli 828c2c57f6 Merge branch 'release/AddUserManAndLicSearch02' 2024-07-15 12:05:50 +02:00
Samuele Locatelli c881b12524 update x iniziare editing utenti 2024-07-15 12:05:29 +02:00
Samuele Locatelli 623d9d3e6d Uldate filtraggio ruoli e nomi utente 2024-07-15 12:04:28 +02:00
Samuele Locatelli b522bd4ec0 Merge tag 'AddUserManAndLicSearch01' into develop
Aggiunto primo step gesitone utenti + ricerca licenze
2024-07-15 11:23:22 +02:00
Samuele Locatelli 0eb8d93241 Merge branch 'release/AddUserManAndLicSearch01' 2024-07-15 11:23:09 +02:00
Samuele Locatelli 86ca7fa93c Fix update display 2024-07-15 11:22:39 +02:00
Samuele Locatelli 97038f5ff7 Update gestione filtro menù sx 2024-07-15 09:46:49 +02:00
Samuele Locatelli 660f8fd356 Merge remote-tracking branch 'origin/develop' into develop 2024-07-15 07:07:45 +02:00
Samuele E. Locatelli 2e9f816685 Update x eseguire fix user/claim se auth di base fornita 2024-07-13 16:54:31 +02:00
Samuele E. Locatelli 2b14b256c1 Completata gestione metodi Auth da service controller con DB + REDIS 2024-07-13 16:22:48 +02:00
Samuele E. Locatelli f84dd6e9fe Aggiunta su DB gestione nuovi Auth 2024-07-13 15:41:56 +02:00
Samuele E. Locatelli 39d4d61f12 refresh app + DB 2024-07-13 15:27:59 +02:00
Samuele E. Locatelli af06c24d7a Aggiunta DbModels e migrazioni x gestione custom role/claims 2024-07-13 15:27:53 +02:00
Samuele E. Locatelli a9dff7d43b ancora fix yaml 2024-07-12 17:26:51 +02:00
Samuele E. Locatelli db8f2da831 fix yaml x nuget restore 2024-07-12 17:24:33 +02:00
Samuele E. Locatelli b2ebe8e674 Ancora update nuget API 2024-07-12 17:14:25 +02:00
Samuele E. Locatelli ab550f8468 Update pacchetti x API 2024-07-12 17:12:54 +02:00
Samuele E. Locatelli d062c60073 Ancora update nuget x fix deploy CI/CD 2024-07-12 17:03:17 +02:00
Samuele E. Locatelli 4e75085d1f Refresh pacchetti x problemi compilazione 2024-07-12 16:56:19 +02:00
Samuele E. Locatelli 71ca2d7e69 COmpletata review modulo out ricerca licenze 2024-07-12 16:25:17 +02:00
Samuele E. Locatelli 780eef4459 Aggiunta search prodotti 2024-07-12 16:04:41 +02:00
Samuele E. Locatelli 9163841613 Update grafici pagina keys 2024-07-12 15:55:25 +02:00
Samuele E. Locatelli 543428608f Aggiunto modulo ricerca solo KEY 2024-07-12 15:17:45 +02:00
Samuele E. Locatelli 5c7bfada7e Aggiunta preliminare classe gestione lettura da DB MySql 2024-07-12 12:42:47 +02:00
Samuele E. Locatelli c5092e711b Review colori x differenziazione template 2024-07-12 09:56:25 +02:00
Samuele Locatelli 0c86362d41 Refresh API test 2024-06-01 12:33:12 +02:00
Samuele Locatelli c864a7df5f Completata review B5 + loading iniziale pagina num call 2024-06-01 12:17:15 +02:00
Samuele Locatelli f306683687 aNCORA UPDATE NUGET E BOOTSTRAP5 2024-06-01 11:52:48 +02:00
Samuele Locatelli a8743bec74 Global update post upgrade bootstrap 2024-06-01 10:45:48 +02:00
Samuele Locatelli db5638e776 Ssostituzione bootstrao 4--> 5 (da completare) 2024-06-01 10:45:41 +02:00
Samuele Locatelli 9ddf247346 Inizio insert pag stats call
- test migration
- aggiunta pagina iniziale
- update nuget
2024-06-01 09:55:14 +02:00
Samuele Locatelli 32397cead9 Aggiunta riferimento EgwProxy
- x chiamate DB MAPO x sync Config + Vocabolario
- update nuget vari
2024-05-31 19:25:26 +02:00
Samuele Locatelli 6ccbffdecf Aggiunta modello + vista e stored x calcolo statistiche chiamate 2024-05-31 19:24:36 +02:00
403 changed files with 106153 additions and 77133 deletions
+145 -22
View File
@@ -1,17 +1,28 @@
variables:
VERS_MAIN: '1.0'
NEXUS_PATH: 'LiMan'
APP_NAME: 'LiMan.UI'
NUGET_PATH: 'C:\Tools\nuget.exe'
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix
- |
$hasSource = C:\Tools\nuget.exe sources list | find "`"Steamware Nexus`"" /C
if ($hasSource -eq 0) {
C:\Tools\nuget.exe sources Add -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
} else {
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source https://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"$NEXUS_PASSWD`""
echo "esecuzione Nuget FIX steps"
dotnet nuget list source
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus Proxy"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source "`"Steamware Nexus Proxy`""
}
echo $hasSource
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source "`"Steamware Nexus`""
}
$hasSource = dotnet nuget list source | Select-String -Pattern "nexus-proxy-v3"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source nexus-proxy-v3
}
dotnet nuget add source https://nexus.steamware.net/repository/nuget-group-3/index.json -n "Steamware Nexus" -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
echo "Steamware Nexus Source added"
# helper creazione files zip
.zipper: &zipper
@@ -28,19 +39,6 @@ variables:
#cd "$env:APP_NAME\bin\publish\net6.0"
# # helper creazione hash files x EXE
# .hashBuildExe: &hashBuildExe
# - |
# $Target = "$env:APP_NAME\Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
# $MD5 = Get-FileHash $Target -Algorithm MD5
# $SHA1 = Get-FileHash $Target -Algorithm SHA1
# New-Item $Target".md5"
# New-Item $Target".sha1"
# $MD5.Hash | Set-Content -Path $Target".md5"
# $SHA1.Hash | Set-Content -Path $Target".sha1"
# echo "Created HASH files for $Target"
# helper creazione hash files x IIS
.hashBuild: &hashBuild
- |
@@ -82,11 +80,58 @@ variables:
# mCurl -v -u $env:NEXUS_USER:$env:NEXUS_PASSWD --upload-file bin/release/$env:APP_NAME.zip $env:NEXUS_SERVER/utility/$env:NEXUS_PATH/$version/$env:APP_NAME-$version.zip
# image: mcr.microsoft.com/dotnet/sdk:6.0
# helper x fix version number
.version-fix: &version-fix
- |
$env:NEW_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format ddHH)
$env:NUM_REL = $env:VERS_MAIN+"."+(get-date -format yyMM)+"."+(get-date -format dHH)
$env:NUM_DEB = $env:VERS_MAIN+"."+(get-date -format yyMM)+"-beta."+(get-date -format dHH)
$env:NEW_COPYRIGHT = "EgalWare @ 2021-" + (get-date -format yyyy)
#$contenuto = Get-Content -path 'VersGen\VersGen.cs' -Raw
#$newContenuto = $contenuto -replace '0.0.0.0', $env:NEW_REL
#$newContenuto = $newContenuto -replace 'EgalWare © 2021', $env:NEW_COPYRIGHT
#$newContenuto | Set-Content -Path 'VersGen\VersGen.cs'
# display versioni generate
$resoconto = "Effettuato fix file VersGen | release v: " + $env:NUM_REL + " | debug v: " + $env:NUM_DEB;
Write-Output $resoconto;
echo "Replace completati"
# helper x fix nuspec file
.nuspec-fix: &nuspec-fix
- |
echo "Modifica dati file nuspec Release"
$currRelease = $env:NUM_REL
$currDebug = $env:NUM_DEB
$find = "<version>(.|\n)*?</version>";
$fileNameRel = "$env:APP_NAME.Release.nuspec";
$replRel = "<version>" + $currRelease + "</version>";
$nuspDataRel = Get-Content $fileNameRel;
$nuspDataRelUpd = $nuspDataRel -replace $find, $replRel;
$nuspDataRelUpd = $nuspDataRelUpd -replace "#copyright#", $replCopy;
$nuspDataRelUpd = $nuspDataRelUpd -replace "#releaseNotes#", "Build $adesso";
Set-Content -Path $fileNameRel -Value $nuspDataRelUpd;
echo "Modifica dati file nuspec Debug"
$fileNameDeb = "$env:APP_NAME.Debug.nuspec";
$replDeb = "<version>" + $currDebug + "</version>";
$nuspDataDeb = Get-Content $fileNameDeb;
$nuspDataDebUpd = $nuspDataDeb -replace $find, $replDeb;
$nuspDataDebUpd = $nuspDataDebUpd -replace "#copyright#", $replCopy;
$nuspDataDebUpd = $nuspDataDebUpd -replace "#releaseNotes#", "Build $adesso";
Set-Content -Path $fileNameDeb -Value $nuspDataDebUpd;
echo "replace completati"
stages:
- build
- deploy
- release
# --------------------------------
# BUILD
# --------------------------------
UI:build:
stage: build
tags:
@@ -116,8 +161,25 @@ Transfer:build:
- dotnet restore LiMan.sln
script:
- dotnet build LiMan.Transfer/LiMan.Transfer.csproj
EgwProxy.LiMan:build:
stage: build
tags:
- win
variables:
APP_NAME: EgwProxy.LiMan
SOL_NAME: EgwProxy.LiMan
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
script:
- echo $CI_COMMIT_BRANCH
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# --------------------------------
# DEPLOY
# --------------------------------
UI:IIS01:deploy:
stage: deploy
tags:
@@ -125,6 +187,8 @@ UI:IIS01:deploy:
only:
- develop
needs: ["UI:build"]
before_script:
- *nuget-fix
script:
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.UI/LiMan.UI.csproj
- *zipper
@@ -140,6 +204,8 @@ API:IIS01:deploy:
only:
- develop
needs: ["API:build"]
before_script:
- *nuget-fix
script:
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.Api/LiMan.Api.csproj
- *zipper
@@ -153,6 +219,8 @@ UI:IIS04:deploy:
only:
- main
needs: ["UI:build"]
before_script:
- *nuget-fix
script:
- dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.UI/LiMan.UI.csproj
- *zipper
@@ -167,6 +235,8 @@ API:IIS04:deploy:
only:
- main
needs: ["API:build"]
before_script:
- *nuget-fix
script:
- dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.Api/LiMan.Api.csproj
- *zipper
@@ -180,6 +250,8 @@ Transfer:deploy:
variables:
APP_NAME: LiMan.Transfer
needs: ["Transfer:build"]
before_script:
- *nuget-fix
script:
- dotnet build LiMan.Transfer/LiMan.Transfer.csproj
- dotnet publish -p:PublishProfile=SingleFileX86.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release LiMan.Transfer/LiMan.Transfer.csproj
@@ -187,7 +259,58 @@ Transfer:deploy:
- *hashBuild
- *nexusUpload
EgwProxy.LiMan:deploy:
stage: deploy
needs: ["EgwProxy.LiMan:build"]
tags:
- win
variables:
CONFIG: Debug
APP_NAME: EgwProxy.LiMan
SOL_NAME: EgwProxy.LiMan
only:
refs:
- develop
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet'
- *version-fix
- *nuspec-fix
script:
# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- dotnet build "$env:APP_NAME\$env:APP_NAME.csproj"
- '& Remove-Item *.nupkg'
- '& $env:NUGET_PATH pack "$env:APP_NAME.Debug.nuspec"'
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# --------------------------------
# RELEASE
# --------------------------------
EgwProxy.LiMan:release:
stage: release
needs: ["EgwProxy.LiMan:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: EgwProxy.LiMan
SOL_NAME: EgwProxy.LiMan
only:
refs:
- SDK
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet'
- *version-fix
- *nuspec-fix
script:
- dotnet build "$env:APP_NAME\$env:APP_NAME.csproj"
- '& Remove-Item *.nupkg'
- '& $env:NUGET_PATH pack "$env:APP_NAME.Release.nuspec"'
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# UI:installer:
# stage: installer
# tags:
+16
View File
@@ -0,0 +1,16 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core
{
public class Const
{
// classi utilità x cache REDIS dati DB
public const string redisBaseAddr = "MagManUi";
public const string rKeyConfig = $"{redisBaseAddr}:Cache";
}
}
+1 -1
View File
@@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5DADD362-4B14-45AD-AB0A-B30361D7449B}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>EgwProxy.LiMan.ConsoleTest</RootNamespace>
<AssemblyName>EgwProxy.LiMan.ConsoleTest</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EgwProxy.LiMan\EgwProxy.LiMan.csproj">
<Project>{1b8191a0-dd4e-4320-878b-246a9b61c368}</Project>
<Name>EgwProxy.LiMan</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+77
View File
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.LiMan.ConsoleTest
{
internal class Program
{
static void Main(string[] args)
{
string separator = "-----------------";
string codApp = "EgtBeamWall";
string answ = "";
#if DEBUG
string srvUrl = "localhost:5003";
//string srvUrl = "liman.egalware.com/ELM.API";
#else
string srvUrl = "liman.egalware.com/ELM.API";
#endif
Console.WriteLine(separator);
Console.WriteLine("EgwProxy.LiMan | Console test app");
Console.WriteLine(separator);
Console.WriteLine("premere un tasto per continuare...");
Console.ReadLine();
// per prima cosa instanzio (cablato) la classe di comnicazione
var commLib = new DataSyncro(srvUrl);
// test ping
Console.WriteLine("Premere ENT per check ping");
answ = Console.ReadLine();
bool servOk = commLib.CheckRemote();
string esito = servOk ? "OK" : "KO";
Console.WriteLine($"Esito controllo server: {esito}");
// chiamo e mostro elenco
var listAll = commLib.ReleaseGetAll(codApp);
// mostro elenco
Console.WriteLine(separator);
Console.WriteLine("Elenco versioni completo:");
Console.WriteLine(separator);
Console.WriteLine("");
foreach (var item in listAll)
{
Console.WriteLine($"{item.CodApp} | {item.VersNum} | {item.VersText} | {item.ReleaseDate:yyyy-MM-dd}");
}
Console.WriteLine(separator);
Console.WriteLine("premere un tasto per continuare...");
Console.WriteLine("");
Console.ReadLine();
Console.WriteLine(separator);
Console.WriteLine("Elenco versioni filtrato:");
Console.WriteLine(separator);
Console.WriteLine("");
Console.WriteLine("Inserire versione minima richiesta (default: 0.0.0.0)");
answ = Console.ReadLine();
answ = string.IsNullOrEmpty(answ) ? "0.0.0.0" : answ;
while (!string.IsNullOrEmpty(answ))
{
var listFilt = commLib.ReleaseGetFilt(codApp, answ);
foreach (var item in listFilt)
{
Console.WriteLine($"{item.CodApp} | {item.VersNum} | {item.VersText} | {item.ReleaseDate:yyyy-MM-dd}");
}
Console.WriteLine(separator);
Console.WriteLine("");
Console.WriteLine("Inserire versione minima richiesta (se vuoto esce)");
answ = Console.ReadLine();
}
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EgwProxy.LiMan.ConsoleTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EgwProxy.LiMan.ConsoleTest")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5dadd362-4b14-45ad-ab0a-b30361d7449b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>EgwProxy.LiMan</id>
<version>#version#</version>
<title>EgwProxy.LiMan</title>
<authors>Samuele E. Locatelli, EgalWare</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<description>Libreria per comunicazione REST con server LiMan - beta/unstable</description>
<releaseNotes>#releaseNotes#</releaseNotes>
<copyright>#copyright#</copyright>
<tags>EgwProxy.LiMan LiMan Rest</tags>
<dependencies>
<dependency id="RestSharp" version="111.2.0.0" />
<dependency id="Newtonsoft.Json" version="13.0.0.0" />
</dependencies>
</metadata>
<files>
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.dll" target="lib" />
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.config" target="lib" />
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.pdb" target="lib" />
</files>
</package>
+23
View File
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>EgwProxy.LiMan</id>
<version>#version#</version>
<title>EgwProxy.LiMan</title>
<authors>Samuele E. Locatelli, EgalWare</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<description>Libreria per comunicazione REST con server LiMan</description>
<releaseNotes>#releaseNotes#</releaseNotes>
<copyright>#copyright#</copyright>
<tags>EgwProxy.LiMan LiMan Rest</tags>
<dependencies>
<dependency id="RestSharp" version="111.2.0.0" />
<dependency id="Newtonsoft.Json" version="13.0.0.0" />
</dependencies>
</metadata>
<files>
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.dll" target="lib" />
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.config" target="lib" />
</files>
</package>
+37
View File
@@ -0,0 +1,37 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34902.65
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.LiMan", "EgwProxy.LiMan\EgwProxy.LiMan.csproj", "{1B8191A0-DD4E-4320-878B-246A9B61C368}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.LiMan.ConsoleTest", "EgwProxy.LiMan.ConsoleTest\EgwProxy.LiMan.ConsoleTest.csproj", "{5DADD362-4B14-45AD-AB0A-B30361D7449B}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestWinFormVB", "TestWinFormVB\TestWinFormVB.vbproj", "{CC0A7D8F-0888-45F5-B791-FCD90349CD21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1B8191A0-DD4E-4320-878B-246A9B61C368}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B8191A0-DD4E-4320-878B-246A9B61C368}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B8191A0-DD4E-4320-878B-246A9B61C368}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B8191A0-DD4E-4320-878B-246A9B61C368}.Release|Any CPU.Build.0 = Release|Any CPU
{5DADD362-4B14-45AD-AB0A-B30361D7449B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DADD362-4B14-45AD-AB0A-B30361D7449B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DADD362-4B14-45AD-AB0A-B30361D7449B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DADD362-4B14-45AD-AB0A-B30361D7449B}.Release|Any CPU.Build.0 = Release|Any CPU
{CC0A7D8F-0888-45F5-B791-FCD90349CD21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC0A7D8F-0888-45F5-B791-FCD90349CD21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC0A7D8F-0888-45F5-B791-FCD90349CD21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC0A7D8F-0888-45F5-B791-FCD90349CD21}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4898F98F-F4DF-4114-A026-D03C28F288A3}
EndGlobalSection
EndGlobal
+62
View File
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace EgwProxy.LiMan.DTO
{
public class ReleaseDTO
{
/// <summary>
/// Codice/Nome applicativo
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// Versione applicativo formato semver numerico 4 blocchi
/// </summary>
public string VersNum { get; set; } = "0.0.0.0";
/// <summary>
/// Versione applicativo, formato testuale libero, può essere uguale a VersNum
/// </summary>
public string VersText { get; set; } = "a.b";
/// <summary>
/// Oggetto versione calcolato da VersNum
/// </summary>
public Version VersVal { get; set; } = new Version();
/// <summary>
/// Verifica se sia permessa la versione quando viene valutata la versione massima consentita
/// </summary>
public bool IsPermitted { get; set; } = false;
/// <summary>
/// Data di release
/// </summary>
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
/// <summary>
/// Url pagina web di changelog (traduzione gestita sul sito target) - calcolato da CodApp + vers
/// </summary>
public string UrlChangelog { get; set; } = "http://releases.egalware.com";
/// <summary>
/// Url pagina web di changelog estesa (traduzione gestita sul sito target) - calcolato da CodApp + vers
/// </summary>
[NotMapped]
public string UrlChangelogExt { get; set; } = "http://releases.egalware.com";
/// <summary>
/// Indica se il record sia da considerare attivo/pubblico
/// </summary>
[NotMapped]
public bool IsActive { get; set; } = false;
}
}
+327
View File
@@ -0,0 +1,327 @@
using EgwProxy.LiMan.DTO;
using Newtonsoft.Json;
using NLog;
using NLog.Fluent;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
namespace EgwProxy.LiMan
{
public class DataSyncro
{
#region Public Constructors
/// <summary>
/// Inizializza la libreria di comunicazione con il token assegnato
/// </summary>
/// <param name="serverUrl">URL del server</param>
public DataSyncro(string serverUrl)
{
servAddr = serverUrl;
apiUrl = $"https://{servAddr}/api/";
rcOptions = new RestClientOptions { BaseUrl = new Uri(apiUrl), Timeout = TimeSpan.FromMilliseconds(callTimeout) };
Log.Info($"DataSyncro initialized | api: {apiUrl} | timeout: {callTimeout}");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Test ping x indirizzo indicato
/// </summary>
/// <param name="tgtAddr">Indirizzo da pingare</param>
/// <returns></returns>
public static IPStatus pingAddress(string tgtAddr)
{
IPStatus answ = IPStatus.Unknown;
IPAddress address;
PingReply reply;
using (Ping pingSender = new Ping())
{
address = IPAddress.Loopback;
int pingMsTimeout = 500;
IPAddress.TryParse(tgtAddr, out address);
try
{
// se != null --> uso tgtAddr...
if (address != null)
{
reply = pingSender.Send(address, pingMsTimeout);
}
else
{
reply = pingSender.Send(tgtAddr, pingMsTimeout);
}
}
catch
{
reply = pingSender.Send(IPAddress.Loopback, pingMsTimeout);
}
answ = reply.Status;
}
return answ;
}
/// <summary>
/// Test ping x indirizzo indicato
/// </summary>
/// <param name="tgtAddr">Indirizzo da pingare</param>
/// <param name="timeout">Timeout chiamata in ms</param>
/// <returns></returns>
public static IPStatus pingAddress(string tgtAddr, int timeout)
{
IPStatus answ = IPStatus.Unknown;
IPAddress address;
PingReply reply;
using (Ping pingSender = new Ping())
{
address = IPAddress.Loopback;
int pingMsTimeout = timeout;
IPAddress.TryParse(tgtAddr, out address);
try
{
// se != null --> uso tgtAddr...
if (address != null && address != IPAddress.Loopback)
{
reply = pingSender.Send(address, pingMsTimeout);
}
else
{
reply = pingSender.Send(tgtAddr, pingMsTimeout);
}
answ = reply.Status;
}
catch (Exception exc)
{
answ = IPStatus.Unknown;
Log.Error($"Errore in ping:{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Effettua chiamata test sul server (ping), se fallisse riprova fino a maxTry volte
/// </summary>
/// <param name="maxTry">num tentativi in caso di KO</param>
/// <param name="waitTime">tempo di attesa medio tra tentativi in ms</param>
/// <returns></returns>
public bool CheckRemote(int maxTry = 5, int waitTime = 200)
{
bool res = false;
int numTry = 0;
IPAddress address = IPAddress.Loopback;
string srvName = servAddr;
// tolgo eventuale nome con ":"
if (servAddr.Contains(":"))
{
srvName = servAddr.Substring(0, servAddr.IndexOf(":"));
}
// tolgo eventuale nome con "/"
if (servAddr.Contains("/"))
{
srvName = servAddr.Substring(0, servAddr.IndexOf("/"));
}
while (!res && numTry < maxTry)
{
res = pingAddress(srvName, callTimeout) == IPStatus.Success;
numTry++;
if (!res)
{
Thread.Sleep(waitTime);
}
}
return res;
}
/// <summary>
/// Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseGetAll(string CodApp)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/{CodAppEnc}", Method.Get);
var response = client.Get(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return answ;
}
/// <summary>
/// Versione Async Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <returns></returns>
public async Task<List<ReleaseDTO>> ReleaseGetAllAsync(string CodApp)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/{CodAppEnc}", Method.Get);
var response = await client.GetAsync(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return await Task.FromResult(answ);
}
/// <summary>
/// Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseGetFilt(string CodApp, string VersMin)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/filt/{CodAppEnc}?VersMin={VersMin}", Method.Get);
var response = client.Get(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return answ;
}
/// <summary>
/// Versione Async Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public async Task<List<ReleaseDTO>> ReleaseGetFiltAsync(string CodApp, string VersMin)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/filt/{CodAppEnc}?VersMin={VersMin}", Method.Get);
var response = await client.GetAsync(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return await Task.FromResult(answ);
}
/// <summary>
/// Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <param name="VersMax">Versione massima consentita</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseGetFiltLimit(string CodApp, string VersMin, string VersMax)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/filtLimit/{CodAppEnc}?VersMin={VersMin}&VersMax={VersMax}", Method.Get);
var response = client.Get(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return answ;
}
/// <summary>
/// Versione Async Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <param name="VersMax">Versione massima consentita</param>
/// <returns></returns>
public async Task<List<ReleaseDTO>> ReleaseGetFiltLimitAsync(string CodApp, string VersMin, string VersMax)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/filtLimit/{CodAppEnc}?VersMin={VersMin}&VersMax={VersMax}", Method.Get);
var response = await client.GetAsync(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return await Task.FromResult(answ);
}
#endregion Public Methods
#region Private Fields
/// <summary>
/// Istanza logger
/// </summary>
private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// URL dell'API x chiamate gestione licenze
/// </summary>
private string apiUrl = $"";
private int callTimeout = 10000;
/// <summary>
/// Opzioni standard di chiamata
/// </summary>
private RestClientOptions rcOptions = new RestClientOptions();
/// <summary>
/// Indirizzo server (URL con eventuale porta)
/// </summary>
private string servAddr = $"";
#endregion Private Fields
}
}
+96
View File
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1B8191A0-DD4E-4320-878B-246A9B61C368}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EgwProxy.LiMan</RootNamespace>
<AssemblyName>EgwProxy.LiMan</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.1\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=111.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.111.2.0\lib\net471\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.3\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataSyncro.cs" />
<Compile Include="RestPayload.cs" />
<Compile Include="DTO\ReleaseDTO.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EgwProxy.LiMan")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EgwProxy.LiMan")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1b8191a0-dd4e-4320-878b-246a9b61c368")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+24
View File
@@ -0,0 +1,24 @@
using EgwProxy.LiMan.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.LiMan
{
public class RestPayload
{
public class ReleaseData
{
#region Public Properties
/// <summary>
/// Elenco record ReleaseDTO x verifica versioni disponibili
/// </summary>
public List<ReleaseDTO> ReleaseList { get; set; }
#endregion Public Properties
}
}
}
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="NLog" version="5.0.1" targetFramework="net462" />
<package id="RestSharp" version="111.2.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="8.0.3" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" requireReinstallation="true" />
</packages>
File diff suppressed because one or more lines are too long
@@ -21,7 +21,7 @@ namespace LiMan.APi.Controllers
/// <summary>
/// Classe per logging
/// </summary>
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
+108
View File
@@ -0,0 +1,108 @@
using LiMan.APi.Data;
using LiMan.DbSync.DbModels;
using LiMan.DbSync.Services;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.APi.Controllers
{
/// <summary>
/// Controller per sync tabelle standard
/// </summary>
[Route("api/dbsync")]
[ApiController]
public class DbSyncController : ControllerBase
{
#region Public Constructors
/// <summary>
/// Init generico
/// </summary>
/// <param name="DataService"></param>
public DbSyncController(ApiDataService DataService, DbSyncService SyncService)
{
mainDataService = DataService;
syncDataService = SyncService;
Log.Info("Avviata classe DbSyncController");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Recupera elenco dati Config x setup locale GET api/dbsync/conf/[id]?[CodApp]
/// </summary>
/// <param name="id">Codice cliente/Installazione</param>
/// <param name="CodApp">Codice Applicazione</param>
/// <returns></returns>
[HttpGet("conf/{id}")]
public async Task<List<ConfigModel>> Get(string id, string CodApp)
{
// ora recupero le info richieste dall'applicativo
List<ConfigModel> result = await syncDataService.ConfigGetAll(CodApp);
await mainDataService.recordCall(id, CodApp, $"GET:api/dbsync/conf/");
return result;
}
/// <summary>
/// Recupera elenco dati AnagKeyVal x setup locale GET api/dbsync/anagkeyval/[id]?[CodApp]
/// </summary>
/// <param name="id">Codice cliente/Installazione</param>
/// <param name="CodApp">Codice Applicazione</param>
/// <returns></returns>
[HttpGet("anagkeyval/{id}")]
public async Task<List<AnagKeyValueModel>> GetAnagKeyVal(string id, string CodApp)
{
// ora recupero le info richieste dall'applicativo
List<AnagKeyValueModel> result = await syncDataService.AnagKeyValGetAll(CodApp);
await mainDataService.recordCall(id, CodApp, $"GET:api/dbsync/anagkeyval/");
return result;
}
/// <summary>
/// Recupera elenco dati Vocabolario x setup locale GET api/dbsync/anagkeyval/[id]?[CodApp]
/// </summary>
/// <param name="id">Codice cliente/Installazione</param>
/// <param name="CodApp">Codice Applicazione</param>
/// <returns></returns>
[HttpGet("vocabolario/{id}")]
public async Task<List<VocabolarioModel>> GetVocabolario(string id, string CodApp)
{
// ora recupero le info richieste dall'applicativo
List<VocabolarioModel> result = await syncDataService.VocabolarioGetAll(CodApp);
await mainDataService.recordCall(id, CodApp, $"GET:api/dbsync/vocabolario/");
return result;
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected ApiDataService mainDataService { get; set; }
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected DbSyncService syncDataService { get; set; }
#endregion Protected Properties
#region Private Fields
/// <summary>
/// Classe per logging
/// </summary>
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
@@ -0,0 +1,99 @@
using LiMan.APi.Data;
using LiMan.DB.DTO;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NLog;
using System.Collections.Generic;
using System.Threading.Tasks;
namespace LiMan.APi.Controllers
{
/// <summary>
/// Controller gestione RELEASE applicativi
/// </summary>
[Route("api/release")]
[ApiController]
public class ReleaseController : ControllerBase
{
#region Public Constructors
/// <summary>
/// Init generico
/// </summary>
/// <param name="DataService"></param>
public ReleaseController(ApiDataService DataService)
{
dataService = DataService;
Log.Info("Avviata classe ReleaseController");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Recupera elenco dati licenza Applicativi (completo)
/// GET api/Release/EgtBW
/// </summary>
/// <param name="id">Codice Applicazione</param>
/// <returns></returns>
[HttpGet("{id}")]
public async Task<List<ReleaseDTO>> Get(string id)
{
var result = await dataService.ReleaseGetByApp(id);
await dataService.recordCall(id, id, $"GET:api/Release/{id}");
return result;
}
/// <summary>
/// Recupera elenco dati licenza Applicativi data versione minima
/// GET api/Release/EgtBW
/// </summary>
/// <param name="id">Codice Applicazione</param>
/// <param name="VersMin">Versione minima richiesta (attuale)</param>
/// <returns></returns>
[HttpGet("filt/{id}")]
public async Task<List<ReleaseDTO>> GetFilt(string id, string VersMin)
{
var result = await dataService.ReleaseGetByAppVers(id, VersMin);
await dataService.recordCall(id, id, $"GET:api/Release/filt/{id}");
return result;
}
/// <summary>
/// Recupera elenco dati licenza Applicativi data versione minima + vers limite
/// GET api/Release/EgtBW
/// </summary>
/// <param name="id">Codice Applicazione</param>
/// <param name="VersMin">Versione minima richiesta (attuale)</param>
/// <param name="VersMax">Versione massima consentita</param>
/// <returns></returns>
[HttpGet("filtLimit/{id}")]
public async Task<List<ReleaseDTO>> GetFiltLimit(string id, string VersMin, string VersMax)
{
var result = await dataService.ReleaseGetByAppVersLimit(id, VersMin, VersMax);
await dataService.recordCall(id, id, $"GET:api/Release/filt/{id}");
return result;
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected ApiDataService dataService { get; set; }
#endregion Protected Properties
#region Private Fields
/// <summary>
/// Classe per logging
/// </summary>
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
}
}
+106 -1
View File
@@ -28,7 +28,7 @@ namespace LiMan.APi.Data
/// <summary>
/// Classe Accesso metodi DB
/// </summary>
public static LiMan.DB.Controllers.DbController dbController;
public static DB.Controllers.DbController dbController;
#endregion Public Fields
@@ -88,6 +88,64 @@ namespace LiMan.APi.Data
return await Task.FromResult(dbResult);
}
/// <summary>
/// Elenco Release dato Applicativo
/// </summary>
/// <param name="CodApp">Codice Applicazione</param>
/// <returns></returns>
public async Task<List<ReleaseDTO>> ReleaseGetByApp(string CodApp)
{
await Task.Delay(1);
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.ReleaseDtoGetByApp(CodApp);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ReleaseDtoGetByApp | {CodApp} | {ts.TotalMilliseconds} ms");
return dbResult;
}
/// <summary>
/// Elenco Release dato Applicativo + versione minima
/// </summary>
/// <param name="CodApp">Codice Applicazione</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public async Task<List<ReleaseDTO>> ReleaseGetByAppVers(string CodApp, string VersMin)
{
await Task.Delay(1);
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.ReleaseDtoGetByAppVers(CodApp, VersMin);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ReleaseDtoGetByAppVers | {CodApp} | vers >= {VersMin} | {ts.TotalMilliseconds} ms");
return dbResult;
}
/// <summary>
/// Elenco Release dato Applicativo + versione minima
/// </summary>
/// <param name="CodApp">Codice Applicazione</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <param name="VersMax">Versione massima consentita</param>
/// <returns></returns>
public async Task<List<ReleaseDTO>> ReleaseGetByAppVersLimit(string CodApp, string VersMin, string VersMax)
{
await Task.Delay(1);
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
dbResult = dbController.ReleaseDtoGetByAppVersLimit(CodApp, VersMin, VersMax);
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per ReleaseDtoGetByAppVersLimit | {CodApp} | vers >= {VersMin} | {ts.TotalMilliseconds} ms");
return dbResult;
}
/// <summary>
/// Elenco licenze dato cliente
/// </summary>
@@ -357,6 +415,48 @@ namespace LiMan.APi.Data
return await Task.FromResult(dbResult);
}
/// <summary>
/// Statistiche del LOG chiamate all'API dato filtro
/// </summary>
/// <param name="DateFrom">Data minima</param>
/// <param name="DateTo">DataMax</param>
/// <param name="SearchVal">Valore cercato, se "" è tutti</param>
/// <returns></returns>
public async Task<List<StatsCallModel>> StatsLogCallGetFilt(DateTime DateFrom, DateTime DateTo, string SearchVal = "")
{
List<StatsCallModel> dbResult = new List<StatsCallModel>();
string cacheKey = $"{rKeyStatslogCall}:{DateFrom:yyyyMMdd}:{DateTo:yyyyMMdd}";
if(!string.IsNullOrEmpty(SearchVal))
{
cacheKey += $":{SearchVal}";
}
trackCache(cacheKey);
string rawData = await getRSV(cacheKey);
if (!string.IsNullOrEmpty(rawData))
{
dbResult = JsonConvert.DeserializeObject<List<StatsCallModel>>(rawData);
}
else
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
var rawResult = dbController.StatsLogCallGetFilt(DateFrom, DateTo, SearchVal);
dbResult = rawResult
.OrderByDescending(x => x.YearRef)
.ThenByDescending(x => x.TotCall)
.ToList();
if (dbResult != null)
{
rawData = JsonConvert.SerializeObject(dbResult);
await setRSV(cacheKey, rawData, shortTTL);
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Trace($"Effettuata lettura da DB per StatsLogCallGetFilt: {ts.TotalMilliseconds} ms");
}
return await Task.FromResult(dbResult);
}
/// <summary>
/// Effettua refresh del payload della licenza dato info + enigma generato dal client
/// </summary>
@@ -623,6 +723,11 @@ namespace LiMan.APi.Data
/// </summary>
protected const string rKeySampleVars = "LiMan.UI:SampleStats:Vars";
/// <summary>
/// Chiave redis x statistiche chiamate
/// </summary>
protected const string rKeyStatslogCall = "LiMan.UI:StatsLogCall";
/// <summary>
/// TTL da 1 min x cache Redis
/// </summary>
+8 -4
View File
@@ -28,16 +28,20 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.28" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.11" />
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.1.1" />
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.1.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.6.2" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\LiMan.DbSync\LiMan.DbSync.csproj" />
<ProjectReference Include="..\LiMan.DB\LiMan.DB.csproj" />
<ProjectReference Include="..\LiMan.GLS\LiMan.GLS.csproj" />
</ItemGroup>
+1 -1
View File
@@ -22,7 +22,7 @@
"dotnetRunMessages": "true",
"launchBrowser": true,
"launchUrl": "swagger",
"applicationUrl": "https://localhost:5001;http://localhost:5000",
"applicationUrl": "https://localhost:5003;http://localhost:5002",
"environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development"
}
+19
View File
@@ -1,5 +1,6 @@
using LiMan.APi.Data;
using LiMan.DB;
using LiMan.DbSync.Services;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
@@ -9,6 +10,7 @@ using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.FileProviders;
using Microsoft.Extensions.Hosting;
using Microsoft.OpenApi.Models;
using StackExchange.Redis;
using StackExchange.Redis.Extensions.Core.Configuration;
using StackExchange.Redis.Extensions.Newtonsoft;
using System;
@@ -135,6 +137,23 @@ namespace LiMan.Serv
{
return Configuration.GetSection("Redis").Get<RedisConfiguration>();
});
// REDIS setup
var redisConnString = Configuration.GetConnectionString("Redis");
string connStringRedis = redisConnString ?? "localhost:6379, DefaultDatabase=1, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false";
string redisSrvAddr = "127.0.0.1";
if (connStringRedis.IndexOf(":") >= 0)
{
redisSrvAddr = connStringRedis.Substring(0, connStringRedis.IndexOf(":"));
}
// avvio oggetto shared x redis...
var redisMultiplexer = ConnectionMultiplexer.Connect(connStringRedis);
// Add services x accesso dati
services.AddSingleton<IConnectionMultiplexer>(redisMultiplexer);
// aggiungo servizio sync DB
services.AddSingleton<DbSyncService>();
}
#endregion Public Methods
+463 -2
View File
@@ -2,11 +2,14 @@
using Core.DTO;
using LiMan.DB.DBModels;
using LiMan.DB.DTO;
using Microsoft.Data.SqlClient;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using NLog;
using Org.BouncyCastle.Asn1.Crmf;
using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
@@ -270,6 +273,246 @@ namespace LiMan.DB.Controllers
return fatto;
}
public List<AuthClaimModel> AuthClaimByUserID(int userID)
{
List<AuthClaimModel> dbResult = new List<AuthClaimModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
DateTime oggi = DateTime.Today;
dbResult = localDbCtx
.DbSetClaims
.Where(x => x.UserID == userID)
.ToList();
}
return dbResult;
}
public List<AuthClaimModel> AuthClaimByUserName(string userName)
{
List<AuthClaimModel> dbResult = new List<AuthClaimModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
DateTime oggi = DateTime.Today;
dbResult = localDbCtx
.DbSetClaims
.Where(x => x.UserNav.Username == userName)
.Include(r => r.RoleNav)
.ToList();
}
return dbResult;
}
public bool AuthClaimRemove(AuthClaimModel rec2del)
{
bool answ = false;
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
try
{
var currData = localDbCtx
.DbSetClaims
.Where(x => x.ClaimID == rec2del.ClaimID)
.FirstOrDefault();
if (currData != null)
{
localDbCtx
.DbSetClaims
.Remove(currData);
}
localDbCtx.SaveChanges();
answ = true;
}
catch (Exception exc)
{
Log.Error($"Errore in AuthClaimRemove | RoleID: {rec2del.RoleID} | UserId: {rec2del.UserID}{Environment.NewLine}{exc}");
}
}
return answ;
}
public bool AuthClaimUpsert(AuthClaimModel newRec)
{
bool answ = false;
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
try
{
var currData = localDbCtx
.DbSetClaims
.Where(x => x.ClaimID == newRec.ClaimID)
.FirstOrDefault();
if (currData != null)
{
currData.UserID = newRec.UserID;
currData.RoleID = newRec.RoleID;
currData.DtMod = DateTime.Now;
// segno aggiornato
localDbCtx.Entry(currData).State = EntityState.Modified;
}
else
{
localDbCtx
.DbSetClaims
.Add(newRec);
}
localDbCtx.SaveChanges();
answ = true;
}
catch (Exception exc)
{
Log.Error($"Errore in AuthClaimUpsert | ClaimID: {newRec.ClaimID} | UserID: {newRec.UserID} | RoleID: {newRec.RoleID}{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Rimozione di ogni Role Claim x utente (che diventa inattivo)
/// </summary>
/// <param name="UserId"></param>
/// <returns></returns>
public bool AuthRoleResetUser(int UserId)
{
bool answ = false;
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
try
{
var currData = localDbCtx
.DbSetClaims
.Where(x => x.UserID == UserId)
.ToList();
if (currData != null)
{
// rimuovo intero range...
localDbCtx
.DbSetClaims
.RemoveRange(currData);
}
localDbCtx.SaveChanges();
answ = true;
}
catch (Exception exc)
{
Log.Error($"Errore in AuthUserRemoveRoles | UserId: {UserId}{Environment.NewLine}{exc}");
}
}
return answ;
}
public List<AuthRoleModel> AuthRolesGetAll()
{
List<AuthRoleModel> dbResult = new List<AuthRoleModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
DateTime oggi = DateTime.Today;
dbResult = localDbCtx
.DbSetRoles
.ToList();
}
return dbResult;
}
public bool AuthRoleUpsert(AuthRoleModel newRec)
{
bool answ = false;
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
try
{
var currData = localDbCtx
.DbSetRoles
.Where(x => x.RoleID == newRec.RoleID)
.FirstOrDefault();
if (currData != null)
{
currData.Descrizione = newRec.Descrizione;
currData.Ruolo = newRec.Ruolo;
// segno aggiornato
localDbCtx.Entry(currData).State = EntityState.Modified;
}
else
{
localDbCtx
.DbSetRoles
.Add(newRec);
}
localDbCtx.SaveChanges();
answ = true;
}
catch (Exception exc)
{
Log.Error($"Errore in AuthRoleUpsert | RoleID: {newRec.RoleID} | Ruolo: {newRec.Ruolo}{Environment.NewLine}{exc}");
}
}
return answ;
}
public List<AuthUserModel> AuthUserAll()
{
List<AuthUserModel> dbResult = new List<AuthUserModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
dbResult = localDbCtx
.DbSetUsers
.Include(c => c.Claims)
.ThenInclude(r => r.RoleNav)
.ToList();
}
return dbResult;
}
public List<AuthUserModel> AuthUserGetFilt(string userName)
{
List<AuthUserModel> dbResult = new List<AuthUserModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
dbResult = localDbCtx
.DbSetUsers
.Where(x => x.Username == userName)
.ToList();
}
return dbResult;
}
public bool AuthUserUpsert(AuthUserModel newRec)
{
bool answ = false;
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
try
{
var currData = localDbCtx
.DbSetUsers
.Where(x => x.UserID == newRec.UserID)
.FirstOrDefault();
if (currData != null)
{
currData.Username = newRec.Username;
currData.AD_Domain = newRec.AD_Domain;
currData.AD_User = newRec.AD_User;
currData.Cognome = newRec.Cognome;
currData.Nome = newRec.Nome;
// segno aggiornato
localDbCtx.Entry(currData).State = EntityState.Modified;
}
else
{
localDbCtx
.DbSetUsers
.Add(newRec);
}
localDbCtx.SaveChanges();
answ = true;
}
catch (Exception exc)
{
Log.Error($"Errore in AuthUserUpsert | UserID: {newRec.UserID} | userName: {newRec.Username}{Environment.NewLine}{exc}");
}
}
return answ;
}
public bool DbForceMigrate()
{
bool answ = false;
@@ -558,8 +801,25 @@ namespace LiMan.DB.Controllers
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
dbResult = localDbCtx
.DbSetApp
.ToList();
.DbSetApp
.ToList();
}
return dbResult;
}
public ApplicativoModel GetApplicazioniFilt(string codApp)
{
ApplicativoModel dbResult = new ApplicativoModel();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
var rawData = localDbCtx
.DbSetApp
.Where(x => x.CodApp == codApp)
.FirstOrDefault();
if (rawData != null)
{
dbResult = rawData;
}
}
return dbResult;
}
@@ -903,6 +1163,183 @@ namespace LiMan.DB.Controllers
return fatto;
}
public bool ReleaseDelete(ReleaseModel rec2del)
{
bool fatto = false;
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
// cerco record esistente...
var currRec = localDbCtx
.DbSetReleases
.Where(x => x.IdxRel == rec2del.IdxRel && rec2del.IdxRel > 0)
.FirstOrDefault();
if (currRec != null)
{
localDbCtx
.DbSetReleases
.Remove(currRec);
// salvo
localDbCtx.SaveChanges();
}
fatto = true;
}
return fatto;
}
/// <summary>
/// Elenco release (completo) dato un applicativo applicativi
/// </summary>
/// <param name="CodApp">Codice applicativo</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseDtoGetByApp(string CodApp)
{
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
var rawData = ReleaseGetByApp(CodApp);
dbResult = rawData
.Select(x => new ReleaseDTO()
{
CodApp = x.CodApp,
ReleaseDate = x.ReleaseDate,
VersNum = x.VersNum,
VersText = x.VersText
}).
ToList();
return dbResult;
}
/// <summary>
/// Elenco release (completo) dato un applicativo applicativi
/// </summary>
/// <param name="CodApp">Codice applicativo</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseDtoGetByAppVers(string CodApp, string MinVers)
{
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
var rawData = ReleaseGetByAppVers(CodApp, MinVers);
dbResult = rawData
.Select(x => new ReleaseDTO()
{
CodApp = x.CodApp,
ReleaseDate = x.ReleaseDate,
VersNum = x.VersNum,
VersText = x.VersText,
VersVal = x.VersVal
}).
ToList();
return dbResult;
}
/// <summary>
/// Elenco release (completo) dato un applicativo applicativi
/// </summary>
/// <param name="CodApp">Codice applicativo</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <param name="VersMax">Versione massima consentita</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseDtoGetByAppVersLimit(string CodApp, string VersMin, string VersMax)
{
List<ReleaseDTO> dbResult = new List<ReleaseDTO>();
Version versLimit = new Version(VersMax);
var rawData = ReleaseGetByAppVers(CodApp, VersMin);
dbResult = rawData
.Select(x => new ReleaseDTO()
{
CodApp = x.CodApp,
ReleaseDate = x.ReleaseDate,
VersNum = x.VersNum,
VersText = x.VersText,
VersVal = x.VersVal,
IsPermitted = x.VersVal <= versLimit
}).
ToList();
return dbResult;
}
/// <summary>
/// Elenco release (completo) dato un applicativo applicativi
/// </summary>
/// <param name="CodApp">Codice applicativo</param>
/// <returns></returns>
public List<ReleaseModel> ReleaseGetByApp(string CodApp)
{
List<ReleaseModel> dbResult = new List<ReleaseModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
// calcolo DTO applicativi
dbResult = localDbCtx
.DbSetReleases
.Where(x => (x.CodApp.ToLower() == CodApp.ToLower()))
.OrderBy(o => o.ReleaseDate)
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco release (completo) dato un applicativo applicativi
/// </summary>
/// <param name="CodApp">Codice applicativo</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public List<ReleaseModel> ReleaseGetByAppVers(string CodApp, string MinVers)
{
List<ReleaseModel> dbResult = new List<ReleaseModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
Version mVers = new Version(MinVers);
// calcolo DTO applicativi
dbResult = localDbCtx
.DbSetReleases
.ToList();
// verifico per il criterio versione...
dbResult = dbResult
.Where(x => x.VersVal >= mVers)
.OrderBy(o => o.ReleaseDate)
.ToList();
}
return dbResult;
}
/// <summary>
/// Upsert Record Release
/// </summary>
/// <param name="currItem"></param>
/// <returns></returns>
public async Task<bool> ReleaseUpsert(ReleaseModel currItem)
{
bool fatto = false;
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
// cerco record esistente...
var currRec = localDbCtx
.DbSetReleases
.Where(x => x.IdxRel == currItem.IdxRel && currItem.IdxRel > 0)
.FirstOrDefault();
if (currRec != null)
{
// se trovo aggiorno
currRec.VersNum = currItem.VersNum;
currRec.VersText = currItem.VersText;
currRec.ReleaseDate = currItem.ReleaseDate;
localDbCtx.Entry(currRec).State = EntityState.Modified;
}
else
{
//altrimenti aggiungo
localDbCtx
.DbSetReleases
.Add(currItem);
}
// salvo
await localDbCtx.SaveChangesAsync();
fatto = true;
}
return fatto;
}
/// <summary>
/// Annulla modifiche su una specifica entity (cancel update)
/// </summary>
@@ -928,6 +1365,30 @@ namespace LiMan.DB.Controllers
return answ;
}
/// <summary>
/// Statistiche del LOGchiamate all'API dato filtro
/// </summary>
/// <param name="DateFrom">Data minima</param>
/// <param name="DateTo">DataMax</param>
/// <param name="SearchVal">Valore cercato, se "" è tutti</param>
/// <returns></returns>
public List<StatsCallModel> StatsLogCallGetFilt(DateTime DateFrom, DateTime DateTo, string SearchVal = "")
{
List<StatsCallModel> dbResult = new List<StatsCallModel>();
using (LMDbContext localDbCtx = new LMDbContext(_configuration))
{
var dtFrom = new SqlParameter("@DateFrom", DateFrom);
var dtTo = new SqlParameter("@DateTo", DateTo);
var srcVal = new SqlParameter("@SearchVal", SearchVal);
dbResult = localDbCtx
.DbSetStatCall
.FromSqlRaw("exec dbo.stp_StatsCall_filt @DateFrom, @DateTo, @SearchVal", dtFrom, dtTo, srcVal)
.AsNoTracking()
.ToList();
}
return dbResult;
}
public bool TicketAddNew(SupportRequest currRequest)
{
bool fatto = false;
+4 -12
View File
@@ -11,25 +11,17 @@ namespace LiMan.DB.DBModels
[Table("Applicativi")]
public partial class ApplicativoModel
{
#region Public Constructors
//public Applicativo()
//{
// LicenzeAttives = new HashSet<Licenza>();
//}
#endregion Public Constructors
#region Public Properties
[Key]
[MaxLength(50)]
public string CodApp { get; set; }
public string CodApp { get; set; } = "";
[MaxLength(250)]
public string Descrizione { get; set; }
public string Descrizione { get; set; } = "";
//public virtual ICollection<Licenza> LicenzeAttives { get; set; }
[MaxLength(2500)]
public string TplConnString { get; set; } = "";
#endregion Public Properties
}
+36
View File
@@ -0,0 +1,36 @@
using Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static Core.Enum;
#nullable disable
namespace LiMan.DB.DBModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("AuthClaims")]
public partial class AuthClaimModel
{
#region Public Properties
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int ClaimID { get; set; }
public int RoleID { get; set; }
public int UserID { get; set; }
public DateTime DtIns { get; set; } = DateTime.MinValue;
public DateTime DtMod { get; set; } = DateTime.Now;
[ForeignKey("RoleID")]
public virtual AuthRoleModel RoleNav { get; set; }
[ForeignKey("UserID")]
public virtual AuthUserModel UserNav { get; set; }
#endregion Public Properties
}
}
+34
View File
@@ -0,0 +1,34 @@
using Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static Core.Enum;
#nullable disable
namespace LiMan.DB.DBModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("AuthRoles")]
public partial class AuthRoleModel
{
#region Public Properties
public AuthRoleModel()
{
Claims = new HashSet<AuthClaimModel>();
}
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int RoleID { get; set; }
public string Ruolo { get; set; }
public string Descrizione { get; set; }
public virtual ICollection<AuthClaimModel> Claims { get; set; }
#endregion Public Properties
}
}
+44
View File
@@ -0,0 +1,44 @@
using Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using static Core.Enum;
#nullable disable
namespace LiMan.DB.DBModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("AuthUsers")]
public partial class AuthUserModel
{
#region Public Properties
public AuthUserModel()
{
Claims = new HashSet<AuthClaimModel>();
}
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int UserID { get; set; }
public string Username { get; set; }
public string AD_Domain { get; set; } = "";
public string AD_User { get; set; } = "";
public string Cognome { get; set; } = "Cognome";
public string Nome { get; set; } = "Nome";
public virtual ICollection<AuthClaimModel> Claims { get; set; }
[NotMapped]
public bool IsActive
{
get => Claims != null && Claims.Count > 0;
}
#endregion Public Properties
}
}
+49
View File
@@ -0,0 +1,49 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DB.DBModels
{
[Table("Releases")]
public partial class ReleaseModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxRel { get; set; }
/// <summary>
/// Codice/Nome applicativo
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// Versione applicativo formato semver numerico 4 blocchi
/// </summary>
public string VersNum { get; set; } = "0.0.0.0";
/// <summary>
/// Versione applicativo, formato testuale libero, può essere uguale a VersNum
/// </summary>
public string VersText { get; set; } = "0.1a2";
/// <summary>
/// Versione (calcolata) a partire dal valore Num
/// </summary>
[NotMapped]
public Version VersVal
{
get =>!string.IsNullOrEmpty(VersNum) ? new Version(VersNum): new Version();
}
/// <summary>
/// Data di release
/// </summary>
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
[ForeignKey("CodApp")]
public virtual ApplicativoModel ApplicativoNav { get; set; }
}
}
+20
View File
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DB.DBModels
{
public partial class StatsCallModel
{
#region Public Properties
public int YearRef { get; set; } = 0;
public string CodInst { get; set; } = "";
public string CodApp { get; set; } = "";
public int TotCall { get; set; } = 0;
#endregion Public Properties
}
}
+75
View File
@@ -0,0 +1,75 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Core.Enum;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace LiMan.DB.DTO
{
public class ReleaseDTO
{
/// <summary>
/// Codice/Nome applicativo
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// Versione applicativo formato semver numerico 4 blocchi
/// </summary>
public string VersNum { get; set; } = "0.0.0.0";
/// <summary>
/// Versione applicativo, formato testuale libero, può essere uguale a VersNum
/// </summary>
public string VersText { get; set; } = "a.b";
/// <summary>
/// Oggetto versione calcolato da VersNum
/// </summary>
public Version VersVal { get; set; } = new Version();
/// <summary>
/// Verifica se sia permessa la versione quando viene valutata la versione massima consentita
/// </summary>
public bool IsPermitted { get; set; } = false;
/// <summary>
/// Data di release
/// </summary>
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
/// <summary>
/// Url pagina web di changelog (traduzione gestita sul sito target) - calcolato da CodApp + vers
/// </summary>
//public string UrlChangelog { get; set; } = "http://releases.egalware.com";
[NotMapped]
public string UrlChangelog
{
get => $"https://releases.egalware.com/{CodApp}/{VersText}".ToLower();
}
/// <summary>
/// Url pagina web di changelog estesa (traduzione gestita sul sito target) - calcolato da CodApp + vers
/// </summary>
//public string UrlChangelogExt { get; set; } = "http://releases.egalware.com";
[NotMapped]
public string UrlChangelogExt
{
get => $"https://releases.egalware.com/ext_{CodApp}/{VersText}".ToLower();
}
/// <summary>
/// Attivo/Pubblico (qui calcolato, attivo se la data di release è passata, poi potrebbe essere gestito a parte da DB)
/// </summary>
[NotMapped]
public bool IsActive
{
get => (DateTime.Today.Subtract(ReleaseDate).TotalDays >= 0);
}
}
}
+16 -1
View File
@@ -56,6 +56,11 @@ namespace LiMan.DB
public virtual DbSet<LogLicenzaModel> DbSetLogLicenze { get; set; }
public virtual DbSet<SubLicenzaModel> DbSetSubLicenze { get; set; }
public virtual DbSet<TicketModel> DbSetTicket { get; set; }
public virtual DbSet<StatsCallModel> DbSetStatCall { get; set; }
public virtual DbSet<AuthUserModel> DbSetUsers { get; set; }
public virtual DbSet<AuthRoleModel> DbSetRoles { get; set; }
public virtual DbSet<AuthClaimModel> DbSetClaims { get; set; }
public virtual DbSet<ReleaseModel> DbSetReleases { get; set; }
#endregion Public Properties
@@ -75,7 +80,9 @@ namespace LiMan.DB
}
else
{
optionsBuilder.UseSqlServer("Server=SQLSTEAM;Database=LiMan.DB;Trusted_Connection=True;");
//optionsBuilder.UseSqlServer("Server=SQLSTEAM;Database=LiMan.DB;Trusted_Connection=True;");
optionsBuilder.UseSqlServer("Server=W2019-SQL-STEAM;Database=LiMan.DB;Trusted_Connection=True;");
//optionsBuilder.UseSqlServer("Server=W2019-SQL-STEAM;Database=LiMan.DB;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=LiMan.UI");
}
}
}
@@ -89,6 +96,14 @@ namespace LiMan.DB
entity.HasKey(e => new { e.DataRif, e.CodInst, e.CodApp, e.TargetUrl });
});
modelBuilder.Entity<StatsCallModel>(entity =>
{
entity.HasKey(e => new { e.YearRef, e.CodInst, e.CodApp });
entity.ToView("v_StatsCall");
});
OnModelCreatingPartial(modelBuilder);
}
+17 -8
View File
@@ -6,20 +6,29 @@
<ItemGroup>
<PackageReference Include="MailKit" Version="2.15.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
<PackageReference Include="NLog" Version="4.7.13" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.28" />
<PackageReference Include="NLog" Version="5.3.2" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
</ItemGroup>
<ItemGroup>
<None Update="SqlScripts\Stored\stp_StatsCall_filt.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="SqlScripts\Views\v_StatsCall.sql">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>
@@ -13,7 +13,7 @@ namespace LiMan.DB.Migrations
{
IdxTicket = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DtReq = table.Column<DateTime>(type: "datetime2", nullable: false),
DtReq = table.Column<DateTime>(type: "datetime", nullable: false, defaultValue: DateTime.Now, defaultValueSql: "GETDATE()"),
Tipo = table.Column<int>(type: "int", nullable: false),
IdxLic = table.Column<int>(type: "int", nullable: false),
IdxSubLic = table.Column<int>(type: "int", nullable: false),
@@ -0,0 +1,401 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20240531171929_AddViewAndStored01")]
partial class AddViewAndStored01
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.9")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,50 @@
using Microsoft.EntityFrameworkCore.Migrations;
using System.IO;
using System.Reflection;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class AddViewAndStored01 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
// aggiunta views
addView(migrationBuilder, "v_StatsCall");
// aggiunta stored
addStored(migrationBuilder, "stp_StatsCall_filt");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
// rimozione stored
remStored(migrationBuilder, "stp_StatsCall_filt");
// rimozione views
remView(migrationBuilder, "v_StatsCall");
}
private void addView(MigrationBuilder migrationBuilder, string viewName)
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SqlScripts", "Views", $"{viewName}.sql");
string viewBody = File.ReadAllText(path);
migrationBuilder.Sql(viewBody);
}
private void addStored(MigrationBuilder migrationBuilder, string objName)
{
string path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "SqlScripts", "Stored", $"{objName}.sql");
string viewBody = File.ReadAllText(path);
migrationBuilder.Sql(viewBody);
}
private void remView(MigrationBuilder migrationBuilder, string viewName)
{
migrationBuilder.Sql($"EXEC('DROP VIEW IF EXISTS dbo.{viewName}');");
}
private void remStored(MigrationBuilder migrationBuilder, string objName)
{
migrationBuilder.Sql($"EXEC('DROP PROCEDURE IF EXISTS dbo.{objName}');");
}
}
}
@@ -0,0 +1,500 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20240713132356_AddUserRoleClaim01")]
partial class AddUserRoleClaim01
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,92 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class AddUserRoleClaim01 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AuthRoles",
columns: table => new
{
RoleID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Ruolo = table.Column<string>(type: "nvarchar(max)", nullable: true),
Descrizione = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AuthRoles", x => x.RoleID);
});
migrationBuilder.CreateTable(
name: "AuthUsers",
columns: table => new
{
UserID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Username = table.Column<string>(type: "nvarchar(max)", nullable: true),
AD_Domain = table.Column<string>(type: "nvarchar(max)", nullable: true),
AD_User = table.Column<string>(type: "nvarchar(max)", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_AuthUsers", x => x.UserID);
});
migrationBuilder.CreateTable(
name: "AuthClaims",
columns: table => new
{
ClaimID = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
RoleID = table.Column<int>(type: "int", nullable: false),
UserID = table.Column<int>(type: "int", nullable: false),
DtIns = table.Column<DateTime>(type: "datetime2", nullable: false),
DtMod = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AuthClaims", x => x.ClaimID);
table.ForeignKey(
name: "FK_AuthClaims_AuthRoles_RoleID",
column: x => x.RoleID,
principalTable: "AuthRoles",
principalColumn: "RoleID",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_AuthClaims_AuthUsers_UserID",
column: x => x.UserID,
principalTable: "AuthUsers",
principalColumn: "UserID",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_AuthClaims_RoleID",
table: "AuthClaims",
column: "RoleID");
migrationBuilder.CreateIndex(
name: "IX_AuthClaims_UserID",
table: "AuthClaims",
column: "UserID");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AuthClaims");
migrationBuilder.DropTable(
name: "AuthRoles");
migrationBuilder.DropTable(
name: "AuthUsers");
}
}
}
@@ -0,0 +1,506 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20240715060405_AddUserRoleClaim02")]
partial class AddUserRoleClaim02
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Cognome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Nome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class AddUserRoleClaim02 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Cognome",
table: "AuthUsers",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Nome",
table: "AuthUsers",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Cognome",
table: "AuthUsers");
migrationBuilder.DropColumn(
name: "Nome",
table: "AuthUsers");
}
}
}
@@ -0,0 +1,510 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20240718060756_AddTplConnString01")]
partial class AddTplConnString01
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("TplConnString")
.HasMaxLength(2500)
.HasColumnType("nvarchar(2500)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Cognome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Nome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,26 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class AddTplConnString01 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "TplConnString",
table: "Applicativi",
type: "nvarchar(2500)",
maxLength: 2500,
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "TplConnString",
table: "Applicativi");
}
}
}
@@ -0,0 +1,546 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20240806142953_AddRelModel01")]
partial class AddRelModel01
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("TplConnString")
.HasMaxLength(2500)
.HasColumnType("nvarchar(2500)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Cognome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Nome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.Property<int>("IdxRel")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxRel"), 1L, 1);
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("ReleaseDate")
.HasColumnType("datetime2");
b.Property<string>("VersNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("VersText")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxRel");
b.HasIndex("CodApp");
b.ToTable("Releases");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -0,0 +1,45 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class AddRelModel01 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Releases",
columns: table => new
{
IdxRel = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CodApp = table.Column<string>(type: "nvarchar(50)", nullable: true),
VersNum = table.Column<string>(type: "nvarchar(max)", nullable: true),
VersText = table.Column<string>(type: "nvarchar(max)", nullable: true),
ReleaseDate = table.Column<DateTime>(type: "datetime", nullable: false, defaultValue: DateTime.Now, defaultValueSql: "GETDATE()")
},
constraints: table =>
{
table.PrimaryKey("PK_Releases", x => x.IdxRel);
table.ForeignKey(
name: "FK_Releases_Applicativi_CodApp",
column: x => x.CodApp,
principalTable: "Applicativi",
principalColumn: "CodApp");
});
migrationBuilder.CreateIndex(
name: "IX_Releases_CodApp",
table: "Releases",
column: "CodApp");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Releases");
}
}
}
+186 -14
View File
@@ -6,6 +6,8 @@ using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
@@ -15,10 +17,11 @@ namespace LiMan.DB.Migrations
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("Relational:MaxIdentifierLength", 128)
.HasAnnotation("ProductVersion", "5.0.10")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
@@ -30,17 +33,98 @@ namespace LiMan.DB.Migrations
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("TplConnString")
.HasMaxLength(2500)
.HasColumnType("nvarchar(2500)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Cognome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Nome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
@@ -95,8 +179,9 @@ namespace LiMan.DB.Migrations
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
@@ -166,8 +251,9 @@ namespace LiMan.DB.Migrations
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
@@ -204,12 +290,59 @@ namespace LiMan.DB.Migrations
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.Property<int>("IdxRel")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxRel"), 1L, 1);
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("ReleaseDate")
.HasColumnType("datetime2");
b.Property<string>("VersNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("VersText")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxRel");
b.HasIndex("CodApp");
b.ToTable("Releases");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
@@ -237,8 +370,9 @@ namespace LiMan.DB.Migrations
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int")
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
@@ -289,6 +423,25 @@ namespace LiMan.DB.Migrations
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
@@ -338,6 +491,15 @@ namespace LiMan.DB.Migrations
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
@@ -360,6 +522,16 @@ namespace LiMan.DB.Migrations
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
@@ -0,0 +1,47 @@
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP PROCEDURE IF EXISTS dbo.stp_StatsCall_filt;
GO
/*-- =============================================
-- Author: S.E.L.
-- Description: Estrazione dati statistiche call filtrati
EXEC dbo.stp_StatsCall_filt '2024-01-01', GETDATE(), ''
-- Mod. date: 2024.05.31
-- =============================================*/
CREATE PROCEDURE [dbo].[stp_StatsCall_filt]
(
@DtFrom DATETIME
,@DtTo DATETIME
,@SearchVal NVARCHAR(250)
)
AS
BEGIN
SET NOCOUNT ON;
SET XACT_ABORT ON;
WITH cteDati AS
(
SELECT YEAR(DataRif) AS YearRef, CodInst, CodApp, SUM(NumCall) AS TotCall
FROM LogCall
WHERE DataRif BETWEEN @DtFrom and @DtTo
AND (@SearchVal = '' OR TargetUrl LIKE '%'+@SearchVal+'%')
GROUP BY YEAR(DataRif), CodInst, CodApp
)
SELECT *
FROM cteDati
ORDER BY YearRef DESC, TotCall DESC
END
GO
+23
View File
@@ -0,0 +1,23 @@
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
DROP VIEW IF EXISTS dbo.v_StatsCall;
GO
CREATE VIEW [dbo].[v_StatsCall]
AS
WITH cteDati AS
(
SELECT YEAR(DataRif) AS YearRef, CodInst, CodApp, SUM(NumCall) AS TotCall
FROM LogCall
GROUP BY YEAR(DataRif), CodInst, CodApp
)
SELECT *
FROM cteDati
GO
@@ -0,0 +1,91 @@
using LiMan.DbSync.DbModels;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DbSync.Controllers
{
public class DbSyncController : IDisposable
{
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Public Constructors
public DbSyncController()
{
}
#endregion Public Constructors
#region Public Methods
public void Dispose()
{
// Clear database context
Log.Info("Dispose di DbSyncController");
}
/// <summary>
/// Elenco record AnagKeyVal
/// </summary>
/// <param name="cString">stringa connessione al DB da sincronizzare</param>
/// <returns></returns>
public List<AnagKeyValueModel> AnagKeyValGetAll(string cString)
{
List<AnagKeyValueModel> dbResult = new List<AnagKeyValueModel>();
using (LMDbSyncContext dbCtx = new LMDbSyncContext(cString))
{
dbResult = dbCtx
.DbSetAnagKeyVal
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco record Config
/// </summary>
/// <param name="cString">stringa connessione al DB da sincronizzare</param>
/// <returns></returns>
public List<ConfigModel> ConfigGetAll(string cString)
{
List<ConfigModel> dbResult = new List<ConfigModel>();
using (LMDbSyncContext dbCtx = new LMDbSyncContext(cString))
{
dbResult = dbCtx
.DbSetConfig
.ToList();
}
return dbResult;
}
/// <summary>
/// Elenco record Vocabolario
/// </summary>
/// <param name="cString">stringa connessione al DB da sincronizzare</param>
/// <returns></returns>
public List<VocabolarioModel> VocabolarioGetAll(string cString)
{
List<VocabolarioModel> dbResult = new List<VocabolarioModel>();
using (LMDbSyncContext dbCtx = new LMDbSyncContext(cString))
{
dbResult = dbCtx
.DbSetVocabolario
.ToList();
}
return dbResult;
}
#endregion Public Methods
}
}
@@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace LiMan.DbSync.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("AnagKeyValue")]
public partial class AnagKeyValueModel
{
#region Public Properties
[Key, Column("nomeVar")]
public string NomeVar { get; set; } = "";
[Column("valInt")]
public int? ValInt { get; set; }
[Column("valFloat")]
public double? ValFloat { get; set; }
[Column("valString")]
public string ValString { get; set; } = "";
[Column("descrizione")]
public string Descrizione { get; set; } = "";
#endregion Public Properties
}
}
+30
View File
@@ -0,0 +1,30 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace LiMan.DbSync.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("Config")]
public partial class ConfigModel
{
#region Public Properties
[Key, Column("chiave")]
public string Chiave { get; set; } = "";
[Column("valore")]
public string Valore { get; set; } = "";
[Column("valoreStd")]
public string ValoreStd { get; set; } = "";
[Column("note")]
public string Note { get; set; } = "";
#endregion Public Properties
}
}
+24
View File
@@ -0,0 +1,24 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DbSync.DbModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
[Table("Vocabolario")]
public partial class VocabolarioModel
{
#region Public Properties
public string Lemma { get; set; } = "";
public string Lingua { get; set; } = "";
public string Traduzione { get; set; } = "";
#endregion Public Properties
}
}
+133
View File
@@ -0,0 +1,133 @@
using System;
using LiMan.DbSync.DbModels;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.Extensions.Configuration;
using NLog;
#nullable disable
namespace LiMan.DbSync
{
public partial class LMDbSyncContext : Microsoft.EntityFrameworkCore.DbContext
{
#region Private Fields
private static Logger Log = LogManager.GetCurrentClassLogger();
private IConfiguration _configuration;
#endregion Private Fields
#region Public Constructors
[Obsolete("This constructor should never be used directly, and is only needed to generate entityframework stuff. Connection string can be adapted as pleased.")]
public LMDbSyncContext()
{
}
public LMDbSyncContext(string cString)
{
connString = cString;
}
public LMDbSyncContext(IConfiguration configuration)
{
_configuration = configuration;
}
public LMDbSyncContext(DbContextOptions<LMDbSyncContext> options) : base(options)
{
try
{
// se non ci fosse... crea o migra!
Database.Migrate();
}
catch (Exception exc)
{
Log.Error(exc, "Exception during context initialization 02");
}
}
#endregion Public Constructors
#region Public Properties
public virtual DbSet<AnagKeyValueModel> DbSetAnagKeyVal { get; set; }
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
public virtual DbSet<VocabolarioModel> DbSetVocabolario { get; set; }
#endregion Public Properties
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
private string connString = "";
#region Protected Methods
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
if (!optionsBuilder.IsConfigured)
{
// se vuota rileggo da json
if (string.IsNullOrEmpty(connString))
{
connString = _configuration.GetConnectionString("LiMan.DB");
}
if (!string.IsNullOrEmpty(connString))
{
optionsBuilder.UseSqlServer(connString);
}
else
{
//optionsBuilder.UseSqlServer("Server=SQLSTEAM;Database=LiMan.DB;Trusted_Connection=True;");
optionsBuilder.UseSqlServer("Server=W2019-SQL-STEAM;Database=LiMan.DB;Trusted_Connection=True;");
//optionsBuilder.UseSqlServer("Server=W2019-SQL-STEAM;Database=LiMan.DB;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=LiMan.UI");
}
}
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
modelBuilder.Entity<VocabolarioModel>(entity =>
{
entity.HasKey(e => new { e.Lingua, e.Lemma });
entity.ToTable("Vocabolario");
entity.Property(e => e.Lingua).HasMaxLength(3);
entity.Property(e => e.Lemma).HasMaxLength(50);
entity.Property(e => e.Traduzione)
.IsRequired()
.HasMaxLength(500);
});
OnModelCreatingPartial(modelBuilder);
}
#endregion Protected Methods
#region Public Methods
public void DbForceMigrate()
{
try
{
// se non ci fosse... crea o migra!
Database.Migrate();
Log.Info("DbForceMigrate: done!");
}
catch (Exception exc)
{
Log.Error(exc, "DbForceMigrate: Exception during context initialization 01");
}
}
#endregion Public Methods
}
}
+30
View File
@@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<Folder Include="Migrations\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.28" />
<PackageReference Include="NLog" Version="5.3.2" />
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Core\Core.csproj" />
<ProjectReference Include="..\LiMan.DB\LiMan.DB.csproj" />
</ItemGroup>
</Project>
+136
View File
@@ -0,0 +1,136 @@
using Core;
using Microsoft.Extensions.Configuration;
using NLog;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DbSync.Services
{
/// <summary>
/// Classe di partenza x costruzione servizi di accesso dati + cache
/// </summary>
public class BaseServ
{
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
protected IConfiguration _configuration = null!;
/// <summary>
/// Durata cache lunga IN SECONDI
/// </summary>
protected int cacheTtlLong = 60 * 5;
/// <summary>
/// Durata cache breve IN SECONDI
/// </summary>
protected int cacheTtlShort = 60 * 1;
/// <summary>
/// Oggetto per connessione a REDIS
/// </summary>
protected IConnectionMultiplexer redisConn = null!;
/// <summary>
/// Oggetto DB redis da impiegare x chiamate R/W
/// </summary>
protected IDatabase redisDb = null!;
protected Random rnd = new Random();
#endregion Protected Fields
#region Protected Properties
/// <summary>
/// Durata cache breve (1 min circa + perturbazione percentuale +/-10%)
/// </summary>
protected TimeSpan FastCache
{
get => TimeSpan.FromSeconds(cacheTtlShort * rnd.Next(900, 1100) / 1000);
}
/// <summary>
/// Durata cache lunga (+ perturbazione percentuale +/-10%)
/// </summary>
protected TimeSpan LongCache
{
get => TimeSpan.FromSeconds(cacheTtlLong * rnd.Next(900, 1100) / 1000);
}
/// <summary>
/// Durata cache MOLTO breve (10 sec circa + perturbazione percentuale +/-10%)
/// </summary>
protected TimeSpan UltraFastCache
{
get => TimeSpan.FromSeconds(cacheTtlShort / 6 * rnd.Next(900, 1100) / 1000);
}
/// <summary>
/// Durata cache MOLTO lunga (+ perturbazione percentuale +/-10%)
/// </summary>
protected TimeSpan UltraLongCache
{
get => TimeSpan.FromSeconds(cacheTtlLong * 10 * rnd.Next(900, 1100) / 1000);
}
#endregion Protected Properties
#region Public Methods
/// <summary>
/// Refresh globale cache redis
/// </summary>
/// <returns></returns>
public async Task<bool> FlushRedisCache()
{
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
await Task.Delay(1);
RedisValue pattern = new RedisValue($"{Const.rKeyConfig}:*");
bool answ = await ExecFlushRedisPattern(pattern);
stopWatch.Stop();
Log.Debug($"FlushRedisCache in {stopWatch.Elapsed.TotalMilliseconds} ms");
return answ;
}
#endregion Public Methods
#region Protected Methods
/// <summary>
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pattern"></param>
/// <returns></returns>
protected async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
var listEndpoints = redisConn.GetEndPoints();
foreach (var endPoint in listEndpoints)
{
//var server = redisConnAdmin.GetServer(listEndpoints[0]);
var server = redisConn.GetServer(endPoint);
if (server != null)
{
var keyList = server.Keys(redisDb.Database, pattern);
foreach (var item in keyList)
{
await redisDb.KeyDeleteAsync(item);
}
answ = true;
}
}
return answ;
}
#endregion Protected Methods
}
}
+264
View File
@@ -0,0 +1,264 @@
using Core;
using LiMan.DbSync.Controllers;
using LiMan.DbSync.DbModels;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DbSync.Services
{
public class DbSyncService : BaseServ
{
#region Public Constructors
public DbSyncService(IConfiguration configuration, IConnectionMultiplexer redisConnMult)
{
Log.Info("DbSyncService starting...");
_configuration = configuration;
// Conf cache
redisConn = redisConnMult;
redisDb = this.redisConn.GetDatabase();
// json serializer... FIX errore loop circolare https://www.ryadel.com/en/jsonserializationexception-self-referencing-loop-detected-error-fix-entity-framework-asp-net-core/
JSSettings = new JsonSerializerSettings()
{
ReferenceLoopHandling = ReferenceLoopHandling.Ignore
};
// cod app
CodApp = _configuration["CodApp"];
dbController = new DbSyncController();
TplController = new DB.Controllers.DbController(configuration);
// chiudo log
Log.Info("DbSyncService started!");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Elenco record AnagKeyVal
/// </summary>
/// <param name="appName">nome APP del DB da sincronizzare</param>
/// <returns></returns>
public async Task<List<AnagKeyValueModel>> AnagKeyValGetAll(string appName)
{
string source = "DB";
string cString = ConnString(appName);
List<AnagKeyValueModel>? dbResult = new List<AnagKeyValueModel>();
try
{
string currKey = $"{Const.rKeyConfig}:DbSync:AnagKeyVal";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<AnagKeyValueModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<AnagKeyValueModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.AnagKeyValGetAll(cString);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
// per evitare loopback uso deserialize...
var tempResult = JsonConvert.DeserializeObject<List<AnagKeyValueModel>>(rawData);
if (tempResult != null)
{
dbResult = tempResult;
}
}
if (dbResult == null)
{
dbResult = new List<AnagKeyValueModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"AnagKeyValGetAll | {source} in: {ts.TotalMilliseconds} ms");
}
catch (Exception exc)
{
Log.Error($"Error during AnagKeyValGetAll:{Environment.NewLine}{exc}");
}
return dbResult;
}
/// <summary>
/// Elenco record Config
/// </summary>
/// <param name="appName">nome APP del DB da sincronizzare</param>
/// <returns></returns>
public async Task<List<ConfigModel>> ConfigGetAll(string appName)
{
string source = "DB";
string cString = ConnString(appName);
List<ConfigModel>? dbResult = new List<ConfigModel>();
if (!string.IsNullOrEmpty(cString))
{
try
{
string currKey = $"{Const.rKeyConfig}:DbSync:Config";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<ConfigModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<ConfigModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.ConfigGetAll(cString);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
// per evitare loopback uso deserialize...
var tempResult = JsonConvert.DeserializeObject<List<ConfigModel>>(rawData);
if (tempResult != null)
{
dbResult = tempResult;
}
}
if (dbResult == null)
{
dbResult = new List<ConfigModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"ConfigGetAll | {source} in: {ts.TotalMilliseconds} ms");
}
catch (Exception exc)
{
Log.Error($"Error during ConfigGetAll:{Environment.NewLine}{exc}");
}
}
return dbResult;
}
/// <summary>
/// Elenco record Vocabolario
/// </summary>
/// <param name="appName">nome APP del DB da sincronizzare</param>
/// <returns></returns>
public async Task<List<VocabolarioModel>> VocabolarioGetAll(string appName)
{
string source = "DB";
string cString = ConnString(appName);
List<VocabolarioModel>? dbResult = new List<VocabolarioModel>();
try
{
string currKey = $"{Const.rKeyConfig}:DbSync:Vocabolario";
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
string? rawData = await redisDb.StringGetAsync(currKey);
if (!string.IsNullOrEmpty(rawData))
{
source = "REDIS";
var tempResult = JsonConvert.DeserializeObject<List<VocabolarioModel>>(rawData);
if (tempResult == null)
{
dbResult = new List<VocabolarioModel>();
}
else
{
dbResult = tempResult;
}
}
else
{
dbResult = dbController.VocabolarioGetAll(cString);
rawData = JsonConvert.SerializeObject(dbResult, JSSettings);
await redisDb.StringSetAsync(currKey, rawData, LongCache);
// per evitare loopback uso deserialize...
var tempResult = JsonConvert.DeserializeObject<List<VocabolarioModel>>(rawData);
if (tempResult != null)
{
dbResult = tempResult;
}
}
if (dbResult == null)
{
dbResult = new List<VocabolarioModel>();
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
Log.Debug($"VocabolarioGetAll | {source} in: {ts.TotalMilliseconds} ms");
}
catch (Exception exc)
{
Log.Error($"Error during VocabolarioGetAll:{Environment.NewLine}{exc}");
}
return dbResult;
}
#endregion Public Methods
#region Protected Fields
protected static JsonSerializerSettings? JSSettings;
#endregion Protected Fields
#region Protected Properties
protected DbSyncController dbController { get; set; } = null!;
protected LiMan.DB.Controllers.DbController TplController { get; set; } = null!;
#endregion Protected Properties
#region Private Properties
private string CodApp { get; set; } = "";
#endregion Private Properties
#region Private Methods
/// <summary>
/// Restituisce la stringa di connessione al DB data app riferimento
/// </summary>
/// <param name="appName"></param>
/// <returns></returns>
private string ConnString(string appName)
{
string answ = "";
try
{
var currRec = TplController.GetApplicazioniFilt(appName);
if (currRec != null)
{
answ = currRec.TplConnString;
}
}
catch { }
return answ;
}
#endregion Private Methods
}
}
+6 -6
View File
@@ -9,15 +9,15 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.2" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.2">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.2" />
<PackageReference Include="NLog" Version="4.7.13" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.28" />
<PackageReference Include="NLog" Version="5.3.2" />
</ItemGroup>
<ItemGroup>
+2 -2
View File
@@ -12,8 +12,8 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NLog" Version="4.7.14" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog" Version="5.3.2" />
<PackageReference Include="RestSharp" Version="106.15.0" />
<PackageReference Include="RestSharp.Serializers.NewtonsoftJson" Version="106.15.0" />
</ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 1.1.2311.0611</h4>
<h4>Versione: 1.1.2408.0817</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
1.1.2311.0611
1.1.2408.0817
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.1.2311.0611</version>
<version>1.1.2408.0817</version>
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.Transfer.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+1 -1
View File
@@ -38,7 +38,7 @@
<thead>
<tr>
<th>
<button type="button" class="btn btn-sm btn-warning btn-block" value="Cancel" @onclick="close"><i class="fas fa-times"></i></button>
<button type="button" class="btn btn-sm btn-warning w-100" value="Cancel" @onclick="close"><i class="fas fa-times"></i></button>
</th>
<th>#</th>
<th>Impiego</th>
+1 -1
View File
@@ -95,7 +95,7 @@ namespace LiMan.UI.Components
ListRecords = null;
await Task.Delay(1);
ListRecords = MasterLicence.Attivazioni.ToList();
//ListRecords = await DataService.AttivazioniGetByLic(MasterLicence.IdxLic);
//AllRecords = await DataService.AttivazioniGetByLic(MasterLicence.IdxLic);
await Task.Delay(1);
isLoading = false;
}
+54
View File
@@ -0,0 +1,54 @@
<div class="card shadow shadow-lg">
<div class="card-header">
<div class="row">
<h3>Chiavi</h3>
</div>
</div>
<div class="card-body px-2">
@if (isLoading)
{
<LoadingData></LoadingData>
}
@if (AllRecords == null || AllRecords.Count == 0)
{
<div class="alert alert-warning">No record to search</div>
}
else
{
if (string.IsNullOrEmpty(searchVal))
{
<div class="alert alert-info text-center mb-0">
<b>@AllRecords.Count</b> Records found
</div>
}
else
{
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th>Numero</th>
<th>Seriale</th>
<th>Data</th>
<th>Note</th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecords)
{
<tr>
<td>@item.Number</td>
<td>@item.Seriale</td>
<td>@($"{item.Date:yyyy.MM.dd}")</td>
<td>@item.Note</td>
</tr>
}
</tbody>
</table>
}
}
</div>
<div class="card-footer">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="setNumRec" numPageChanged="setNumPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
@@ -0,0 +1,107 @@
using Liman.CadCam.DbModel;
using Liman.CadCam.Services;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.UI.Components
{
public partial class CadCamSearchKey
{
#region Public Properties
[Parameter]
public string searchVal { get; set; } = "";
#endregion Public Properties
#region Protected Properties
[Inject]
protected CadCamService CCService { get; set; } = null!;
#endregion Protected Properties
#region Private Properties
private List<KeyModel> AllRecords { get; set; } = new List<KeyModel>();
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
private List<KeyModel> ListRecords { get; set; } = new List<KeyModel>();
private int numRecord { get; set; } = 5;
private List<KeyModel> SearchRecords { get; set; } = new List<KeyModel>();
private int totalCount { get; set; } = 0;
#endregion Private Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
protected override void OnParametersSet()
{
ReloadAllData();
// aggiorno
}
protected void setNumPage(int newNum)
{
currPage = newNum;
ReloadAllData();
isLoading = false;
}
protected void setNumRec(int newNum)
{
numRecord = newNum;
ReloadAllData();
isLoading = false;
}
#endregion Protected Methods
#region Private Methods
private void ReloadAllData()
{
// rileggo i dati
isLoading = true;
if (!string.IsNullOrEmpty(searchVal))
{
SearchRecords = AllRecords
.Where(x => (!string.IsNullOrEmpty(x.Note) && x.Note.Contains(searchVal, StringComparison.CurrentCultureIgnoreCase))
|| x.Number.ToString().Contains(searchVal, StringComparison.CurrentCultureIgnoreCase)
|| (!string.IsNullOrEmpty(x.Seriale) && x.Seriale.Contains(searchVal, StringComparison.CurrentCultureIgnoreCase)))
.ToList();
}
else
{
SearchRecords = new List<KeyModel>();
}
totalCount = SearchRecords.Count;
// paginazione!
ListRecords = SearchRecords
.Skip((currPage - 1) * numRecord)
.Take(numRecord)
.ToList();
isLoading = false;
}
private async Task ReloadData()
{
isLoading = true;
AllRecords = await CCService.KeysGetAll();
isLoading = false;
}
#endregion Private Methods
}
}
+83
View File
@@ -0,0 +1,83 @@
<div class="card shadow shadow-lg">
<div class="card-header">
<div class="row">
<h3>Licenze</h3>
</div>
</div>
<div class="card-body px-2">
@if (isLoading)
{
<LoadingData></LoadingData>
}
@if (AllRecords == null || AllRecords.Count == 0)
{
<div class="alert alert-warning">No record to search</div>
}
else
{
if (string.IsNullOrEmpty(searchVal) && string.IsNullOrEmpty(LockId))
{
<div class="alert alert-info text-center mb-0">
<b>@AllRecords.Count</b> Records found
</div>
}
else
{
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th>Prodotto</th>
<th>Licenza</th>
<th>Assistenza</th>
<th>Note</th>
</tr>
</thead>
<tbody class="small">
@foreach (var item in ListRecords)
{
string cssDef = item.IsDefinitiva ? "text-success" : "text-danger";
<tr>
<td>
<div class="d-flex justify-content-between small text-nowrap">
<div class="px-1">
<b>@item.ProdNav.ProductName</b>
</div>
<div class="px-1">
Vers: @item.ProductVersion
</div>
</div>
<div class="d-flex justify-content-between small text-nowrap @item.CssDefinitiva">
<div class="px-1">
Level: @item.ProductLevel
</div>
<div class="px-1">
D: @($"{item.ProductDeadline:yyyy.MM.dd}")
</div>
</div>
</td>
<td class="text-nowrap">
<button class="btn btn-sm btn-outline-primary" @onclick="() => ReportLockId(item.LockID)">
<div class="small">
@item.LockID
</div>
<small>
<i class="fas fa-angle-double-right"></i> @($"{item.Date:yyyy.MM.dd}") <i class="fas fa-angle-double-left"></i>
</small>
</button>
</td>
<td class="@item.CssScad">
<b>@($"{item.DtScadenza:yyyy.MM}")</b>
</td>
<td>@item.Note</td>
</tr>
}
</tbody>
</table>
}
}
</div>
<div class="card-footer">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="setNumRec" numPageChanged="setNumPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
@@ -0,0 +1,127 @@
using Liman.CadCam.DbModel;
using Liman.CadCam.Services;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.UI.Components
{
public partial class CadCamSearchLic
{
#region Public Properties
[Parameter]
public string searchVal { get; set; } = "";
[Parameter]
public int ProdId { get; set; } = 0;
[Parameter]
public string LockId { get; set; } = "";
#endregion Public Properties
#region Protected Properties
[Inject]
protected CadCamService CCService { get; set; } = null!;
#endregion Protected Properties
#region Private Properties
private List<LicenceModel> AllRecords { get; set; } = new List<LicenceModel>();
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
private List<LicenceModel> ListRecords { get; set; } = new List<LicenceModel>();
private int numRecord { get; set; } = 10;
private List<LicenceModel> SearchRecords { get; set; } = new List<LicenceModel>();
private int totalCount { get; set; } = 0;
#endregion Private Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
protected override void OnParametersSet()
{
ReloadAllData();
// aggiorno
}
protected void setNumPage(int newNum)
{
currPage = newNum;
ReloadAllData();
isLoading = false;
}
protected void setNumRec(int newNum)
{
numRecord = newNum;
ReloadAllData();
isLoading = false;
}
#endregion Protected Methods
#region Private Methods
protected async Task ReportLockId(string lockId)
{
await EC_LockIdSel.InvokeAsync(lockId);
}
[Parameter]
public EventCallback<string> EC_LockIdSel { get; set; }
private void ReloadAllData()
{
// rileggo i dati
isLoading = true;
if (!string.IsNullOrEmpty(searchVal) || !string.IsNullOrEmpty(LockId))
{
SearchRecords = AllRecords
.Where(x => (ProdId == 0 || x.ProductID == ProdId) && (string.IsNullOrEmpty(LockId) || x.LockID.Contains(LockId, StringComparison.CurrentCultureIgnoreCase))
&& (string.IsNullOrEmpty(searchVal) || (
(!string.IsNullOrEmpty(x.Note) && x.Note.Contains(searchVal, StringComparison.CurrentCultureIgnoreCase))
|| x.ProductVersion.ToString().Contains(searchVal, StringComparison.CurrentCultureIgnoreCase)
|| (!string.IsNullOrEmpty(x.Note) && x.Note.Contains(searchVal, StringComparison.CurrentCultureIgnoreCase))
))
)
.ToList();
}
else
{
SearchRecords = new List<LicenceModel>();
}
// ordinamento data desc
SearchRecords = SearchRecords.OrderByDescending(x => x.DtScadenza).ToList();
totalCount = SearchRecords.Count;
// paginazione!
ListRecords = SearchRecords
.Skip((currPage - 1) * numRecord)
.Take(numRecord)
.ToList();
isLoading = false;
}
private async Task ReloadData()
{
isLoading = true;
AllRecords = await CCService.LicencesGetAll();
isLoading = false;
}
#endregion Private Methods
}
}
@@ -0,0 +1,54 @@
<div class="card shadow shadow-lg">
<div class="card-header">
<div class="row">
<h3>Prodotti</h3>
</div>
</div>
<div class="card-body px-2">
@if (isLoading)
{
<LoadingData></LoadingData>
}
@if (AllRecords == null || AllRecords.Count == 0)
{
<div class="alert alert-warning">No record to search</div>
}
else
{
if (string.IsNullOrEmpty(searchVal))
{
<div class="alert alert-info text-center mb-0">
<b>@AllRecords.Count</b> Records found
</div>
}
else
{
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th>Nome</th>
<th>Numero</th>
<th>Opzione 1</th>
<th>Opzione 2</th>
</tr>
</thead>
<tbody>
@foreach (var item in ListRecords)
{
<tr>
<td>@item.ProductName</td>
<td>@item.ProductNumber</td>
<td>@item.ProductOption1</td>
<td>@item.ProductOption2</td>
</tr>
}
</tbody>
</table>
}
}
</div>
<div class="card-footer">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="setNumRec" numPageChanged="setNumPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
@@ -0,0 +1,106 @@
using Liman.CadCam.DbModel;
using Liman.CadCam.Services;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.UI.Components
{
public partial class CadCamSearchProd
{
#region Public Properties
[Parameter]
public string searchVal { get; set; } = "";
#endregion Public Properties
#region Protected Properties
[Inject]
protected CadCamService CCService { get; set; } = null!;
#endregion Protected Properties
#region Private Properties
private List<ProductModel> AllRecords { get; set; } = new List<ProductModel>();
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
private List<ProductModel> ListRecords { get; set; } = new List<ProductModel>();
private int numRecord { get; set; } = 5;
private List<ProductModel> SearchRecords { get; set; } = new List<ProductModel>();
private int totalCount { get; set; } = 0;
#endregion Private Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await ReloadData();
}
protected override void OnParametersSet()
{
ReloadAllData();
// aggiorno
}
protected void setNumPage(int newNum)
{
currPage = newNum;
ReloadAllData();
isLoading = false;
}
protected void setNumRec(int newNum)
{
numRecord = newNum;
ReloadAllData();
isLoading = false;
}
#endregion Protected Methods
#region Private Methods
private void ReloadAllData()
{
// rileggo i dati
isLoading = true;
if (!string.IsNullOrEmpty(searchVal))
{
SearchRecords = AllRecords
.Where(x => (!string.IsNullOrEmpty(x.ProductName) && x.ProductName.Contains(searchVal, StringComparison.CurrentCultureIgnoreCase))
|| x.ProductNumber.ToString().Contains(searchVal, StringComparison.CurrentCultureIgnoreCase))
.ToList();
}
else
{
SearchRecords = new List<ProductModel>();
}
totalCount = SearchRecords.Count;
// paginazione!
ListRecords = SearchRecords
.Skip((currPage - 1) * numRecord)
.Take(numRecord)
.ToList();
isLoading = false;
}
private async Task ReloadData()
{
isLoading = true;
AllRecords = await CCService.ProductsGetAll();
isLoading = false;
}
#endregion Private Methods
}
}
+3 -3
View File
@@ -1,8 +1,8 @@
<div class="form-row text-light">
<div class="col-5 pr-0 text-left">
<div class="d-flex justify-content-between text-light">
<div>
LiMan.UI <span class="small">v.@version</span>
</div>
<div class="col-7 pl-0 text-right">
<div>
<span class="small">@adesso</span>
<a class="text-light" href="https://www.egalware.com/" target="_blank">Egalware<img class="img-fluid" width="16" src="img/LogoBlu.svg" /></a>
</div>
+19
View File
@@ -0,0 +1,19 @@
<div class="d-flex justify-content-center">
@if (isLoading)
{
<div class="px-1">
<LoadingData DisplaySize="LoadingData.CtrlSize.Small" DisplayMode="LoadingData.SpinMode.Growl"></LoadingData>
</div>
}
else
{
<div class="px-1">
<i class="@CurrIcon"></i>
</div>
<div class="px-1">
@CurrName
</div>
}
</div>
+27
View File
@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Components;
using System.Threading.Tasks;
namespace LiMan.UI.Components
{
public partial class CmpPageTitle
{
[Parameter]
public string CurrIcon { get; set; } = "";
[Parameter]
public string CurrName { get; set; } = "";
protected override async Task OnParametersSetAsync()
{
isLoading = true;
await Task.Delay(1);
//await InvokeAsync(StateHasChanged);
isLoading = false;
//await InvokeAsync(StateHasChanged);
}
private bool isLoading { get; set; } = false;
}
}
+4 -63
View File
@@ -1,19 +1,18 @@
@using LiMan.UI.Components
@using LiMan.DB.DBModels
@using LiMan.UI.Components
@using System.Security.Claims
@using Microsoft.AspNetCore.Components.Authorization
@using LiMan.UI.Data
@inject MessageService AppMessages
@inject AuthenticationStateProvider AuthenticationStateProvider
<div class="form-row pt-3">
<div class="row pt-3 mx-2">
<div class="col-7 col-md-6 col-lg-4 col-xl-3">
<AuthorizeView>
<LoginDisplay />
</AuthorizeView>
</div>
<div class="col-12 col-lg-4 col-xl-6 d-none d-lg-block text-center h4 text-truncate">
<span class="@PageIcon" aria-hidden="true"></span> @PageName
<CmpPageTitle CurrIcon="@PageIcon" CurrName="@PageName"></CmpPageTitle>
</div>
<div class="col-5 col-md-6 col-lg-4 col-xl-3 text-right">
@if (ShowSearch)
@@ -22,61 +21,3 @@
}
</div>
</div>
@code {
[CascadingParameter]
private Task<AuthenticationState> AuthenticationStateTask { get; set; }
[CascadingParameter(Name = "ShowSearch")]
private bool ShowSearch { get; set; }
private string userName = "";
private string PageName { get; set; }
private string PageIcon { get; set; }
protected override async Task OnInitializedAsync()
{
await forceReload();
}
protected override void OnInitialized()
{
AppMessages.EA_PageUpdated += OnPageUpdate;
}
public void OnPageUpdate()
{
PageName = AppMessages.PageName;
PageIcon = AppMessages.PageIcon;
InvokeAsync(() =>
{
StateHasChanged();
});
}
public void Dispose()
{
AppMessages.EA_PageUpdated -= OnPageUpdate;
}
private async Task forceReload()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
}
else
{
userName = "N.A.";
}
}
}
@* // Vedere anche:
// https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-5.0#:~:text=Blazor%20uses%20the%20existing%20ASP.NET%20Core%20authentication%20mechanisms,all%20client-side%20code%20can%20be%20modified%20by%20users
// https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-5.0*@
+162
View File
@@ -0,0 +1,162 @@
using LiMan.DB.DBModels;
using LiMan.UI.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Org.BouncyCastle.Bcpg;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.UI.Components
{
// Vedere anche:
// https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-5.0#:~:text=Blazor%20uses%20the%20existing%20ASP.NET%20Core%20authentication%20mechanisms,all%20client-side%20code%20can%20be%20modified%20by%20users https://docs.microsoft.com/en-us/aspnet/core/blazor/security/?view=aspnetcore-5.0
public partial class CmpTop
{
#region Public Methods
public void Dispose()
{
AppMessages.EA_PageUpdated -= OnPageUpdate;
}
public void OnPageUpdate()
{
PageName = AppMessages.PageName;
PageIcon = AppMessages.PageIcon;
InvokeAsync(() =>
{
StateHasChanged();
});
}
#endregion Public Methods
#region Protected Properties
[Inject]
protected MessageService AppMessages { get; set; } = null!;
[Inject]
protected LiManDataService DataService { get; set; } = null!;
protected List<AuthClaimModel> listClaims { get; set; } = new List<AuthClaimModel>();
protected int userId { get; set; } = 0;
#endregion Protected Properties
#region Protected Methods
protected override void OnInitialized()
{
AppMessages.EA_PageUpdated += OnPageUpdate;
}
protected override async Task OnInitializedAsync()
{
await forceReload();
}
#endregion Protected Methods
#region Private Properties
[CascadingParameter]
private Task<AuthenticationState> AuthenticationStateTask { get; set; }
private string PageIcon { get; set; } = "";
private string PageName { get; set; } = "";
[CascadingParameter(Name = "ShowSearch")]
private bool ShowSearch { get; set; }
private string userName
{
get => AppMessages.UserName;
set => AppMessages.UserName = value;
}
#endregion Private Properties
#region Private Methods
private async Task checkAuthUser()
{
// verifico user su DB
var listUser = await DataService.AuthUserGetFilt(userName);
// se nullo --> creo!
if (listUser == null || listUser.Count == 0)
{
string adDomain = "Domain";
string adUser = "User";
if (userName.Contains("\\"))
{
var adInfo = userName.Split("\\");
adDomain = adInfo[0];
adUser = adInfo[1];
}
// creo record
AuthUserModel newRec = new AuthUserModel()
{
AD_Domain = adDomain,
AD_User = adUser,
Username = userName
};
// faccio upsert!
bool userOk = await DataService.AuthUserUpsert(newRec);
if (userOk)
{
// rileggo!
listUser = await DataService.AuthUserGetFilt(userName);
}
}
// recupero UserID...
userId = (listUser == null || listUser.Count == 0) ? 0 : listUser.FirstOrDefault().UserID;
// carico Claims utente da DB per averli in cache redis...
listClaims = await DataService.AuthClaimByUserName(userName);
// se fosse nulla --> aggiungo USER base!
if (listClaims == null || listClaims.Count == 0 && userId > 0)
{
// recupero user...
AuthClaimModel newClaim = new AuthClaimModel()
{
ClaimID = 0,
DtIns = DateTime.Now,
DtMod = DateTime.Now,
RoleID = 1,
UserID = userId
};
bool claimOk = await DataService.AuthClaimUpsert(newClaim);
if (claimOk)
{
listClaims = await DataService.AuthClaimByUserName(userName);
}
}
}
[Inject]
protected AuthenticationStateProvider AutheStateProvider { get; set; } = null!;
private async Task forceReload()
{
var authState = await AutheStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
await checkAuthUser();
}
else
{
userName = "N.A.";
}
}
#endregion Private Methods
}
}
-58
View File
@@ -1,58 +0,0 @@
@using System
@inject IJSRuntime JSRuntime
<div class="input-group input-group-sm">
@if (ShowText)
{
<input class="form-control" readonly type="text" value="@Text" />
}
else
{
<span class="form-control fas fa-eye-slash" readonly></span>
}
<div class="input-group-append">
<button type="button" class="btn @btnStyle" @onclick="CopyTextToClipboard" title="Copy to Clipboard">
@if (copyDone)
{
<span><i class="far fa-thumbs-up"></i></span>
}
else
{
<span><i class="far fa-copy"></i></span>
}
</button>
</div>
</div>
@code {
/// <summary>
/// Metodi per copia verso clipboard:
/// link:
/// - https://chrissainty.com/copy-to-clipboard-in-blazor/
/// - https://www.daveabrock.com/2021/02/18/copy-to-clipboard-markdown-editor/
/// - https://www.meziantou.net/
/// </summary>
[Parameter]
public string Text { get; set; }
[Parameter]
public bool ShowText { get; set; } = true;
protected string btnStyle = "btn-primary";
protected bool copyDone = false;
private async Task CopyTextToClipboard()
{
// cambio colore..
btnStyle = "btn-success";
copyDone = true;
await JSRuntime.InvokeVoidAsync("clipboardCopy.copyText", Text);
await Task.Delay(1100);
// fix cambio colore..
btnStyle = "btn-primary";
copyDone = false;
await Task.Delay(10);
}
}
-56
View File
@@ -1,56 +0,0 @@
<div class="row">
<div class="col-12 col-lg-8 text-left">
<div class="row">
<div class="col-12 small">
@if (totalCount > 0)
{
<ul class="pagination pagination-sm mb-1">
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(1)"><i class="fas fa-angle-double-left"></i></button></li>
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(prevBlock)"><i class="fas fa-angle-left"></i></button></li>
@for (int i = @startPage; i <= endPage; ++i)
{
var pageNum = i;
<li class="page-item @cssActive(pageNum)"><button class="page-link" @onclick="() => PaginationItemClick(pageNum)">@pageNum</button></li>
}
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(nextBlock)"><i class="fas fa-angle-right"></i></button></li>
<li class="page-item"><button class="page-link" @onclick="() => PaginationItemClick(LastPage)"><i class="fas fa-angle-double-right"></i></button></li>
</ul>
}
</div>
</div>
<div class="row">
<div class="col-12 small">
@if (showLoading)
{
<div class="progress" style="height: 10px;">
<div class="progress-bar progress-bar-striped progress-bar-animated" style="width:@percLoading%;"></div>
</div>
}
</div>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="d-flex">
<div class="p-1 flex-fill text-right">
@if (!showLoading)
{
<span>@totalCount records</span>
}
</div>
<div class="p-1 flex-fill text-right small">
@if (totalCount > 0)
{
<div class="input-group input-group-sm">
<select @bind="@PageSize" class="form-control form-control-sm">
<option value="5">5</option>
<option value="10">10</option>
<option value="25">25</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
</div>
}
</div>
</div>
</div>
</div>
-193
View File
@@ -1,193 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Components;
using LiMan.UI.Components;
using LiMan.UI.Data;
namespace LiMan.UI.Components
{
public partial class DataPager : ComponentBase
{
#region Protected Fields
protected bool _showLoading = false;
#endregion Protected Fields
#region Private Properties
private int endPage
{
get
{
int answ = (int)(currPage / numPages) * numPages + numPages;
answ = answ < LastPage ? answ : LastPage;
return answ;
}
}
private int LastPage
{
get
{
return Math.Max((int)Math.Ceiling(totalCount / (double)PageSize), 1);
}
}
private int nextBlock
{
get
{
int answ = currPage + numPages;
answ = answ < LastPage ? answ : LastPage;
return answ;
}
}
private int numPages { get; set; } = 10;
private int prevBlock
{
get
{
int answ = currPage - numPages;
answ = answ > 0 ? answ : 1;
return answ;
}
}
// calcola un set 1 .. numPages centrato sulla pagina corrente...
private int startPage
{
get
{
int answ = (int)(currPage / numPages) * numPages;
answ = answ > 0 ? answ : 1;
return answ;
}
}
#endregion Private Properties
#region Protected Properties
protected int _numPage { get; set; } = 1;
protected int _numRecord { get; set; } = 10;
protected int percLoading { get; set; } = 0;
#endregion Protected Properties
#region Public Properties
[Parameter]
public int currPage
{
get
{
return _numPage;
}
set
{
bool doReport = !_numPage.Equals(value);
if (doReport)
{
_numPage = value;
reportChangePage();
}
}
}
[Parameter]
public EventCallback<int> numPageChanged { get; set; }
[Parameter]
public EventCallback<int> numRecordChanged { get; set; }
[Parameter]
public int PageSize
{
get
{
return _numRecord;
}
set
{
bool doReport = !_numRecord.Equals(value);
if (doReport)
{
_numRecord = value;
reportChange();
}
}
}
[Parameter]
public bool showLoading
{
get
{
return _showLoading;
}
set
{
if (value)
{
Random random = new Random();
percLoading = random.Next(30, 90);
}
else
{
percLoading = 5;
}
_showLoading = value;
}
}
[Parameter]
public int totalCount { get; set; } = 0;
#endregion Public Properties
#region Private Methods
private void reportChange()
{
numRecordChanged.InvokeAsync(PageSize);
}
private void reportChangePage()
{
numPageChanged.InvokeAsync(currPage);
}
#endregion Private Methods
#region Protected Methods
protected string cssActive(int numPage)
{
string answ = "";
if (numPage == currPage)
{
answ = "active";
}
return answ;
}
protected override async Task OnInitializedAsync()
{
await Task.Run(() => showLoading = false);
}
protected void PaginationItemClick(int page)
{
currPage = page;
}
#endregion Protected Methods
}
}
+2 -6
View File
@@ -15,30 +15,26 @@
<div class="row">
<div class="col-12 col-lg-3">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
Codice
</span>
</div>
<InputText @bind-Value="@_currItem.CodApp" class="form-control"></InputText>
</div>
</div>
<div class="col-12 col-lg-9">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
Descrizione
</span>
</div>
<InputText @bind-Value="@_currItem.Descrizione" class="form-control"></InputText>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2">
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<button type="button" class="btn btn-warning w-100" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<div class="mt-2">
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
<button type="button" class="btn btn-success w-100" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
</div>
</div>
</div>
@@ -18,7 +18,7 @@
</div>
<div class="col-12 col-lg-9">
<div class="input-group">
<div class="input-group-prepend">
<div class="input-group-text">
<span class="input-group-text">
Descrizione
</span>
@@ -29,9 +29,9 @@
</div>
</div>
<div class="col-12 col-lg-2">
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<button type="button" class="btn btn-warning w-100" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<div class="mt-2">
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
<button type="button" class="btn btn-success w-100" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
</div>
</div>
</div>
+18 -28
View File
@@ -14,61 +14,51 @@
<div class="col-12 col-lg-10">
<div class="row">
<div class="col-12 col-lg-4">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
Codice
</span>
</div>
<div class="input-group">
<span class="input-group-text">
Codice
</span>
<InputText @bind-Value="@_currItem.CodInst" class="form-control"></InputText>
</div>
</div>
<div class="col-12 col-lg-8">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
Descrizione
</span>
</div>
<span class="input-group-text">
Descrizione
</span>
<InputText @bind-Value="@_currItem.Descrizione" class="form-control"></InputText>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
Cliente
</span>
</div>
<span class="input-group-text">
Cliente
</span>
<InputText @bind-Value="@_currItem.Cliente" class="form-control"></InputText>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
Contatto
</span>
</div>
<span class="input-group-text">
Contatto
</span>
<InputText @bind-Value="@_currItem.Contatto" class="form-control"></InputText>
</div>
</div>
<div class="col-12 col-lg-4">
<div class="input-group">
<div class="input-group-prepend">
<span class="input-group-text">
Email
</span>
</div>
<span class="input-group-text">
Email
</span>
<InputText @bind-Value="@_currItem.Email" class="form-control"></InputText>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2">
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<button type="button" class="btn btn-warning w-100" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<div class="mt-2">
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
<button type="button" class="btn btn-success w-100" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
</div>
</div>
</div>
@@ -49,9 +49,9 @@
</div>
</div>
<div class="col-12 col-lg-2">
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<button type="button" class="btn btn-warning w-100" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<div class="mt-2">
<button type="button" class="btn btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
<button type="button" class="btn btn-success w-100" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
</div>
</div>
</div>
+27 -41
View File
@@ -12,15 +12,13 @@
<DataAnnotationsValidator />
<div class="row">
<div class="col-12 col-lg-10">
<div class="form-row">
<div class="row">
<div class="col-6 col-lg-4">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">
Applicazione
</span>
</div>
<select @bind="@_currItem.CodApp" class="form-control form-control-sm">
<span class="input-group-text">
Applicazione
</span>
<select @bind="@_currItem.CodApp" class="form-select">
@if (ListApp != null)
{
foreach (var item in ListApp)
@@ -33,12 +31,10 @@
</div>
<div class="col-6 col-lg-4">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">
Installazione
</span>
</div>
<select @bind="@_currItem.CodInst" class="form-control form-control-sm">
<span class="input-group-text">
Installazione
</span>
<select @bind="@_currItem.CodInst" class="form-select">
@if (ListInstall != null)
{
foreach (var item in ListInstall)
@@ -51,58 +47,48 @@
</div>
<div class="col-6 col-lg-4">
<div class="input-group input-group-sm" title="Numero Licenze">
<div class="input-group-prepend">
<span class="input-group-text">
#
</span>
</div>
<span class="input-group-text">
#
</span>
<InputNumber @bind-Value="@_currItem.NumLicenze" class="form-control"></InputNumber>
<div class="input-group-prepend">
<span class="input-group-text">
Scadenza
</span>
</div>
<span class="input-group-text">
Scadenza
</span>
<InputDate @bind-Value="@_currItem.Scadenza" class="form-control"></InputDate>
</div>
</div>
</div>
<div class="form-row mt-2">
<div class="row mt-2">
<div class="col-6 col-lg-6">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">
Descrizione
</span>
</div>
<span class="input-group-text">
Descrizione
</span>
<InputText @bind-Value="@_currItem.Descrizione" class="form-control"></InputText>
</div>
</div>
<div class="col-6 col-lg-6">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">
<i class="fas fa-key"></i>
</span>
</div>
<span class="input-group-text">
<i class="fas fa-key"></i>
</span>
<InputText @bind-Value="@_currItem.Chiave" class="form-control" readonly></InputText>
@if (!_currItem.IsValid)
{
<div class="input-group-append">
<span class="input-group-text text-danger">
<i class="fas fa-exclamation-triangle"></i>
</span>
</div>
<span class="input-group-text text-danger">
<i class="fas fa-exclamation-triangle"></i>
</span>
}
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2">
<button type="button" class="btn btn-sm btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<button type="button" class="btn btn-sm btn-warning w-100" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<div class="mt-2">
@if (!_currItem.IsValid)
{
<button type="button" class="btn btn-sm btn-success btn-block" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
<button type="button" class="btn btn-sm btn-success w-100" value="Save" @onclick="saveUpdate">Save <i class="far fa-save"></i></button>
}
</div>
</div>
+4 -4
View File
@@ -35,7 +35,7 @@
@if (_currItem.IsScaduto)
{
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<div class="input-group-text">
<span class="input-group-text">
MasterLic
</span>
@@ -56,15 +56,15 @@
</div>
</div>
<div class="col-12 col-lg-2">
<button type="button" class="btn btn-warning btn-block" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<button type="button" class="btn btn-warning w-100" value="Cancel" @onclick="cancelUpdate">Cancel <i class="fas fa-ban"></i></button>
<div class="my-1">
@if (SelIdxLic == 0)
{
<button type="button" class="btn btn-primary btn-block" value="Transfer" @onclick="transferLicense">Transfer Master <i class="far fa-arrow-alt-circle-right"></i></button>
<button type="button" class="btn btn-primary w-100" value="Transfer" @onclick="transferLicense">Transfer Master <i class="far fa-arrow-alt-circle-right"></i></button>
}
else
{
<button type="button" class="btn btn-info btn-block" value="LogRecord" @onclick="recordLogLicense">Log License <i class="far fa-arrow-alt-circle-right"></i></button>
<button type="button" class="btn btn-info w-100" value="LogRecord" @onclick="recordLogLicense">Log License <i class="far fa-arrow-alt-circle-right"></i></button>
}
</div>
</div>
+46
View File
@@ -0,0 +1,46 @@
<div class="card">
<div class="card-header bg-info text-light">
<b>Modifica</b>
</div>
<div class="card-body small p-1">
<EditForm Model="@_currItem">
<DataAnnotationsValidator />
<div class="row">
<div class="col-12 col-lg-10">
<div class="row">
<div class="col-12">
<div class="input-group">
<span class="input-group-text">
Rilascio
</span>
<InputDate @bind-Value="@_currItem.ReleaseDate" class="form-control text-end"></InputDate>
</div>
</div>
<div class="col-6">
<div class="input-group">
<span class="input-group-text">
Vers (num)
</span>
<InputText @bind-Value="@_currItem.VersNum" class="form-control text-end"></InputText>
</div>
</div>
<div class="col-6">
<div class="input-group">
<span class="input-group-text">
Vers (txt)
</span>
<InputText @bind-Value="@_currItem.VersText" class="form-control text-end"></InputText>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2">
<button type="button" class="btn btn-warning w-100" value="Cancel" @onclick="DoCancel">Cancel <i class="fas fa-ban"></i></button>
<div class="mt-2">
<button type="button" class="btn btn-success w-100" value="Save" @onclick="DoSave">Save <i class="far fa-save"></i></button>
</div>
</div>
</div>
</EditForm>
</div>
</div>
+120
View File
@@ -0,0 +1,120 @@
using LiMan.DB.DBModels;
using LiMan.UI.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System.Threading.Tasks;
using System;
using LiMan.UI.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.Extensions.Configuration;
namespace LiMan.UI.Components
{
public partial class EditRelease
{
#region Public Properties
[Parameter]
public ReleaseModel currItem
{
get
{
return _currItem;
}
set
{
_currItem = value;
}
}
[Parameter]
public EventCallback<int> DataReset { get; set; }
[Parameter]
public EventCallback<int> DataUpdated { get; set; }
#endregion Public Properties
#region Protected Fields
protected ReleaseModel _currItem = new ReleaseModel();
#endregion Protected Fields
#region Protected Properties
[Inject]
protected LiManDataService DataService { get; set; }
protected bool editAll
{
get
{
bool answ = false;
var currMode = GetQueryParm("currMode");
if (!string.IsNullOrEmpty(currMode))
{
answ = currMode.Equals("debug");
}
return answ;
}
}
[Inject]
protected MessageService MessageService { get; set; }
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Blazor: get query parm from the URL
/// </summary>
/// <param name="parmName"></param>
/// <returns></returns>
protected string GetQueryParm(string parmName)
{
var uriBuilder = new UriBuilder(NavManager.Uri);
var q = System.Web.HttpUtility.ParseQueryString(uriBuilder.Query);
return q[parmName] ?? "";
}
#endregion Protected Methods
#region Private Properties
[Inject]
private IJSRuntime JSRuntime { get; set; }
[Inject]
private NavigationManager NavManager { get; set; }
#endregion Private Properties
#region Private Methods
private async Task DoClose()
{
await DataReset.InvokeAsync(0);
}
private async Task DoCancel()
{
await DataReset.InvokeAsync(0);
}
private async Task DoSave()
{
if (_currItem != null)
{
await DataService.ReleaseUpsert(_currItem);
await DataUpdated.InvokeAsync(0);
}
else
{
Console.WriteLine("Record null!");
}
}
#endregion Private Methods
}
}
+43 -21
View File
@@ -2,20 +2,23 @@
<div class="card">
<div class="card-header">
<div class="row">
<div class="col-9">
<div class="d-flex justify-content-between">
<div class="px-1">
<h3>Applicazioni</h3>
</div>
<div class="col-3 text-right">
<button class="btn btn-sm btn-success" @onclick="() => AddNew()"><i class="fas fa-plus"></i></button>
<div class="px-1">
@if (recordEdit == null && recordSel == null)
{
<button class="btn btn-success" @onclick="() => AddNew()">Add New <i class="fas fa-plus"></i></button>
}
</div>
</div>
@if (recordEdit != null)
{
<EditApplicazioni currItem="@recordEdit" DataReset="ResetData" DataUpdated="UpdateData"></EditApplicazioni>
}
</div>
<div class="card-body">
@if (currRecord != null)
{
<EditApplicazioni currItem="@currRecord" DataReset="ResetData" DataUpdated="UpdateData"></EditApplicazioni>
}
@if (ListRecords == null)
{
<LoadingData></LoadingData>
@@ -27,13 +30,25 @@
else
{
<div class="row">
<div class="col-12">
<div class="@mainCss">
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th></th>
<th>
@if (recordSel == null && recordEdit == null)
{
<button class="btn btn-sm btn-secondary disabled"><i class="fas fa-sync-alt"></i></button>
}
else
{
<button class="btn btn-sm btn-primary" @onclick="ResetData" title="Reset"><i class="fas fa-sync-alt"></i></button>
}
</th>
<th>Applicazione</th>
<th class="text-right">Descrizione</th>
@if (recordSel == null)
{
<th class="text-right">Descrizione</th>
}
</tr>
</thead>
<tbody>
@@ -41,33 +56,40 @@
{
<tr class="@checkSelect(record.CodApp)">
<td class="text-nowrap">
@if (currRecord == null)
@if (recordEdit == null)
{
if (@record.CodApp != "-")
{
<button class="btn btn-sm btn-info" @onclick="() => Edit(record)" title="Edit record">
<i class="oi oi-pencil"></i>
</button>
<button class="btn btn-sm btn-primary" @onclick="() => DoSelect(record)" title="Dettaglio Releases"><i class="fa fa-search"></i></button>
<button class="btn btn-sm btn-info" @onclick="() => DoEdit(record)" title="Edit record"><i class="oi oi-pencil"></i></button>
}
}
else
{
<button class="btn btn-sm btn-secondary disabled">
<i class="oi oi-pencil"></i>
</button>
<button class="btn btn-sm btn-secondary disabled"><i class="fa fa-search"></i></button>
<button class="btn btn-sm btn-secondary disabled"><i class="oi oi-pencil"></i></button>
}
</td>
<td>
<b>@record.CodApp</b>
</td>
<td class="text-right">
<div>@record.Descrizione</div>
</td>
@if (recordSel == null)
{
<td class="text-right">
<div>@record.Descrizione</div>
</td>
}
</tr>
}
</tbody>
</table>
</div>
@if (recordSel != null)
{
<div class="@detCss">
<ListReleases CurrRecord="@recordSel" DataReset="ResetData"></ListReleases>
</div>
}
</div>
}
</div>
+31 -8
View File
@@ -13,7 +13,8 @@ namespace LiMan.UI.Components
{
#region Private Fields
private ApplicativoModel currRecord = null;
private ApplicativoModel recordEdit = null;
private ApplicativoModel recordSel = null;
private List<ApplicativoModel> ListRecords;
private List<ApplicativoModel> SearchRecords;
@@ -77,7 +78,8 @@ namespace LiMan.UI.Components
private async Task fullReload()
{
currRecord = null;
recordEdit = null;
recordSel = null;
await DataService.InvalidateAllCache();
await ReloadAllData();
}
@@ -86,7 +88,7 @@ namespace LiMan.UI.Components
{
isLoading = true;
await Task.Delay(1);
//ListRecords = null;
//AllRecords = null;
SearchRecords = await DataService.ApplicazioniNextGetAll();
totalCount = SearchRecords.Count();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
@@ -99,16 +101,28 @@ namespace LiMan.UI.Components
protected void AddNew()
{
currRecord = new ApplicativoModel()
recordEdit = new ApplicativoModel()
{
CodApp = $"CodApp_{DateTime.Now:yyyyMMdd_HHmmss}",
Descrizione = "Descrizione Nuovo Applicativo"
};
}
protected void Edit(ApplicativoModel selRecord)
protected string mainCss
{
currRecord = selRecord;
get => recordSel != null ? "col-4" : "col-12";
}
protected string detCss = "col-8";
protected void DoEdit(ApplicativoModel selRecord)
{
recordEdit = selRecord;
recordSel = null;
}
protected void DoSelect(ApplicativoModel selRecord)
{
recordEdit = null;
recordSel = selRecord;
}
protected override async Task OnInitializedAsync()
@@ -147,11 +161,20 @@ namespace LiMan.UI.Components
public string checkSelect(string CodApp)
{
string answ = "";
if (currRecord != null)
if (recordEdit != null)
{
try
{
answ = (currRecord.CodApp == CodApp) ? "table-info" : "";
answ = (recordEdit.CodApp == CodApp) ? "table-info" : "";
}
catch
{ }
}
else if (recordSel != null)
{
try
{
answ = (recordSel.CodApp == CodApp) ? "table-primary" : "";
}
catch
{ }
@@ -86,7 +86,7 @@ namespace LiMan.UI.Components
{
isLoading = true;
await Task.Delay(1);
//ListRecords = null;
//AllRecords = null;
SearchRecords = await DataService.ApplicazioniGLSGetAll();
totalCount = SearchRecords.Count();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
+1 -1
View File
@@ -27,7 +27,7 @@
<thead>
<tr>
@*<th>
<button type="button" class="btn btn-sm btn-warning btn-block" @onclick="close"><i class="fas fa-times"></i></button>
<button type="button" class="btn btn-sm btn-warning w-100" @onclick="close"><i class="fas fa-times"></i></button>
</th>*@
<th>#</th>
<th>OriginalName</th>
@@ -86,7 +86,7 @@ namespace LiMan.UI.Components
{
isLoading = true;
await Task.Delay(1);
//ListRecords = null;
//AllRecords = null;
SearchRecords = await DataService.InstallazioniNextGetAll();
totalCount = SearchRecords.Count();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
@@ -86,7 +86,7 @@ namespace LiMan.UI.Components
{
isLoading = true;
await Task.Delay(1);
//ListRecords = null;
//AllRecords = null;
SearchRecords = await DataService.InstallazioniGLSGetAll();
totalCount = SearchRecords.Count();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
+20 -30
View File
@@ -15,12 +15,10 @@
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">
Installazione
</span>
</div>
<select @bind="@SelInst" class="form-control form-control-sm">
<span class="input-group-text">
Installazione
</span>
<select @bind="@SelInst" class="form-select">
<option value="">--- Tutti ---</option>
@if (ListInstall != null)
{
@@ -34,12 +32,10 @@
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">
Applicazione
</span>
</div>
<select @bind="@SelApp" class="form-control form-control-sm">
<span class="input-group-text">
Applicazione
</span>
<select @bind="@SelApp" class="form-select">
<option value="">--- Tutti ---</option>
@if (ListApp != null)
{
@@ -53,11 +49,9 @@
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
</div>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="togAttivi" title="Solo Attivi / Mostra tutti" @bind-value="@OnlyActive" checked="@OnlyActive" />
<label class="custom-control-label small" for="togAttivi"><sub>solo attivi</sub></label>
<div class="form-check form-switch">
<input type="checkbox" class="form-check-input" id="togAttivi" title="Solo Attivi / Mostra tutti" @bind-value="@OnlyActive" checked="@OnlyActive" />
<label class="form-check-label small" for="togAttivi"><sub>solo attivi</sub></label>
</div>
</div>
</div>
@@ -94,7 +88,7 @@
{
<th>Tickets</th>
}
@if (!showTickets)
{
<th class="text-right">Attivazioni / Licenze</th>
@@ -143,12 +137,10 @@
{
<td title="Tickets">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<button class="btn btn-sm btn-success" @onclick="() => Select(record, detailType.tickets)" title="Elenco Tickets">
<i class="oi oi-magnifying-glass"></i>
</button>
</div>
<span class="form-control" readonly>@record.Tickets.Count</span>
<button class="btn btn-sm btn-success" @onclick="() => Select(record, detailType.tickets)" title="Elenco Tickets">
<i class="oi oi-magnifying-glass"></i>
</button>
<span class="form-control bg-secondary bg-opacity-10" disabled>@record.Tickets.Count</span>
</div>
</td>
}
@@ -156,12 +148,10 @@
{
<td class="text-right" title="Attivazioni / Num Licenze">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<button class="btn btn-sm btn-info" @onclick="() => Select(record, detailType.attivazioni)" title="Dettaglio Attivazioni">
<i class="oi oi-magnifying-glass"></i>
</button>
</div>
<span class="form-control" readonly>@record.Attivazioni.Count / @record.NumLicenze</span>
<button class="btn btn-sm btn-info" @onclick="() => Select(record, detailType.attivazioni)" title="Dettaglio Attivazioni">
<i class="oi oi-magnifying-glass"></i>
</button>
<span class="form-control bg-secondary bg-opacity-10" disabled>@record.Attivazioni.Count / @record.NumLicenze</span>
</div>
</td>
}
+12 -20
View File
@@ -9,12 +9,10 @@
<div class="d-flex flex-row-reverse justify-content-between">
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">
Installazione
</span>
</div>
<select @bind="@SelInst" class="form-control form-control-sm">
<span class="input-group-text">
Installazione
</span>
<select @bind="@SelInst" class="form-select">
<option value="">--- Tutti ---</option>
@if (ListInstall != null)
{
@@ -28,12 +26,10 @@
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
<span class="input-group-text">
Applicazione
</span>
</div>
<select @bind="@SelApp" class="form-control form-control-sm">
<span class="input-group-text">
Applicazione
</span>
<select @bind="@SelApp" class="form-select">
<option value="">--- Tutti ---</option>
@if (ListApp != null)
{
@@ -47,20 +43,16 @@
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
</div>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="togAttivi" title="Solo Attivi / Mostra tutti" @bind-value="@OnlyActive" checked="@OnlyActive" />
<div class="form-check form-switch">
<input type="checkbox" class="form-check-input" id="togAttivi" title="Solo Attivi / Mostra tutti" @bind-value="@OnlyActive" checked="@OnlyActive" />
<label class="custom-control-label small" for="togAttivi"><sub>solo attivi</sub></label>
</div>
</div>
</div>
<div class="p-2">
<div class="input-group input-group-sm">
<div class="input-group-prepend">
</div>
<div class="custom-control custom-switch">
<input type="checkbox" class="custom-control-input" id="togTransf" title="Non trasferiti / Mostra tutti" @bind-value="@OnlyUnlock" checked="@OnlyUnlock" />
<div class="form-check form-switch">
<input type="checkbox" class="form-check-input" id="togTransf" title="Non trasferiti / Mostra tutti" @bind-value="@OnlyUnlock" checked="@OnlyUnlock" />
<label class="custom-control-label small" for="togTransf"><sub>solo non trasferiti</sub></label>
</div>
</div>
+89
View File
@@ -0,0 +1,89 @@
<div class="card shadow">
<div class="card-header bg-primary text-light">
<div class="row">
<div class="col-6">
<h5>Elenco Releases</h5>
</div>
<div class="col-6">
<div class="btn-group w-100">
@if (recordEdit == null)
{
<button class="btn btn-success" @onclick="() => AddNew()">Add New <i class="fas fa-plus"></i></button>
<button type="button" class="btn btn-warning" @onclick="DoClose">Close <i class="fas fa-ban"></i></button>
}
</div>
</div>
</div>
@if (recordEdit != null)
{
<EditRelease currItem="@recordEdit" DataReset="() => DoEdit(null)" DataUpdated="DoSave"></EditRelease>
}
</div>
<div class="card-body px-1">
@if (ListRecords == null)
{
<LoadingData></LoadingData>
}
else if (totalCount == 0)
{
<div class="alert alert-warning text-center display-4">Nessun record trovato</div>
}
else
{
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th></th>
<th>Applicazione</th>
<th class="text-lect">Rilascio</th>
<th class="text-right">Vers. Num</th>
<th class="text-right">Vers. Text</th>
<th></th>
</tr>
</thead>
<tbody>
@foreach (var record in ListRecords)
{
<tr class="@checkSelect(record.IdxRel)">
<td class="text-nowrap">
@if (recordEdit == null)
{
<button class="btn btn-sm btn-info" @onclick="() => DoEdit(record)" title="Edit record"><i class="oi oi-pencil"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary disabled"><i class="oi oi-pencil"></i></button>
}
</td>
<td>
<b>@record.CodApp</b>
</td>
<td class="text-right">
@($"{record.ReleaseDate:yyyy.MM.dd}")
</td>
<td class="text-right">
@record.VersNum
</td>
<td class="text-right">
@record.VersText
</td>
<td class="text-right">
@if (recordEdit == null)
{
<button class="btn btn-sm btn-danger" @onclick="() => DoDelete(record)" title="Edit record"><i class="fas fa-trash"></i></button>
}
else
{
<button class="btn btn-sm btn-secondary disabled"><i class="fas fa-bin"></i></button>
}
</td>
</tr>
}
</tbody>
</table>
}
</div>
<div class="card-footer">
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="PagerReloadNum" numPageChanged="PagerReloadPage" totalCount="totalCount" showLoading="isLoading" />
</div>
</div>
+147
View File
@@ -0,0 +1,147 @@
using LiMan.DB.DBModels;
using LiMan.UI.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.UI.Components
{
public partial class ListReleases
{
#region Public Properties
[Parameter]
public ApplicativoModel CurrRecord { get; set; }
[Parameter]
public EventCallback<int> DataReset { get; set; }
#endregion Public Properties
#region Public Methods
public string checkSelect(int idxRel)
{
string answ = "";
if (recordEdit != null)
{
try
{
answ = (recordEdit.IdxRel == idxRel) ? "table-info" : "";
}
catch
{ }
}
return answ;
}
#endregion Public Methods
#region Protected Properties
[Inject]
protected LiManDataService DataService { get; set; }
#endregion Protected Properties
#region Protected Methods
protected void AddNew()
{
recordEdit = new ReleaseModel()
{
CodApp = CurrRecord.CodApp,
VersNum = "0.0.0.0",
VersText = "a.b.c",
ReleaseDate = DateTime.Today
};
}
[Inject]
private IJSRuntime JSRuntime { get; set; }
protected async Task DoDelete(ReleaseModel rec2del)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
return;
DataService.ReleaseDelete(rec2del);
await ReloadAllData();
}
protected void DoEdit(ReleaseModel selRecord)
{
recordEdit = selRecord;
}
protected async Task DoSave()
{
recordEdit = null;
await ReloadAllData();
}
protected override async Task OnParametersSetAsync()
{
await ReloadAllData();
}
protected async Task PagerReloadNum(int newNum)
{
numRecord = newNum;
await ReloadAllData();
isLoading = false;
}
protected async Task PagerReloadPage(int newNum)
{
currPage = newNum;
await ReloadAllData();
isLoading = false;
}
#endregion Protected Methods
#region Private Fields
private List<ReleaseModel> ListRecords;
private ReleaseModel recordEdit = null;
private List<ReleaseModel> SearchRecords;
#endregion Private Fields
#region Private Properties
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
private int numRecord { get; set; } = 10;
private int totalCount { get; set; } = 0;
#endregion Private Properties
#region Private Methods
private async Task DoClose()
{
await DataReset.InvokeAsync(0);
}
private async Task ReloadAllData()
{
isLoading = true;
SearchRecords = await DataService.ReleaseGetByApp(CurrRecord.CodApp);
totalCount = SearchRecords.Count();
ListRecords = SearchRecords.Skip(numRecord * (currPage - 1)).Take(numRecord).ToList();
isLoading = false;
}
#endregion Private Methods
}
}
-7
View File
@@ -1,7 +0,0 @@
@*<h1 class="alert alert-info">Working</h1>*@
<div class="row">
<div class="col-12 text-center mt-5 py-5 alert alert-primary">
<h3>loading data</h3>
<i class="fas fa-spinner fa-spin fa-5x"></i>
</div>
</div>
+6 -39
View File
@@ -5,57 +5,24 @@
<AuthorizeView>
<Authorized>
<div class="input-group text-truncate">
<div class="input-group-prepend">
<a title="LogOut" href="Identity/Account/LogOut" class="btn btn-sm btn-danger"><i class="fas fa-sign-out-alt"></i></a>
</div>
<a title="Gestione account @userName" href="Identity/Account/Manage" class="btn btn-sm btn-outline-dark mx-0 px-1">
<a title="LogOut" href="Identity/Account/LogOut" class="btn btn-sm btn-danger"><i class="fas fa-sign-out-alt"></i></a>
<a title="Gestione account @displayName" href="Identity/Account/Manage" class="btn btn-sm btn-outline-dark mx-0 px-1">
<div class="d-none d-sm-block">
<i class="fas fa-user-alt"></i> @StringLim(userName, 30)
<i class="fas fa-user-alt"></i> @StringLim(displayName, 30)
</div>
<div class="d-block d-sm-none">
<i class="fas fa-user-alt"></i> @StringLim(userName, 15)
<i class="fas fa-user-alt"></i> @StringLim(displayName, 15)
</div>
</a>
</div>
</Authorized>
<NotAuthorized>
<div class="input-group">
<div class="input-group-prepend">
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success"><i class="fas fa-sign-in-alt"></i></a>
</div>
<a title="LogIn" href="Identity/Account/LogIn" class="btn btn-sm btn-success"><i class="fas fa-sign-in-alt"></i></a>
<div class="form-control form-control-sm">
<i class="fas fa-user-alt"></i>&nbsp;@userName
<i class="fas fa-user-alt"></i>&nbsp;@displayName
</div>
</div>
</NotAuthorized>
</AuthorizeView>
@code{
private string userName = "";
protected override async Task OnInitializedAsync()
{
await forceReload();
}
private async Task forceReload()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
}
else
{
userName = "Non Autenticato";
}
}
protected string StringLim(string original, int maxLen)
{
return original.Length <= maxLen ? original : $"{original.Substring(0, maxLen - 3)}...";
}
}
+74
View File
@@ -0,0 +1,74 @@
using LiMan.DB.DBModels;
using LiMan.UI.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using MimeKit.Cryptography;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.UI.Components
{
public partial class LoginDisplay
{
#region Protected Properties
[Inject]
protected LiManDataService DataService { get; set; }
protected List<AuthUserModel> listUser { get; set; } = new List<AuthUserModel>();
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
await forceReload();
}
protected string StringLim(string original, int maxLen)
{
return original.Length <= maxLen ? original : $"{original.Substring(0, maxLen - 3)}...";
}
#endregion Protected Methods
#region Private Fields
private string displayName = "";
private string userName = "";
#endregion Private Fields
#region Private Methods
private async Task forceReload()
{
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity.IsAuthenticated)
{
userName = $"{user.Identity.Name}";
// cerco se ho info in lista user...
listUser = await DataService.AuthUserGetFilt(userName);
if (listUser != null && listUser.Count > 0)
{
var userRec = listUser.FirstOrDefault();
displayName = $"{userRec.Nome} {userRec.Cognome}";
}
else
{
displayName = userName;
}
}
else
{
displayName = "Non Autenticato";
}
}
#endregion Private Methods
}
}
+43
View File
@@ -0,0 +1,43 @@

<div class="card">
<div class="card-header">
<div class="row">
<div class="col-4">
<h3>Ricerca Licenze CAD/CAM</h3>
</div>
<div class="col-2">
<div class="input-group input-group-sm">
<span class="input-group-text">Prod</span>
<select @bind="@SelProdId" class="form-select">
<option value="0">--- Tutti ---</option>
@if (ListProd != null)
{
foreach (var item in ListProd)
{
<option value="@item.ProductID">@item.ProductName</option>
}
}
</select>
</div>
</div>
<div class="col-3">
<div class="input-group input-group-sm">
<span class="input-group-text">Key</span>
<input class="form-control" @bind="@SelLockId" />
<button @onclick="reset" class="btn btn-success input-group-text">reset</button>
</div>
</div>
<div class="col-3">
<SearchMod></SearchMod>
</div>
</div>
</div>
<div class="card-body">
<div class="row">
<div class="col-12">
<CadCamSearchLic ProdId="@SelProdId" LockId="@SelLockId" searchVal="@searchVal" EC_LockIdSel="SetLockId"></CadCamSearchLic>
</div>
</div>
</div>
</div>

Some files were not shown because too many files have changed in this diff Show More