Compare commits
341 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| b51e164c18 | |||
| c35d625c36 | |||
| c893ce4d44 | |||
| c47fb1787c | |||
| aca61c24dc | |||
| 167c9d89d4 | |||
| 2295f12958 | |||
| 9762628abc | |||
| a7918e1a89 | |||
| 7a8e05462c | |||
| aaeae6e99e | |||
| 533f3f4f8f | |||
| 5135987f1b | |||
| 458d788a13 | |||
| e842228baf | |||
| 25d2ada96e | |||
| f22933f925 | |||
| 009b5f6452 | |||
| 94c72b7e11 | |||
| 11a1925660 | |||
| 6ce8386248 | |||
| 1739dcf38a | |||
| 1a42d581d4 | |||
| 625433a3af | |||
| 782a01a4b0 | |||
| e65105b305 | |||
| 0429ad398a | |||
| 268ee1e2e0 | |||
| d19dc0edb5 | |||
| bd770dcffb | |||
| d99f2d2144 | |||
| f47cc1f505 | |||
| edad6f24c0 | |||
| a296908697 | |||
| 04d0b7e9a2 | |||
| 5e6da5faa9 | |||
| 63947b6662 | |||
| da39149575 | |||
| 99e6973695 | |||
| 60db6422e8 | |||
| e642d29605 | |||
| 7a89db055c | |||
| 703337fa9a | |||
| 54fab44687 | |||
| 3b2b097626 | |||
| b9a115bb13 | |||
| 011fbe52d3 | |||
| 84875e5c30 | |||
| 69ce7b5a0b | |||
| 31c142efa4 | |||
| 116ec93bb6 | |||
| e5ac829bd8 | |||
| 703bae704f | |||
| fd63226051 | |||
| d3e7c224d3 | |||
| dc53a6f439 | |||
| 519c8d2130 | |||
| f28f7ee815 | |||
| 1848fef640 | |||
| 48d34590e4 | |||
| 25505ad6d5 | |||
| 997c870bcc | |||
| 8f9ddc738b | |||
| 275b349c99 | |||
| 2a921eca4f | |||
| bbf7c78e28 | |||
| 048be7b2c4 | |||
| 3598051cb2 | |||
| dbebd11c14 | |||
| 8c9027581e | |||
| 75122f8ee1 | |||
| 04a1f34aba | |||
| e458de6f21 | |||
| caadb95c91 | |||
| 6cfeea6fac | |||
| 124e6cdf61 | |||
| d20767ec7e | |||
| 2e2639b94f | |||
| efa11f9452 | |||
| a8fefca15f | |||
| 3e5a36311c | |||
| f0fa776829 | |||
| a3a8c0ffaf | |||
| f16d3a3275 | |||
| 0e8fa72f36 | |||
| ac0ef3f62a | |||
| 557a9510d6 | |||
| 349758a289 | |||
| 5541d0dc83 | |||
| 0798679629 | |||
| 0a26d475f9 | |||
| 8e5a392c8c | |||
| f0beaaacc8 | |||
| 0847014108 | |||
| d6c226ae1a | |||
| 6d6bf242dd | |||
| b760d4fa1a | |||
| aa65d48f5f | |||
| f1f5287d74 | |||
| 94d0de796e | |||
| 70901c259b | |||
| f22bd910a2 | |||
| b85ed12f1c | |||
| fef6d4ccfc | |||
| e345e61d8a | |||
| 4d2dc10579 | |||
| 9c98ee945a | |||
| 01270d6254 | |||
| 485cecc1a0 | |||
| be9cf76253 | |||
| f89dc62a5b | |||
| 182d3c82f1 | |||
| 091d542084 | |||
| c92b92b795 | |||
| 80837628ad | |||
| fa0c622c66 | |||
| 7403002350 | |||
| aa0aeb1552 | |||
| 3d183abf41 | |||
| ce5e3c45c7 | |||
| 9974cbb8b4 | |||
| 279ef9d302 | |||
| cc21f4b719 | |||
| 98d32300cf | |||
| a77e88ca88 | |||
| 0b9211d26a | |||
| a6279ca047 | |||
| 2cc8da110d | |||
| 985e429d34 | |||
| 1b95fa8d91 | |||
| a9dadb9d9c | |||
| c358bddd36 | |||
| eca2aaae30 | |||
| a1b035c00a | |||
| d702234b9c | |||
| 9d4b93b4ab | |||
| 9cc4a5544c | |||
| 23455acd67 | |||
| b7bd3d77ad | |||
| 8e235aa282 | |||
| a3a0f72b02 | |||
| 362c526459 | |||
| 46874d42d0 | |||
| 39efd30bae | |||
| b259a94ca8 | |||
| 4dbf8a6611 | |||
| 7e06abd521 | |||
| 6c3f35f64b | |||
| e21b7b9eee | |||
| 7d6bef1a32 | |||
| c297416f6c | |||
| 027a0b4b4c | |||
| db5500b3a7 | |||
| 8947a03e5a | |||
| 08188ca2a0 | |||
| f9f3dd56bd | |||
| d81f448b08 | |||
| 1f48aad618 | |||
| b802a9b914 | |||
| 407308f26f | |||
| 833e55ec20 | |||
| f6ecbb94f3 | |||
| d59ad82c87 | |||
| 03a3c78176 | |||
| 9377d704e6 | |||
| a1ccaafcc6 | |||
| ab3c3c2122 | |||
| 4468bdabb9 | |||
| f9929d0b73 | |||
| 226b26be5e | |||
| 5190b5d62d | |||
| 5805a3685a | |||
| f89faccdf4 | |||
| 7c760e5f18 | |||
| 79fa14549c | |||
| 11a4293138 | |||
| c1c5f2e16e | |||
| faba3fbe60 | |||
| c911373036 | |||
| e9b283b910 | |||
| fc20464958 | |||
| 22e02bdd9e | |||
| f0bbeaff26 | |||
| 7861609072 | |||
| c440c86068 | |||
| e197245bec | |||
| b316c81b96 | |||
| f8f9b5bbe2 | |||
| d312fa1eb2 | |||
| 57920f2b59 | |||
| 546c8cc92b | |||
| c348652291 | |||
| 93e13da83b | |||
| e5a611c844 | |||
| 535cf8ecf2 | |||
| 54b384cb92 | |||
| 82f6d5a0c7 | |||
| b4af3bfd61 | |||
| 0cb40dde36 | |||
| f1dc5253b6 | |||
| 5c65b5c0e4 | |||
| 5e15c9f836 | |||
| 15420f605e | |||
| 45c0337fe3 | |||
| 01ed314319 | |||
| 77a45dbdc1 | |||
| 1ac15dd9a0 | |||
| abd652b944 | |||
| 08a761c678 | |||
| 532862340e | |||
| 97e0224e77 | |||
| c740b4492f | |||
| cd01907565 | |||
| 4f4cd7bf2f | |||
| 5cdb0e077d | |||
| 661d2580bc | |||
| c9d75fc084 | |||
| 397be33d04 | |||
| a99406ca76 | |||
| d5896b136b | |||
| c980019ca1 | |||
| 521edc8f91 | |||
| d4b8116fc1 | |||
| f95d426953 | |||
| cdd12bf764 | |||
| 74c13ed1a7 | |||
| 4070c4600f | |||
| 3267f6a44d | |||
| da65188ca9 | |||
| aa15b170be | |||
| 8639fbfb9b | |||
| 1c3785ee16 | |||
| 0ead243221 | |||
| e4de6dc438 | |||
| f04d739e7b | |||
| 031676d783 | |||
| f0419fdf72 | |||
| 1c11e03d5f | |||
| f7834d362e | |||
| afb673bd79 | |||
| b08eafe7f4 | |||
| 587f0accbe | |||
| 8d57772e35 | |||
| c2464d2b47 | |||
| 01adbcb666 | |||
| 1ec0c7d5a9 | |||
| a93d84eea1 | |||
| 88795e5991 | |||
| a1486ad04b | |||
| 14b808429d | |||
| 4346cb5cca | |||
| ca6eea7f80 | |||
| 02bcec21ad | |||
| ae7213c5a7 | |||
| 2af0674f1f | |||
| 27100c7d65 | |||
| c27b81f506 | |||
| 09b3c98199 | |||
| 92fd05d32d | |||
| e923a44d99 | |||
| 7cd141f10e | |||
| 26cbdc88af | |||
| 2898dcd433 | |||
| 13fc227875 | |||
| f5a0b6a3a9 | |||
| bf1df41d04 | |||
| ad83a7a14a | |||
| 4c1c0bfac7 | |||
| b0bfff9d9f | |||
| 28e548003b | |||
| 0af4a4e488 | |||
| fea8d06a12 | |||
| 5600427d71 | |||
| cf2f9de185 | |||
| e3f9f534da | |||
| 3932a5330b | |||
| 2a42571375 | |||
| 3aa8341c94 | |||
| 18596a9168 | |||
| 5c49bb6b6a | |||
| 3f4f9965e8 | |||
| 6fe3925ad8 | |||
| 1652697aff | |||
| cc9901e5f9 | |||
| c4acee1632 | |||
| 07a6978e01 | |||
| a5e0100cab | |||
| 6940a68c0c | |||
| 48ee4dcdae | |||
| 758810be12 | |||
| a8416ca3bc | |||
| fe279af47b | |||
| 461b00dc90 | |||
| 66a2fd0923 | |||
| 7fb3e35416 | |||
| 7ce2d0720c | |||
| 3ae71e73a8 | |||
| 60a8d3b8a6 | |||
| 93423b93b5 | |||
| 08703a9593 | |||
| 7633bf5040 | |||
| 8b3fa36524 | |||
| 0f2013c75f | |||
| 82736ca983 | |||
| 9dfa8d2de5 | |||
| 4377e1236c | |||
| 1b9590e1eb | |||
| 630f381674 | |||
| a387d9cd77 | |||
| 0e2030ba9e | |||
| 30172c3bfc | |||
| 98b9a83491 | |||
| e5d6f579f4 | |||
| 607e096609 | |||
| 68b9cd4d78 | |||
| c783a2d959 | |||
| 81430d9b27 | |||
| 44f148d41b | |||
| 13c7bb688c | |||
| 54526335aa | |||
| d2300036db | |||
| 7c80e1aaaf | |||
| 50ed15b0ca | |||
| 4d9563c4b7 | |||
| b53ee95d24 | |||
| b1fef48b1c | |||
| 17ca3eee8e | |||
| e54a77d85d | |||
| 4f62986402 | |||
| 3993f8dc02 | |||
| 5e7d966a93 | |||
| 4e64ddb80b | |||
| 6e9e89cc85 | |||
| a6617038f7 | |||
| ad2a56c486 | |||
| 5099bdb1a4 | |||
| e7ec7bab2f | |||
| b8c7d3236b | |||
| 98c14b5f06 | |||
| 7f4457783c | |||
| 195bb78554 |
+4
-86
@@ -7,8 +7,8 @@
|
||||
#--------------------------------
|
||||
# area MP.Stats
|
||||
#--------------------------------
|
||||
/Mp.Stats/temp/*.csv
|
||||
|
||||
/Mp.FileData/temp/*.csv
|
||||
*.bak
|
||||
|
||||
#--------------------------------
|
||||
# Area VersGen
|
||||
@@ -16,90 +16,6 @@
|
||||
/VersGen/bin/*
|
||||
/VersGen/obj/*
|
||||
|
||||
#--------------------------------
|
||||
# area MapoDb
|
||||
#--------------------------------
|
||||
/MapoDb/bin/*
|
||||
/MapoDb/obj/*
|
||||
|
||||
|
||||
#--------------------------------
|
||||
# area MP
|
||||
#--------------------------------
|
||||
/MP/bin/*
|
||||
/MP/obj/*
|
||||
MP/logs/*.txt
|
||||
MP/logs/*.zip
|
||||
MP-LAND/logs/
|
||||
|
||||
#--------------------------------
|
||||
# Area MP-MON (MoonPro-MONitor)
|
||||
#--------------------------------
|
||||
/MP-MON/logs/*.zip
|
||||
/MP-MON/logs/*.txt
|
||||
/MP-MON/bin/*
|
||||
/MP-MON/obj/*
|
||||
/MP-MON/WebCharts/*.png
|
||||
|
||||
#--------------------------------
|
||||
# Area MP-IO (MoonPro-IO)
|
||||
#--------------------------------
|
||||
/MP-IO/logs/*.zip
|
||||
/MP-IO/logs/*.txt
|
||||
/MP-IO/bin/*
|
||||
/MP-IO/obj/*
|
||||
/MP-IO/fileUpload/
|
||||
!/MP-IO/fileUpload/.PlaceHolder.file
|
||||
|
||||
#--------------------------------
|
||||
# Area MP-Admin
|
||||
#--------------------------------
|
||||
/MP-Admin/logs/*.zip
|
||||
/MP-Admin/logs/*.txt
|
||||
/MP-Admin/bin/*
|
||||
/MP-Admin/obj/*
|
||||
/MP-ADM/logs/*.zip
|
||||
/MP-ADM/logs/*.txt
|
||||
/MP-ADM/bin/*
|
||||
/MP-ADM/obj/*
|
||||
|
||||
|
||||
#--------------------------------
|
||||
# Area ES3
|
||||
#--------------------------------
|
||||
/ES3/logs/*.zip
|
||||
/ES3/logs/*.txt
|
||||
/ES3/bin/*
|
||||
/ES3/obj/*
|
||||
|
||||
#--------------------------------
|
||||
# Area MoonProTablet
|
||||
#--------------------------------
|
||||
/MP-TAB/logs/*.zip
|
||||
/MP-TAB/logs/*.txt
|
||||
/MP-TAB/bin/*
|
||||
/MP-TAB/obj/*
|
||||
/MP-TAB/WebCharts/*.png
|
||||
/MP-TAB/images/macchine/*.*
|
||||
!/MP-TAB/images/macchine/Steamware.png
|
||||
/MP-TAB/Files/Disegni/*.pdf
|
||||
!/MP-TAB/Files/Disegni/ND.pdf
|
||||
MP-TAB/logs/
|
||||
|
||||
|
||||
#--------------------------------
|
||||
# Area MoonPro
|
||||
#--------------------------------
|
||||
/MP-Site/logs/*.zip
|
||||
/MP-Site/logs/*.txt
|
||||
/MP-Site/bin/*
|
||||
/MP-Site/obj/*
|
||||
/MP-Site/WebCharts/*.png
|
||||
/MP-Site/images/macchine/*.*
|
||||
!/MP-Site/images/macchine/Steamware.png
|
||||
|
||||
|
||||
|
||||
# ---> VisualStudio
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
@@ -429,3 +345,5 @@ _UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
|
||||
MP.Prog/Shared/MainLayout.razor
|
||||
MP.Stats/temp/*.csv
|
||||
|
||||
+401
-57
@@ -1,24 +1,27 @@
|
||||
variables:
|
||||
# NUGET_PATH: 'C:\Tools\nuget.exe'
|
||||
# MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
|
||||
# ASPNET_MERGE_PATH: 'C:\Program Files (x86)\Microsoft SDKs\Windows\v10.0A\bin\NETFX 4.8 Tools'
|
||||
# EXE_RELEASE_FOLDER: 'c:\Projetcs\Compiled\GPW\Release'
|
||||
# DEPLOY_FOLDER: 'c:\Projects\Deploy\GPW\Builds'
|
||||
# NEW_REL: ''
|
||||
VERS_MAIN: '1.0'
|
||||
NEXUS_PATH: 'MP-STATS'
|
||||
APP_NAME: 'MP.Stats'
|
||||
NEXUS_PATH: 'MP-STATS'
|
||||
APP_NAME: 'MP.Stats'
|
||||
SOL_NAME: 'MP-STATS'
|
||||
|
||||
# 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 http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
||||
} else {
|
||||
C:\Tools\nuget.exe sources Update -Name "`"Steamware Nexus`"" -Source http://nexus.steamware.net/repository/nuget-group -username "`"nugetUser`"" -password "`"viaDante16`""
|
||||
- |
|
||||
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-proxy-v3/index.json -n nexus-proxy-v3 -u nugetUser -p viaDante16 --store-password-in-clear-text
|
||||
echo "Has Source: $hasSource"
|
||||
|
||||
# helper creazione hash files x IIS
|
||||
.hashBuild: &hashBuild
|
||||
@@ -37,9 +40,8 @@ variables:
|
||||
.nexusUpload: &nexusUpload
|
||||
- |
|
||||
Set-Alias mCurl C:\Windows\system32\curl.exe
|
||||
$currentDate = get-date -format yyMM;
|
||||
$currentTime = get-date -format ddHH;
|
||||
$VersNumb = Get-Content "Resources\VersNum.txt"
|
||||
$fileVers = $env:APP_NAME + "\Resources\VersNum.txt"
|
||||
$VersNumb = Get-Content $fileVers
|
||||
echo "Curr Version: $VersNumb"
|
||||
if($CI_COMMIT_BRANCH -eq "master")
|
||||
{
|
||||
@@ -52,15 +54,13 @@ variables:
|
||||
$File2Send = Get-ChildItem($env:APP_NAME + "\bin\publish\*")
|
||||
ForEach ($File in $File2Send) {
|
||||
$FileName = Split-Path $File -leaf
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/$FileName
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/$VersNumb/$FileName
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/$FileName
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file $File https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/ARCHIVE/$VersNumb/$FileName
|
||||
}
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\manifest.xml" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/manifest.xml
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "Resources\ChangeLog.html" http://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/0/ChangeLog.html
|
||||
|
||||
|
||||
# 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
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "$env:APP_NAME\Resources\manifest.xml" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/manifest.xml
|
||||
mCurl -v -u GitLab:$NEXUS_PASSWD --upload-file "$env:APP_NAME\Resources\ChangeLog.html" https://nexus.steamware.net/repository/SWS/$env:NEXUS_PATH/$version/LAST/ChangeLog.html
|
||||
|
||||
# Stages previsti
|
||||
stages:
|
||||
- build
|
||||
- test
|
||||
@@ -68,86 +68,430 @@ stages:
|
||||
- installer
|
||||
- release
|
||||
|
||||
build:
|
||||
LAND:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Land
|
||||
SOL_NAME: MP-LAND
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
PROG:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Prog
|
||||
SOL_NAME: MP-PROG
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
STAT:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Stats
|
||||
SOL_NAME: MP-STATS
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
MON:build:
|
||||
stage: build
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Mon
|
||||
SOL_NAME: MP-MON
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
script:
|
||||
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
test:
|
||||
LAND:test:
|
||||
stage: test
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Land
|
||||
SOL_NAME: MP-LAND
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["build"]
|
||||
needs: ["LAND:build"]
|
||||
script:
|
||||
- dotnet test
|
||||
|
||||
IIS01:deploy:
|
||||
stage: deploy
|
||||
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
PROG:test:
|
||||
stage: test
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Prog
|
||||
SOL_NAME: MP-PROG
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["test"]
|
||||
# before_script:
|
||||
# - *nuget-fix
|
||||
# - dotnet restore
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj
|
||||
needs: ["PROG:build"]
|
||||
script:
|
||||
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
STAT:test:
|
||||
stage: test
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Stats
|
||||
SOL_NAME: MP-STATS
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["STAT:build"]
|
||||
script:
|
||||
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
MON:test:
|
||||
stage: test
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Mon
|
||||
SOL_NAME: MP-MON
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["MON:build"]
|
||||
script:
|
||||
- dotnet test $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
IIS02:deploy:
|
||||
LAND:IIS01:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Land
|
||||
SOL_NAME: MP-LAND
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["LAND:test"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
PROG:IIS01:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Prog
|
||||
SOL_NAME: MP-PROG
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["PROG:test"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
STAT:IIS01:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Stats
|
||||
SOL_NAME: MP-STATS
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["STAT:test"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
MON:IIS01:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Mon
|
||||
SOL_NAME: MP-MON
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
needs: ["MON:test"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
LAND:IIS02:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Land
|
||||
SOL_NAME: MP-LAND
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- master
|
||||
needs: ["build"]
|
||||
# before_script:
|
||||
# - *nuget-fix
|
||||
# - dotnet restore
|
||||
needs: ["LAND:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj
|
||||
- dotnet publish -p:PublishProfile=W2019-IIS-DEVProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true MP.Stats/MP.Stats.csproj
|
||||
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
PROG:IIS02:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Prog
|
||||
SOL_NAME: MP-PROG
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- master
|
||||
needs: ["PROG:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
STAT:IIS02:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Stats
|
||||
SOL_NAME: MP-STATS
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- master
|
||||
needs: ["STAT:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
installer:
|
||||
MON:IIS02:deploy:
|
||||
stage: deploy
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Mon
|
||||
SOL_NAME: MP-MON
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- master
|
||||
needs: ["MON:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IIS02.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
- dotnet publish -p:PublishProfile=IIS03.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=viadante16 -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
LAND:installer:
|
||||
stage: installer
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Land
|
||||
SOL_NAME: MP-LAND
|
||||
NEXUS_PATH: MP-LAND
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
needs: ["build"]
|
||||
before_script:
|
||||
# - *nuget-fix
|
||||
# - dotnet restore
|
||||
needs: ["LAND:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release MP.Stats/MP.Stats.csproj -o:publish
|
||||
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish
|
||||
# qui il deploy su nexus...
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
PROG:installer:
|
||||
stage: installer
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Prog
|
||||
SOL_NAME: MP-PROG
|
||||
NEXUS_PATH: MP-PROG
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
needs: ["PROG:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish
|
||||
# qui il deploy su nexus...
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
release:
|
||||
STAT:installer:
|
||||
stage: installer
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Stats
|
||||
SOL_NAME: MP-STATS
|
||||
NEXUS_PATH: MP-STATS
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
needs: ["STAT:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish
|
||||
# qui il deploy su nexus...
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
MON:installer:
|
||||
stage: installer
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Mon
|
||||
SOL_NAME: MP-MON
|
||||
NEXUS_PATH: MP-MON
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
- develop
|
||||
- master
|
||||
needs: ["MON:build"]
|
||||
script:
|
||||
- dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj -o:publish
|
||||
# qui il deploy su nexus...
|
||||
- *hashBuild
|
||||
- *nexusUpload
|
||||
|
||||
LAND:release:
|
||||
stage: release
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Land
|
||||
SOL_NAME: MP-LAND
|
||||
NEXUS_PATH: MP-LAND
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
#- feature/Deploy_CI_CD
|
||||
# - master
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
needs: ["build"]
|
||||
needs: ["LAND:build"]
|
||||
artifacts:
|
||||
paths:
|
||||
- publish/
|
||||
script:
|
||||
- dotnet publish -c Release -o ./publish MP.Stats/MP.Stats.csproj
|
||||
- dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
PROG:release:
|
||||
stage: release
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Prog
|
||||
SOL_NAME: MP-PROG
|
||||
NEXUS_PATH: MP-PROG
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
#- feature/Deploy_CI_CD
|
||||
# - master
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
needs: ["PROG:build"]
|
||||
artifacts:
|
||||
paths:
|
||||
- publish/
|
||||
script:
|
||||
- dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
STAT:release:
|
||||
stage: release
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Stats
|
||||
SOL_NAME: MP-STATS
|
||||
NEXUS_PATH: MP-STATS
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
#- feature/Deploy_CI_CD
|
||||
# - master
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
needs: ["STAT:build"]
|
||||
artifacts:
|
||||
paths:
|
||||
- publish/
|
||||
script:
|
||||
- dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
MON:release:
|
||||
stage: release
|
||||
tags:
|
||||
- win
|
||||
variables:
|
||||
APP_NAME: MP.Mon
|
||||
SOL_NAME: MP-MON
|
||||
NEXUS_PATH: MP-MON
|
||||
before_script:
|
||||
- *nuget-fix
|
||||
- dotnet restore "$env:SOL_NAME.sln"
|
||||
only:
|
||||
#- feature/Deploy_CI_CD
|
||||
# - master
|
||||
- tags
|
||||
except:
|
||||
- branches
|
||||
needs: ["MON:build"]
|
||||
artifacts:
|
||||
paths:
|
||||
- publish/
|
||||
script:
|
||||
- dotnet publish -c Release -o ./publish $env:APP_NAME/$env:APP_NAME.csproj
|
||||
|
||||
Vendored
+1
-1
@@ -10,7 +10,7 @@
|
||||
"request": "launch",
|
||||
"preLaunchTask": "build",
|
||||
// If you have changed target frameworks, make sure to update the program path.
|
||||
"program": "${workspaceFolder}/MP.Stats/bin/Debug/net5.0/MP.Stats.dll",
|
||||
"program": "${workspaceFolder}/MP.Stats/bin/Debug/net6.0/MP.Stats.dll",
|
||||
"args": [],
|
||||
"cwd": "${workspaceFolder}/MP.Stats",
|
||||
"stopAtEntry": false,
|
||||
|
||||
+1
-1
@@ -89,7 +89,7 @@ ExecuteLog "7z x ""$SourceDir\$ZipFile"" "
|
||||
|
||||
# step 3 : replica applicazione
|
||||
Write-Host "START copy step"
|
||||
ExecuteLog "robocopy '$utilDir\publish\net5.0\' '$DestDir' /MIR /Z /LOG:'$logMirror'"
|
||||
ExecuteLog "robocopy '$utilDir\publish\net6.0\' '$DestDir' /MIR /Z /LOG:'$logMirror'"
|
||||
Write-Host "END copy step"
|
||||
|
||||
# step 4 : riavvio pool
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
</PropertyGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,220 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Egw.Core
|
||||
{
|
||||
public class LiManObj
|
||||
{
|
||||
#region Public Enums
|
||||
|
||||
public enum StatoRichiesta
|
||||
{
|
||||
ND = 0,
|
||||
|
||||
Richiesta,
|
||||
|
||||
Valutazione,
|
||||
|
||||
Approvata,
|
||||
|
||||
Rifiutata
|
||||
}
|
||||
|
||||
public enum TipoLicenza
|
||||
{
|
||||
ND = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Licenza LEgacy Steamware
|
||||
/// </summary>
|
||||
GLS,
|
||||
|
||||
/// <summary>
|
||||
/// Master Key License, che ha una data di scadenza globale ed un token = numero di utenti/token massimi associati
|
||||
/// </summary>
|
||||
MasterKey,
|
||||
|
||||
/// <summary>
|
||||
/// UserKey License (licenza che consuma un token utente della licenza master) - es GPW
|
||||
/// </summary>
|
||||
UserKey,
|
||||
|
||||
/// <summary>
|
||||
/// Chiave tiupo Checksum basata su licenza masster + checksum MD5 di una serie di dati (child licenses)
|
||||
/// </summary>
|
||||
CheckSumKey
|
||||
}
|
||||
|
||||
#endregion Public Enums
|
||||
|
||||
#region Public Classes
|
||||
|
||||
public class ApplicativoDTO
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Chiave { get; set; } = "";
|
||||
public string CodApp { get; set; } = "";
|
||||
public string CodInst { get; set; } = "";
|
||||
public DateTime DataEnigma { get; set; } = DateTime.Today.AddYears(-1);
|
||||
public string Descrizione { get; set; } = "";
|
||||
public string Enigma { get; set; } = "";
|
||||
public int IdxLic { get; set; } = 0;
|
||||
|
||||
public bool IsActive
|
||||
{
|
||||
get => (Scadenza.Subtract(DateTime.Today).TotalDays > 0);
|
||||
}
|
||||
|
||||
public bool Locked { get; set; } = false;
|
||||
public int NumLicenze { get; set; } = 0;
|
||||
public int NumLicenzeAttive { get; set; } = 0;
|
||||
public string Payload { get; set; } = "";
|
||||
public DateTime Scadenza { get; set; } = DateTime.Today.AddYears(-1);
|
||||
public TipoLicenza Tipo { get; set; } = TipoLicenza.ND;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class AttivazioneDTO
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Chiave { get; set; } = "";
|
||||
public string CodApp { get; set; } = "";
|
||||
public string CodImpiego { get; set; } = "";
|
||||
public string CodInst { get; set; } = "";
|
||||
public string Descrizione { get; set; } = "";
|
||||
public int IdxLic { get; set; } = 0;
|
||||
public int IdxSubLic { get; set; } = 0;
|
||||
public TipoLicenza Tipo { get; set; } = TipoLicenza.UserKey;
|
||||
public DateTime VetoUnlock { get; set; } = DateTime.Today.AddMonths(2);
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class LicenseCoord
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string CodApp { get; set; } = "";
|
||||
public string CodInst { get; set; } = "";
|
||||
public string Enigma { get; set; } = "";
|
||||
public string MasterKey { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class SupportRequest
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string CodApp { get; set; } = "";
|
||||
public string CodImp { get; set; } = "";
|
||||
public string CodInst { get; set; } = "";
|
||||
public string ContactEmail { get; set; } = "";
|
||||
public string ContactName { get; set; } = "";
|
||||
public string ContactPhone { get; set; } = "";
|
||||
public int idxSubLic { get; set; } = 0;
|
||||
|
||||
public bool IsValid
|
||||
{
|
||||
get => !string.IsNullOrEmpty(MasterKey) && !string.IsNullOrEmpty(ContactName) && !string.IsNullOrEmpty(ContactEmail) && !string.IsNullOrEmpty(CodInst) && !string.IsNullOrEmpty(CodApp);
|
||||
}
|
||||
|
||||
public string MasterKey { get; set; } = "";
|
||||
public string ReqBody { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto Ticket
|
||||
/// </summary>
|
||||
public class TicketDTO
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Codice univoco della sub licenza (opzionale)
|
||||
/// </summary>
|
||||
public string CodImpiego { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Contatto email del cliente richiedente
|
||||
/// </summary>
|
||||
public string ContactEmail { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Contatto del cliente richiedente
|
||||
/// </summary>
|
||||
public string ContactName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Contatto telefonico del cliente richiedente
|
||||
/// </summary>
|
||||
public string ContactPhone { get; set; } = "";
|
||||
|
||||
public DateTime DtReq { get; set; } = DateTime.Now;
|
||||
|
||||
/// <summary>
|
||||
/// IDX licenza master
|
||||
/// </summary>
|
||||
public int IdxLic { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// IDX licenza child (opzionale)
|
||||
/// </summary>
|
||||
public int IdxSubLic { get; set; } = 0;
|
||||
|
||||
public int IdxTicket { get; set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Motivazione della richiesta
|
||||
/// </summary>
|
||||
public string ReqBody { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Stato richiesta
|
||||
/// </summary>
|
||||
public StatoRichiesta Status { get; set; } = StatoRichiesta.ND;
|
||||
|
||||
/// <summary>
|
||||
/// Risposta alla richiesta
|
||||
/// </summary>
|
||||
public string SupplAnsw { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Email del responsabile dell'azione (interno - supplier)
|
||||
/// </summary>
|
||||
public string SupplEmail { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Cod dell'user responsabile dell'azione (interno - supplier)
|
||||
/// </summary>
|
||||
public string SupplUserCode { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Tipologia di licenza gestita
|
||||
/// </summary>
|
||||
public TipoLicenza Tipo { get; set; } = TipoLicenza.UserKey;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class UserLicenseRequest
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string MasterKey { get; set; } = "";
|
||||
public Dictionary<string, string> ParamDict { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,186 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Egw.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// utils x cifrature e Crypto
|
||||
/// </summary>
|
||||
public class SteamCrypto
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// decifra un messaggio con una password
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
/// <param name="Passphrase"></param>
|
||||
/// <returns></returns>
|
||||
public static string DecryptString(string Message, string Passphrase)
|
||||
{
|
||||
string answ = Message;
|
||||
byte[] Results = null;
|
||||
UTF8Encoding UTF8 = new UTF8Encoding();
|
||||
|
||||
// Step 1. We hash the passphrase using MD5
|
||||
// We use the MD5 hash generator as the result is a 128 bit byte array
|
||||
// which is a valid length for the TripleDES encoder we use below
|
||||
|
||||
MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider();
|
||||
byte[] TDESKey = HashProvider.ComputeHash(UTF8.GetBytes(Passphrase));
|
||||
|
||||
// Step 2. Create a new TripleDESCryptoServiceProvider object
|
||||
TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider();
|
||||
|
||||
// Step 3. Setup the decoder
|
||||
TDESAlgorithm.Key = TDESKey;
|
||||
TDESAlgorithm.Mode = CipherMode.ECB;
|
||||
TDESAlgorithm.Padding = PaddingMode.PKCS7;
|
||||
|
||||
// Step 4. Convert the input string to a byte[]
|
||||
byte[] DataToDecrypt = null;
|
||||
try
|
||||
{
|
||||
DataToDecrypt = Convert.FromBase64String(Message);
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
if (DataToDecrypt != null)
|
||||
{
|
||||
// Step 5. Attempt to decrypt the string
|
||||
try
|
||||
{
|
||||
ICryptoTransform Decryptor = TDESAlgorithm.CreateDecryptor();
|
||||
Results = Decryptor.TransformFinalBlock(DataToDecrypt, 0, DataToDecrypt.Length);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Clear the TripleDes and Hashprovider services of any sensitive information
|
||||
TDESAlgorithm.Clear();
|
||||
HashProvider.Clear();
|
||||
}
|
||||
// Step 6. Return the decrypted string in UTF8 format
|
||||
answ = UTF8.GetString(Results);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// cifra un messaggio con una password
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
/// <param name="Passphrase"></param>
|
||||
/// <returns></returns>
|
||||
public static string EncryptString(string Message, string Passphrase)
|
||||
{
|
||||
byte[] Results;
|
||||
UTF8Encoding UTF8 = new UTF8Encoding();
|
||||
|
||||
// Step 1. We hash the passphrase using MD5
|
||||
// We use the MD5 hash generator as the result is a 128 bit byte array
|
||||
// which is a valid length for the TripleDES encoder we use below
|
||||
|
||||
MD5CryptoServiceProvider HashProvider = new MD5CryptoServiceProvider();
|
||||
byte[] TDESKey = HashProvider.ComputeHash(UTF8.GetBytes(Passphrase));
|
||||
|
||||
// Step 2. Create a new TripleDESCryptoServiceProvider object
|
||||
TripleDESCryptoServiceProvider TDESAlgorithm = new TripleDESCryptoServiceProvider();
|
||||
|
||||
// Step 3. Setup the encoder
|
||||
TDESAlgorithm.Key = TDESKey;
|
||||
TDESAlgorithm.Mode = CipherMode.ECB;
|
||||
TDESAlgorithm.Padding = PaddingMode.PKCS7;
|
||||
|
||||
// Step 4. Convert the input string to a byte[]
|
||||
byte[] DataToEncrypt = UTF8.GetBytes(Message);
|
||||
|
||||
// Step 5. Attempt to encrypt the string
|
||||
try
|
||||
{
|
||||
ICryptoTransform Encryptor = TDESAlgorithm.CreateEncryptor();
|
||||
Results = Encryptor.TransformFinalBlock(DataToEncrypt, 0, DataToEncrypt.Length);
|
||||
}
|
||||
finally
|
||||
{
|
||||
// Clear the TripleDes and Hashprovider services of any sensitive information
|
||||
TDESAlgorithm.Clear();
|
||||
HashProvider.Clear();
|
||||
}
|
||||
|
||||
// Step 6. Return the encrypted string as a base64 encoded string
|
||||
return Convert.ToBase64String(Results);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// genera hash di una stringa in MD5 (es x hash gravatar)
|
||||
/// </summary>
|
||||
/// <param name="Message"></param>
|
||||
/// <returns></returns>
|
||||
public static string getHashStringMD5(string Message)
|
||||
{
|
||||
string hash = "";
|
||||
using (MD5 md5Hash = MD5.Create())
|
||||
{
|
||||
hash = GetMd5Hash(md5Hash, Message);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Crea un hash MD5
|
||||
/// </summary>
|
||||
/// <param name="md5Hash"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <returns></returns>
|
||||
public static string GetMd5Hash(MD5 md5Hash, string input)
|
||||
{
|
||||
// Convert the input string to a byte array and compute the hash.
|
||||
byte[] data = md5Hash.ComputeHash(Encoding.UTF8.GetBytes(input));
|
||||
|
||||
// Create a new Stringbuilder to collect the bytes
|
||||
// and create a string.
|
||||
StringBuilder sBuilder = new StringBuilder();
|
||||
|
||||
// Loop through each byte of the hashed data
|
||||
// and format each one as a hexadecimal string.
|
||||
for (int i = 0; i < data.Length; i++)
|
||||
{
|
||||
sBuilder.Append(data[i].ToString("x2"));
|
||||
}
|
||||
|
||||
// Return the hexadecimal string.
|
||||
return sBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify a hash against a string.
|
||||
/// </summary>
|
||||
/// <param name="md5Hash"></param>
|
||||
/// <param name="input"></param>
|
||||
/// <param name="hash"></param>
|
||||
/// <returns></returns>
|
||||
public static bool VerifyMd5Hash(MD5 md5Hash, string input, string hash)
|
||||
{
|
||||
// Hash the input.
|
||||
string hashOfInput = GetMd5Hash(md5Hash, input);
|
||||
|
||||
// Create a StringComparer an compare the hashes.
|
||||
StringComparer comparer = StringComparer.OrdinalIgnoreCase;
|
||||
|
||||
if (0 == comparer.Compare(hashOfInput, hash))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Egw.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Gestione licenze applicativi GLS (Legacy SteamWare)
|
||||
/// </summary>
|
||||
public class licenseManGLS
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// restituisce data decodificata da authKey + applicazione + cliente...
|
||||
/// </summary>
|
||||
/// <param name="cliente">The cliente.</param>
|
||||
/// <param name="applicativo">The applicativo.</param>
|
||||
/// <param name="licenze">The licenze.</param>
|
||||
/// <param name="authKey">The authentication key.</param>
|
||||
/// <returns></returns>
|
||||
public static DateTime expiryDateByAuthKey(string cliente, string applicativo, int licenze, string authKey)
|
||||
{
|
||||
DateTime answ = DateTime.Today.AddYears(-10);
|
||||
|
||||
string plainAuthKey = "";
|
||||
try
|
||||
{
|
||||
string passPhrase = string.Format("{0}|{1}", cliente.PadLeft(50, ':'), applicativo);
|
||||
plainAuthKey = SteamCrypto.DecryptString(authKey, passPhrase); // uso combinazione cliente+applicativo come passphrase!
|
||||
answ = Convert.ToDateTime(plainAuthKey.Replace(string.Format("{0}#{1}-", cliente, applicativo.PadLeft(20, '-')), "").Replace(string.Format("%{0}%", licenze), ""));
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
//logger.lg.scriviLog(string.Format("Errore decodifica auth key:{0}AuthKey: {1}{0}cliente:{2}{0}applicativo:{3}{0}errore:{4}", Environment.NewLine, authKey, cliente, applicativo, exc), tipoLog.EXCEPTION);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce chiave MD5 x un cliente/applicativo/expiryDate
|
||||
/// </summary>
|
||||
/// <param name="cliente"></param>
|
||||
/// <param name="applicativo"></param>
|
||||
/// <param name="licenze"></param>
|
||||
/// <param name="expiryDate"></param>
|
||||
/// <returns></returns>
|
||||
public static string getAuthKey(string cliente, string applicativo, int licenze, DateTime expiryDate)
|
||||
{
|
||||
string answ = "";
|
||||
// algoritmo MD5 formato cliente#applicativo#expDate, via SQLdiventa
|
||||
// SELECT CONVERT(VARCHAR(32), HashBytes('MD5', 'ETS#GPW#2013/12/31'), 2)
|
||||
string plainAuthKey = string.Format("{0}#{1}-{2}%{3}%", cliente, applicativo.PadLeft(20, '-'), expiryDate.ToString("yyyy/MM/dd"), licenze);
|
||||
string passPhrase = string.Format("{0}|{1}", cliente.PadLeft(50, ':'), applicativo);
|
||||
answ = SteamCrypto.EncryptString(plainAuthKey, passPhrase); // uso combinazione cliente+applicativo come passphrase!
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fornisce chiave MD5 x una chiave secondaria/di checksum data dai parametri in ingresso
|
||||
/// MasterKey/string[] chiavi singole child/expiryDate
|
||||
/// </summary>
|
||||
/// <param name="MasterKey">Chiave master da cui si parte</param>
|
||||
/// <param name="Payload">Payload che contiene le chiavi SUB (child) riferite alla master in formato JSon (compresso/no indent)</param>
|
||||
/// <returns></returns>
|
||||
public static string getChecksumKey(string MasterKey, string Payload)
|
||||
{
|
||||
string answ = "";
|
||||
answ = SteamCrypto.EncryptString(Payload, MasterKey);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// numero di licenze attive per cliente/applicativo
|
||||
/// </summary>
|
||||
/// <param name="cliente"></param>
|
||||
/// <param name="applicativo"></param>
|
||||
/// <returns></returns>
|
||||
public static int getLicenseNum(string cliente, string applicativo)
|
||||
{
|
||||
// !!!FARE!!! chiamata a webservice 1/mese
|
||||
int answ = 1;
|
||||
// molto hard-coded e discutibile... licenze "perenni"
|
||||
switch (cliente)
|
||||
{
|
||||
default:
|
||||
answ = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32112.339
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Land", "MP.Land\MP.Land.csproj", "{D949AB45-9B65-4594-A97E-182BC3831707}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.AppAuth", "MP.AppAuth\MP.AppAuth.csproj", "{E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Egw.Core", "Egw.Core\Egw.Core.csproj", "{D3D348EF-1313-43DF-94FB-28CD38B68212}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{D949AB45-9B65-4594-A97E-182BC3831707}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D949AB45-9B65-4594-A97E-182BC3831707}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D949AB45-9B65-4594-A97E-182BC3831707}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D949AB45-9B65-4594-A97E-182BC3831707}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E8B1E617-87BC-4638-A8B6-04EEBA3B8F47}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D3D348EF-1313-43DF-94FB-28CD38B68212}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D3D348EF-1313-43DF-94FB-28CD38B68212}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D3D348EF-1313-43DF-94FB-28CD38B68212}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D3D348EF-1313-43DF-94FB-28CD38B68212}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {632D11D1-088B-4795-97E5-048534002558}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32126.317
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Data", "MP.Data\MP.Data.csproj", "{10BA8450-301D-49C7-8E1E-21B7469C225C}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Mon", "MP.Mon\MP.Mon.csproj", "{7780FA7A-3597-4098-81C1-DC9AD6AE7A98}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{10BA8450-301D-49C7-8E1E-21B7469C225C}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7780FA7A-3597-4098-81C1-DC9AD6AE7A98}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{7780FA7A-3597-4098-81C1-DC9AD6AE7A98}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7780FA7A-3597-4098-81C1-DC9AD6AE7A98}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7780FA7A-3597-4098-81C1-DC9AD6AE7A98}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {632D11D1-088B-4795-97E5-048534002558}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31229.75
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Prog", "MP.Prog\MP.Prog.csproj", "{3223DDE4-564E-4D58-8A94-E368B9778C67}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.FileData", "MP.FileData\MP.FileData.csproj", "{48693321-1FA6-4DBB-A730-B8EF3E0B68D2}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{3223DDE4-564E-4D58-8A94-E368B9778C67}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3223DDE4-564E-4D58-8A94-E368B9778C67}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3223DDE4-564E-4D58-8A94-E368B9778C67}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{3223DDE4-564E-4D58-8A94-E368B9778C67}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{48693321-1FA6-4DBB-A730-B8EF3E0B68D2}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {632D11D1-088B-4795-97E5-048534002558}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.31229.75
|
||||
# Visual Studio Version 17
|
||||
VisualStudioVersion = 17.0.32126.317
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MP.Stats", "MP.Stats\MP.Stats.csproj", "{D9901B50-E61C-400C-B62C-FA060CF72C29}"
|
||||
EndProject
|
||||
|
||||
@@ -0,0 +1,147 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.AppAuth.Models;
|
||||
using NLog;
|
||||
using System;
|
||||
|
||||
namespace MP.AppAuth
|
||||
{
|
||||
public partial class AppAuthContext : DbContext
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.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 AppAuthContext()
|
||||
{
|
||||
}
|
||||
|
||||
public AppAuthContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Exception during context initialization 01");
|
||||
}
|
||||
}
|
||||
|
||||
public AppAuthContext(DbContextOptions<AppAuthContext> 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<AnagraficaGruppi> DbSetAnagraficaGruppi { get; set; }
|
||||
public virtual DbSet<AnagraficaOperatori> DbSetAnagOpr { get; set; }
|
||||
public virtual DbSet<Gruppi2Operatori> DbSetGruppi2Oper { get; set; }
|
||||
public virtual DbSet<UpdMan> DbSetUpdMan { get; set; }
|
||||
public virtual DbSet<Vocabolario> DbSetVocabolario { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
string connString = _configuration.GetConnectionString("MP.Land");
|
||||
if (!string.IsNullOrEmpty(connString))
|
||||
{
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
}
|
||||
else
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
modelBuilder.Entity<Vocabolario>(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);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagraficaGruppi>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.CodGruppo);
|
||||
|
||||
entity.ToTable("AnagraficaGruppi");
|
||||
|
||||
entity.Property(e => e.CodGruppo).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DescrGruppo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.SelEnabled).HasComment("Indica se sia selezionabile a livello di tendina x inserimento BCode");
|
||||
|
||||
entity.Property(e => e.TipoGruppo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('REPARTO')")
|
||||
.HasComment("tipo gruppo: reparto (es x gestione operatori assegnati), GRUPPO FASE (es macchien che fanno lo stesso tipo di lavoro), ...");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Gruppi2Operatori>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.MatrOpr, e.CodGruppo });
|
||||
|
||||
entity.ToTable("Gruppi2Operatori");
|
||||
|
||||
entity.Property(e => e.CodGruppo).HasMaxLength(50);
|
||||
});
|
||||
|
||||
//
|
||||
modelBuilder.Seed();
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,193 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth.Controllers
|
||||
{
|
||||
public class AppAuthController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static AppAuthContext dbCtx;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public AppAuthController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
dbCtx = new AppAuthContext(configuration);
|
||||
Log.Info("Avviata classe AppAuthController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Record x Gruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Models.AnagraficaGruppi> AnagGruppiFilt(string codTipo)
|
||||
{
|
||||
List<Models.AnagraficaGruppi> dbResult = new List<Models.AnagraficaGruppi>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagraficaGruppi
|
||||
.Where(x => x.TipoGruppo == codTipo || x.SelEnabled)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
/// <summary>
|
||||
/// Elenco Record x Gruppi
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Models.AnagraficaGruppi> AnagGruppiGetAll()
|
||||
{
|
||||
List<Models.AnagraficaGruppi> dbResult = new List<Models.AnagraficaGruppi>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagraficaGruppi
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public List<Models.AnagraficaOperatori> AnagOpGetAll(string searchVal)
|
||||
{
|
||||
List<Models.AnagraficaOperatori> dbResult = new List<Models.AnagraficaOperatori>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal))
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagOpr
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
// ritorno
|
||||
return dbResult;
|
||||
}
|
||||
public List<Models.AnagraficaOperatori> AnagOpByGruppoGetFilt(string codGruppo, string searchVal)
|
||||
{
|
||||
List<Models.AnagraficaOperatori> dbResult = new List<Models.AnagraficaOperatori>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
if (!string.IsNullOrEmpty(searchVal))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetGruppi2Oper
|
||||
.Where(x => x.CodGruppo == codGruppo || string.IsNullOrEmpty(codGruppo))
|
||||
.Join(
|
||||
localDbCtx.DbSetAnagOpr.Where(x => x.Cognome.Contains(searchVal) || x.Nome.Contains(searchVal)),
|
||||
gruppo => gruppo.MatrOpr,
|
||||
operatore => operatore.MatrOpr,
|
||||
(gruppo, operatore) => operatore
|
||||
)
|
||||
.ToList();
|
||||
}
|
||||
else
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetGruppi2Oper
|
||||
.Where(x => x.CodGruppo == codGruppo || string.IsNullOrEmpty(codGruppo))
|
||||
.Join(
|
||||
localDbCtx.DbSetAnagOpr,
|
||||
gruppo => gruppo.MatrOpr,
|
||||
operatore => operatore.MatrOpr,
|
||||
(gruppo, operatore) => operatore
|
||||
)
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
// ritorno
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
public void ResetController()
|
||||
{
|
||||
dbCtx = new AppAuthContext(_configuration);
|
||||
Log.Info("Effettuato reset AppAuthController");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Annulla modifiche su una specifica entity (cancel update)
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool RollBackEntity(object item)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
{
|
||||
if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified)
|
||||
{
|
||||
dbCtx.Entry(item).Reload();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Record x gestione Update
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Models.UpdMan> UpdManGetAll()
|
||||
{
|
||||
List<Models.UpdMan> dbResult = new List<Models.UpdMan>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetUpdMan
|
||||
.OrderBy(x => x.Ordinal)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Record x gestione Update
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Models.Vocabolario> VocabolarioGetAll()
|
||||
{
|
||||
List<Models.Vocabolario> dbResult = new List<Models.Vocabolario>();
|
||||
using (AppAuthContext localDbCtx = new AppAuthContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetVocabolario
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MP.AppAuth.Controllers
|
||||
{
|
||||
public class MPController : IDisposable
|
||||
{
|
||||
#region Public Fields
|
||||
|
||||
public static AppAuth.Controllers.MPController dbController;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public MPController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
Log.Info("Avviata classe MpController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Elenco Record x AnagKeyValue
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<Models.AnagKeyValueModel> AnagKeyValuesGetAll()
|
||||
{
|
||||
List<Models.AnagKeyValueModel> dbResult = new List<Models.AnagKeyValueModel>();
|
||||
using (MoonProContext localDbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = localDbCtx
|
||||
.DbSetAnagKeyValues
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,276 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper x estrarre dati sintetici su HW, Software, librerie installate...
|
||||
/// </summary>
|
||||
public class HwSwInfo
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Assembly di base
|
||||
/// </summary>
|
||||
protected Assembly assembly = Assembly.GetExecutingAssembly();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Istanza base
|
||||
/// </summary>
|
||||
public HwSwInfo()
|
||||
{
|
||||
assembly = Assembly.GetExecutingAssembly();
|
||||
}
|
||||
|
||||
public HwSwInfo(Assembly targetAssembly)
|
||||
{
|
||||
assembly = targetAssembly;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Singleton!
|
||||
/// </summary>
|
||||
public static HwSwInfo man = new HwSwInfo();
|
||||
#endif
|
||||
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche IIS
|
||||
/// </summary>
|
||||
public string IISStats
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
using (var iis = Process.GetCurrentProcess())
|
||||
{
|
||||
//Process iis = Process.GetCurrentProcess();
|
||||
sb.AppendLine(string.Format("UPTIME: {0}", ToDateString(DateTime.Now - iis.StartTime)));
|
||||
sb.AppendLine(string.Format("Priority: {0}", iis.PriorityClass));
|
||||
sb.AppendLine(string.Format("Physical Memory Used: {0}", memFormat(iis.WorkingSet64)));
|
||||
sb.AppendLine(string.Format("Virtual Memory Used: {0}", memFormat(iis.VirtualMemorySize64)));
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Versioni di ogni libreria compresa
|
||||
/// </summary>
|
||||
public string librariesVers
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
AssemblyName[] referencedAssemblyNames = assembly.GetReferencedAssemblies();
|
||||
foreach (AssemblyName referencedAssemblyName in referencedAssemblyNames.OrderBy(n => n.Name))
|
||||
{
|
||||
answ += referencedAssemblyName.FullName + Environment.NewLine;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Nome MainAssembly
|
||||
/// </summary>
|
||||
public string mainAssembly
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = assembly.FullName;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Num di librerie inserite
|
||||
/// </summary>
|
||||
public int numLibraries
|
||||
{
|
||||
get
|
||||
{
|
||||
int numLib = 0; ;
|
||||
try
|
||||
{
|
||||
AssemblyName[] referencedAssemblyNames = assembly.GetReferencedAssemblies();
|
||||
foreach (AssemblyName referencedAssemblyName in referencedAssemblyNames.OrderBy(n => n.Name))
|
||||
{
|
||||
numLib++;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return numLib;
|
||||
}
|
||||
}
|
||||
|
||||
///// <summary>
|
||||
///// Dati sui server redis...
|
||||
///// </summary>
|
||||
//public string redisServersData
|
||||
//{
|
||||
// get
|
||||
// {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// try
|
||||
// {
|
||||
// var servData = memLayer.ML.redServInfo();
|
||||
// foreach (var item in servData)
|
||||
// {
|
||||
// sb.AppendLine(string.Format("Server: {0} | {1} | {2}", item, item.Version, item.ServerType));
|
||||
// // da completare con altre info?!?
|
||||
// var srvInfo = item.Info();
|
||||
// // esporto un pò di info x gruppo...
|
||||
// foreach (IGrouping<string, System.Collections.Generic.KeyValuePair<string, string>> capitolo in srvInfo)
|
||||
// {
|
||||
// sb.AppendLine("----------------------------------------------");
|
||||
// sb.AppendLine(string.Format("Capitolo: {0}", capitolo.Key));
|
||||
// sb.AppendLine("----------------------------------------------");
|
||||
// foreach (var kvp in capitolo)
|
||||
// {
|
||||
// sb.AppendLine(string.Format("{0}:{1}", kvp.Key, kvp.Value));
|
||||
// }
|
||||
|
||||
// sb.AppendLine();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// catch (Exception exc)
|
||||
// {
|
||||
// Log.Error($"Errore in redisServersData{Environment.NewLine}{exc}");
|
||||
// }
|
||||
// return sb.ToString();
|
||||
// }
|
||||
//}
|
||||
|
||||
/// <summary>
|
||||
/// Runtime assembly
|
||||
/// </summary>
|
||||
public string runtimeImg
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
try
|
||||
{
|
||||
answ = assembly.ImageRuntimeVersion;
|
||||
}
|
||||
catch
|
||||
{ }
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Statistiche server
|
||||
/// </summary>
|
||||
public string ServerStats
|
||||
{
|
||||
get
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try
|
||||
{
|
||||
// calcoli preliminari
|
||||
|
||||
// compongo output
|
||||
sb.AppendLine(string.Format("NAME: {0}", Environment.MachineName));
|
||||
sb.AppendLine(System.Runtime.InteropServices.RuntimeInformation.OSDescription);
|
||||
sb.AppendLine(System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription);
|
||||
sb.AppendLine(string.Format("OS 64bit: {0} | PROC 64bit: {1}", Environment.Is64BitOperatingSystem, Environment.Is64BitProcess));
|
||||
//sb.AppendLine(string.Format("SYS UPTIME: {0}", ToDateString(uptime)));
|
||||
sb.AppendLine(string.Format("CPU: {0}", Environment.ProcessorCount));
|
||||
//sb.AppendLine(string.Format("RAM: {0}", memFormat(computer.TotalPhysicalMemory)));
|
||||
//sb.AppendLine(string.Format("Virtual Memory: {0}", memFormat(computer.TotalVirtualMemory)));
|
||||
//sb.AppendLine(string.Format("Available RAM: {0}", memFormat(computer.AvailablePhysicalMemory)));
|
||||
//sb.AppendLine(string.Format("Available Virtual Memory: {0}", memFormat(computer.AvailableVirtualMemory)));
|
||||
sb.AppendLine(string.Format("DIR: {0}", Environment.CurrentDirectory));
|
||||
sb.AppendLine(string.Format("USER: {0} | USER: {1}", Environment.UserDomainName, Environment.UserName));
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Errore in ServerStats{Environment.NewLine}{exc}");
|
||||
}
|
||||
return sb.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Singleton!
|
||||
/// </summary>
|
||||
public static HwSwInfo man(Assembly targetAssembly)
|
||||
{
|
||||
HwSwInfo answ = new HwSwInfo(targetAssembly);
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Formatta un numero da int a size in Kb/Mb/Gb/Tb
|
||||
/// </summary>
|
||||
/// <param name="rawSize"></param>
|
||||
/// <returns></returns>
|
||||
public string memFormat(double rawSize)
|
||||
{
|
||||
string[] sizes = { "B", "KB", "MB", "GB", "TB" };
|
||||
int order = 0;
|
||||
while (rawSize >= 1024 && order < sizes.Length - 1)
|
||||
{
|
||||
order++;
|
||||
rawSize = rawSize / 1024;
|
||||
}
|
||||
|
||||
// Adjust the format string to your preferences. For example "{0:0.#}{1}" would
|
||||
// show a single decimal place, and no space.
|
||||
return String.Format("{0:0.##} {1}", rawSize, sizes[order]);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stringa timing in gg, ore, ... da timespan
|
||||
/// </summary>
|
||||
/// <param name="time"></param>
|
||||
/// <returns></returns>
|
||||
public string ToDateString(TimeSpan time)
|
||||
{
|
||||
return string.Format("{0}gg, {1:00}:{2:00}:{3:00} (h:m:s)", time.Days, time.Hours, time.Minutes, time.Seconds);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.10" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="NLog" Version="4.7.11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Egw.Core\Egw.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,28 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth
|
||||
{
|
||||
public static class ModelBuilderExtensions
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Estensione per seed iniziale dei dati nel DB
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder"></param>
|
||||
public static void Seed(this ModelBuilder modelBuilder)
|
||||
{
|
||||
//// inizializzazione dei valori di default x MACCHINA
|
||||
//modelBuilder.Entity<MacchinaModel>().HasData(
|
||||
// new MacchinaModel { IdxMacchina = "0", RuleName = "0", Descrizione = "--- Tutte ---", Nome = "--- Tutte ---", BasePath = "", ImgUrl = "", Note = "", ShowOrder = 0 }
|
||||
// );
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class AnagArticoli
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string CodArticolo { get; set; }
|
||||
public string CurrRev { get; set; }
|
||||
public string DescArticolo { get; set; }
|
||||
public string Disegno { get; set; }
|
||||
public bool? FlagIsNew { get; set; }
|
||||
public string ProdRev { get; set; }
|
||||
public string Tipo { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class AnagClassiTempo
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string ClasseTempo { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
[Table("AnagKeyValue")]
|
||||
public partial class AnagKeyValueModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key]
|
||||
public string NomeVar { get; set; }
|
||||
public int? ValInt { get; set; }
|
||||
public double? ValFloat { get; set; }
|
||||
public string ValString { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class AnagraficaCausaliScarto
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Causale { get; set; }
|
||||
public string CssClass { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
public string Icona { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class AnagraficaFlussi
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string CodFlux { get; set; }
|
||||
public string DescrFlux { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class AnagraficaGruppi
|
||||
{
|
||||
public string CodGruppo { get; set; }
|
||||
public string TipoGruppo { get; set; }
|
||||
public string DescrGruppo { get; set; }
|
||||
public bool SelEnabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class AnagraficaIngressi
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Descrizione { get; set; }
|
||||
public int IdxFamigliaIngresso { get; set; }
|
||||
public int ValoreIngresso { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class AnagraficaMicroStati
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Descrizione { get; set; }
|
||||
public int IdxFamigliaIngresso { get; set; }
|
||||
public int IdxMicroStato { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
[Table("AnagraficaOperatori")]
|
||||
public partial class AnagraficaOperatori
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string AuthKey { get; set; }
|
||||
public string CodOprExt { get; set; }
|
||||
public string Cognome { get; set; }
|
||||
public bool? IsAdmin { get; set; }
|
||||
|
||||
[Key]
|
||||
public int MatrOpr { get; set; }
|
||||
|
||||
public string Nome { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class Config
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Chiave { get; set; }
|
||||
public string Note { get; set; }
|
||||
public string Valore { get; set; }
|
||||
public string ValoreStd { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class DatiMacchine
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string CodArticoloA { get; set; }
|
||||
public string CodArticoloB { get; set; }
|
||||
public bool HasCounter { get; set; }
|
||||
public string IdxMacchina { get; set; }
|
||||
public bool? InsEnabled { get; set; }
|
||||
public bool? IsTrigerDbon { get; set; }
|
||||
public bool? PalletChange { get; set; }
|
||||
public int? RefreshPeriod { get; set; }
|
||||
public string SerialPort { get; set; }
|
||||
public bool? SimplePallet { get; set; }
|
||||
public bool? Simulazione { get; set; }
|
||||
public bool SLogEnabled { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class FamigliaTipoIngressi
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string DescrizioneIngresso { get; set; }
|
||||
public int IdxFamigliaIngresso { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class FamiglieMacchine
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Descrizione { get; set; }
|
||||
public bool? HasIob { get; set; }
|
||||
public bool? HasUdi { get; set; }
|
||||
public int IdxFamiglia { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class Gruppi2Operatori
|
||||
{
|
||||
public int MatrOpr { get; set; }
|
||||
public string CodGruppo { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class KeepAlive
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime? DataOraMacchina { get; set; }
|
||||
public DateTime? DataOraServer { get; set; }
|
||||
public DateTime? DataOraStart { get; set; }
|
||||
public string IdxMacchina { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class LinkMenuJqm
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Icona { get; set; }
|
||||
public int IdxLink { get; set; }
|
||||
public string NavigateUrl { get; set; }
|
||||
public int? Ordine { get; set; }
|
||||
public string Testo { get; set; }
|
||||
public string TipoLink { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class ListValue
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string FieldName { get; set; }
|
||||
public string Label { get; set; }
|
||||
public int? Ordinal { get; set; }
|
||||
public string TableName { get; set; }
|
||||
public string Value { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
public partial class Macchine
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string CodMacchina { get; set; }
|
||||
public int ColNum { get; set; }
|
||||
public string Css { get; set; }
|
||||
public string Descrizione { get; set; }
|
||||
public string IdxMacchina { get; set; }
|
||||
public string Locazione { get; set; }
|
||||
public string Nome { get; set; }
|
||||
public string Note { get; set; }
|
||||
public int RowNum { get; set; }
|
||||
public string Url { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
[Table("UpdMan")]
|
||||
public partial class UpdMan
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key]
|
||||
public string AppName { get; set; }
|
||||
|
||||
public string AppUrl { get; set; }
|
||||
public bool IsAuth { get; set; } = false;
|
||||
public string LicenseKey { get; set; }
|
||||
public string LocalRepo { get; set; }
|
||||
public string ManifestUrl { get; set; }
|
||||
public int Ordinal { get; set; } = 1;
|
||||
public string PackName { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.AppAuth.Models
|
||||
{
|
||||
[Table("Vocabolario")]
|
||||
public partial class Vocabolario
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string Lemma { get; set; }
|
||||
public string Lingua { get; set; }
|
||||
public string Traduzione { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,513 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.AppAuth.Models;
|
||||
using NLog;
|
||||
using System;
|
||||
|
||||
namespace MP.AppAuth
|
||||
{
|
||||
public partial class MoonProContext : DbContext
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.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 MoonProContext()
|
||||
{
|
||||
}
|
||||
|
||||
public MoonProContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Exception during context initialization 01");
|
||||
}
|
||||
}
|
||||
|
||||
public MoonProContext(DbContextOptions<MoonProContext> 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<AnagArticoli> AnagArticolis { get; set; }
|
||||
public virtual DbSet<AnagClassiTempo> AnagClassiTempos { get; set; }
|
||||
public virtual DbSet<AnagraficaCausaliScarto> AnagraficaCausaliScartos { get; set; }
|
||||
public virtual DbSet<AnagraficaFlussi> AnagraficaFlussis { get; set; }
|
||||
public virtual DbSet<AnagraficaIngressi> AnagraficaIngressis { get; set; }
|
||||
public virtual DbSet<AnagraficaMicroStati> AnagraficaMicroStatis { get; set; }
|
||||
public virtual DbSet<AnagraficaOperatori> AnagraficaOperatoris { get; set; }
|
||||
public virtual DbSet<Config> Configs { get; set; }
|
||||
public virtual DbSet<DatiMacchine> DatiMacchines { get; set; }
|
||||
public virtual DbSet<AnagKeyValueModel> DbSetAnagKeyValues { get; set; }
|
||||
public virtual DbSet<FamigliaTipoIngressi> FamigliaTipoIngressis { get; set; }
|
||||
public virtual DbSet<FamiglieMacchine> FamiglieMacchines { get; set; }
|
||||
public virtual DbSet<KeepAlive> KeepAlives { get; set; }
|
||||
public virtual DbSet<LinkMenuJqm> LinkMenuJqms { get; set; }
|
||||
public virtual DbSet<ListValue> ListValues { get; set; }
|
||||
public virtual DbSet<Macchine> Macchines { get; set; }
|
||||
public virtual DbSet<UpdMan> UpdMan { get; set; }
|
||||
public virtual DbSet<Vocabolario> DbSetVocabolario { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
string connString = _configuration.GetConnectionString("MP.Land");
|
||||
if (!string.IsNullOrEmpty(connString))
|
||||
{
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
}
|
||||
else
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
modelBuilder.Entity<AnagArticoli>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.CodArticolo);
|
||||
|
||||
entity.ToTable("AnagArticoli");
|
||||
|
||||
entity.Property(e => e.CodArticolo).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.CurrRev)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.DescArticolo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.Disegno)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.FlagIsNew).HasComputedColumnSql("(case when [CurrRev]=[ProdRev] then CONVERT([bit],(0),(0)) else CONVERT([bit],(1),(0)) end)", false);
|
||||
|
||||
entity.Property(e => e.ProdRev)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.Tipo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('ART')")
|
||||
.HasComment("Tipo di articolo: ART, KIT, ...");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagClassiTempo>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.ClasseTempo);
|
||||
|
||||
entity.ToTable("AnagClassiTempo");
|
||||
|
||||
entity.Property(e => e.ClasseTempo).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Descrizione).HasMaxLength(500);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagKeyValueModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.NomeVar);
|
||||
|
||||
entity.ToTable("AnagKeyValue");
|
||||
|
||||
entity.Property(e => e.NomeVar)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("nomeVar");
|
||||
|
||||
entity.Property(e => e.Descrizione)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("descrizione")
|
||||
.HasDefaultValueSql("('-')");
|
||||
|
||||
entity.Property(e => e.ValFloat)
|
||||
.HasColumnName("valFloat")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.ValInt)
|
||||
.HasColumnName("valInt")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.ValString)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("valString")
|
||||
.HasDefaultValueSql("('')");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagraficaCausaliScarto>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Causale);
|
||||
|
||||
entity.ToTable("AnagraficaCausaliScarto");
|
||||
|
||||
entity.Property(e => e.Causale)
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('ND')");
|
||||
|
||||
entity.Property(e => e.CssClass)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("cssClass")
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.Descrizione)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasDefaultValueSql("('ND')");
|
||||
|
||||
entity.Property(e => e.Icona)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("icona")
|
||||
.HasDefaultValueSql("('')");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagraficaFlussi>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.CodFlux);
|
||||
|
||||
entity.ToTable("AnagraficaFlussi");
|
||||
|
||||
entity.Property(e => e.CodFlux).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DescrFlux).HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagraficaIngressi>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxFamigliaIngresso, e.ValoreIngresso });
|
||||
|
||||
entity.ToTable("AnagraficaIngressi");
|
||||
|
||||
entity.Property(e => e.Descrizione).HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagraficaMicroStati>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.IdxFamigliaIngresso, e.IdxMicroStato });
|
||||
|
||||
entity.ToTable("AnagraficaMicroStati");
|
||||
|
||||
entity.Property(e => e.Descrizione).HasMaxLength(250);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<AnagraficaOperatori>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.MatrOpr);
|
||||
|
||||
entity.ToTable("AnagraficaOperatori");
|
||||
|
||||
entity.Property(e => e.MatrOpr).ValueGeneratedNever();
|
||||
|
||||
entity.Property(e => e.AuthKey)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("authKey")
|
||||
.HasDefaultValueSql("('12345')");
|
||||
|
||||
entity.Property(e => e.CodOprExt)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('')")
|
||||
.HasComment("Codice operatore per sistema esterno");
|
||||
|
||||
entity.Property(e => e.Cognome).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.IsAdmin).HasColumnName("isAdmin");
|
||||
|
||||
entity.Property(e => e.Nome).HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Config>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Chiave);
|
||||
|
||||
entity.ToTable("Config");
|
||||
|
||||
entity.Property(e => e.Chiave)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("chiave");
|
||||
|
||||
entity.Property(e => e.Note).HasColumnName("note");
|
||||
|
||||
entity.Property(e => e.Valore).HasColumnName("valore");
|
||||
|
||||
entity.Property(e => e.ValoreStd)
|
||||
.HasColumnName("valoreStd")
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<DatiMacchine>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxMacchina);
|
||||
|
||||
entity.ToTable("DatiMacchine");
|
||||
|
||||
entity.Property(e => e.IdxMacchina)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("idxMacchina");
|
||||
|
||||
entity.Property(e => e.CodArticoloA)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("CodArticolo_A");
|
||||
|
||||
entity.Property(e => e.CodArticoloB)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("CodArticolo_B");
|
||||
|
||||
entity.Property(e => e.HasCounter)
|
||||
.HasColumnName("hasCounter")
|
||||
.HasComment("Indica se la macchina abbia un COUNTER (assoluto) o meno, tipicamente true x IOB-WIN, false per IOB-PI");
|
||||
|
||||
entity.Property(e => e.InsEnabled)
|
||||
.HasColumnName("insEnabled")
|
||||
.HasDefaultValueSql("((1))")
|
||||
.HasComment("definisce se l'INSERT sia abilitato per la macchina (disabilitato in fase di ricostruzione batch...)");
|
||||
|
||||
entity.Property(e => e.IsTrigerDbon)
|
||||
.IsRequired()
|
||||
.HasColumnName("isTrigerDBOn")
|
||||
.HasDefaultValueSql("((1))")
|
||||
.HasComment("Abilita o meno il trigger su DiarioDiBordo x ricalcolo eventi");
|
||||
|
||||
entity.Property(e => e.PalletChange).HasColumnName("palletChange");
|
||||
|
||||
entity.Property(e => e.RefreshPeriod).HasColumnName("refreshPeriod");
|
||||
|
||||
entity.Property(e => e.SLogEnabled)
|
||||
.HasColumnName("sLogEnabled")
|
||||
.HasComment("definisce se sia abilitata la registrazione di TUTTI gli invii di dati in ingresso da questa specifica macchina");
|
||||
|
||||
entity.Property(e => e.SerialPort)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("serialPort");
|
||||
|
||||
entity.Property(e => e.SimplePallet).HasColumnName("simplePallet");
|
||||
|
||||
entity.Property(e => e.Simulazione).HasColumnName("simulazione");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<FamigliaTipoIngressi>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxFamigliaIngresso);
|
||||
|
||||
entity.ToTable("FamigliaTipoIngressi");
|
||||
|
||||
entity.Property(e => e.IdxFamigliaIngresso).ValueGeneratedNever();
|
||||
|
||||
entity.Property(e => e.DescrizioneIngresso).HasMaxLength(250);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<FamiglieMacchine>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxFamiglia);
|
||||
|
||||
entity.ToTable("FamiglieMacchine");
|
||||
|
||||
entity.Property(e => e.Descrizione)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250);
|
||||
|
||||
entity.Property(e => e.HasIob)
|
||||
.IsRequired()
|
||||
.HasColumnName("HasIOB")
|
||||
.HasDefaultValueSql("((1))")
|
||||
.HasComment("Indica se la famiglia macchina prevede una IOB x alimentare dati in AUTOMATICO da impianto");
|
||||
|
||||
entity.Property(e => e.HasUdi)
|
||||
.IsRequired()
|
||||
.HasColumnName("HasUDI")
|
||||
.HasDefaultValueSql("((1))")
|
||||
.HasComment("Indica se la famiglia macchina prevede UserDataInput ovvero inserimento MANUALE informazioni");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<KeepAlive>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxMacchina);
|
||||
|
||||
entity.ToTable("KeepAlive");
|
||||
|
||||
entity.Property(e => e.IdxMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DataOraMacchina).HasColumnType("datetime");
|
||||
|
||||
entity.Property(e => e.DataOraStart).HasColumnType("datetime");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<LinkMenuJqm>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxLink)
|
||||
.HasName("PK_linkMenuJQM");
|
||||
|
||||
entity.ToTable("LinkMenuJQM");
|
||||
|
||||
entity.Property(e => e.IdxLink).HasColumnName("idxLink");
|
||||
|
||||
entity.Property(e => e.Icona)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("icona");
|
||||
|
||||
entity.Property(e => e.NavigateUrl).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Ordine).HasColumnName("ordine");
|
||||
|
||||
entity.Property(e => e.Testo).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.TipoLink).HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<ListValue>(entity =>
|
||||
{
|
||||
entity.HasKey(e => new { e.TableName, e.FieldName, e.Value });
|
||||
|
||||
entity.Property(e => e.TableName).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.FieldName).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Value)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("value");
|
||||
|
||||
entity.Property(e => e.Label)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("label");
|
||||
|
||||
entity.Property(e => e.Ordinal).HasColumnName("ordinal");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Macchine>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.IdxMacchina);
|
||||
|
||||
entity.ToTable("Macchine");
|
||||
|
||||
entity.Property(e => e.IdxMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Css)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("css")
|
||||
.HasDefaultValueSql("('col text-center')")
|
||||
.HasComment("Classe container standard (col, col-2, ...)");
|
||||
|
||||
entity.Property(e => e.Descrizione).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Locazione)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("locazione");
|
||||
|
||||
entity.Property(e => e.Nome).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Note).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Url)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("url");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<UpdMan>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.AppName)
|
||||
.HasName("PK_UpdateMan");
|
||||
|
||||
entity.ToTable("UpdMan");
|
||||
|
||||
entity.Property(e => e.AppName).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.AppUrl)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250)
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.IsAuth)
|
||||
.IsRequired()
|
||||
.HasDefaultValueSql("((1))");
|
||||
|
||||
entity.Property(e => e.LicenseKey)
|
||||
.IsRequired()
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.LocalRepo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250);
|
||||
|
||||
entity.Property(e => e.ManifestUrl)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250);
|
||||
|
||||
entity.Property(e => e.PackName)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('')");
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Vocabolario>(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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,270 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml;
|
||||
|
||||
namespace MP.AppAuth
|
||||
{
|
||||
/// <summary>
|
||||
/// Object of this class gives you all the details about the update useful in handling the update logic yourself.
|
||||
/// </summary>
|
||||
public class UpdateInfoEventArgs : EventArgs
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// URL of the webpage specifying changes in the new update.
|
||||
/// </summary>
|
||||
public string ChangelogURL { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns newest version of the application available to download.
|
||||
/// </summary>
|
||||
public Version CurrentVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Download URL of the update file.
|
||||
/// </summary>
|
||||
public string DownloadURL { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Returns version of the application currently installed on the user's PC.
|
||||
/// </summary>
|
||||
public Version InstalledVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If new update is available then returns true otherwise false.
|
||||
/// </summary>
|
||||
public bool IsUpdateAvailable { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Shows if the update is required or optional.
|
||||
/// </summary>
|
||||
public bool Mandatory { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gestione update applicazioni
|
||||
/// </summary>
|
||||
public class UpdateMan
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected bool doAuth = false;
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
public static UpdateMan obj = new UpdateMan();
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
public UpdateMan()
|
||||
{ }
|
||||
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
/// <param name="user"></param>
|
||||
/// <param name="pwd"></param>
|
||||
public UpdateMan(string user, string pwd)
|
||||
{
|
||||
userName = user;
|
||||
passwd = pwd;
|
||||
doAuth = !string.IsNullOrEmpty($"{userName}{passwd}");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
protected string passwd { get; set; } = "";
|
||||
protected string userName { get; set; } = "";
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Effettua download ultima versione applicativo
|
||||
/// </summary>
|
||||
/// <param name="remoteUrl"></param>
|
||||
/// <param name="localRepo"></param>
|
||||
/// <param name="packName"></param>
|
||||
public long downloadLatest(string remoteUrl, string localRepo, string packName)
|
||||
{
|
||||
long size = 0;
|
||||
// verifico directory
|
||||
if (!Directory.Exists(localRepo))
|
||||
{
|
||||
Directory.CreateDirectory(localRepo);
|
||||
}
|
||||
string localFile = "";
|
||||
string localLast = "";
|
||||
string DownloadURL = "";
|
||||
try
|
||||
{
|
||||
// in primis scarico update info...
|
||||
UpdateInfoEventArgs updateData = getUpdateInfo(remoteUrl);
|
||||
if (updateData.IsUpdateAvailable)
|
||||
{
|
||||
DownloadURL = updateData.DownloadURL;
|
||||
localFile = string.Format(@"{0}\{1}_Build_{2}.zip", localRepo, packName, updateData.CurrentVersion);
|
||||
localLast = string.Format(@"{0}\{1}.zip", localRepo, packName);
|
||||
// scarica file e salva in directory locale...
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
//var client = new WebClient();
|
||||
//bool doAuth = !string.IsNullOrEmpty($"{userName}{passwd}");
|
||||
if (doAuth)
|
||||
{
|
||||
//client.Credentials = new System.Net.NetworkCredential(userName, passwd);
|
||||
http.DefaultRequestHeaders.Accept.Clear();
|
||||
var byteArray = System.Text.ASCIIEncoding.UTF8.GetBytes($"{userName}:{passwd}");
|
||||
http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
|
||||
}
|
||||
//client.DownloadFile(updateData.DownloadURL, localFile);
|
||||
|
||||
// url da chiamare
|
||||
http.BaseAddress = new Uri(DownloadURL);
|
||||
// lettura
|
||||
var data = http.GetAsync(DownloadURL).Result;
|
||||
using (var myReader = data.Content.ReadAsStreamAsync())
|
||||
{
|
||||
//var myReader = data.Content.ReadAsStreamAsync();
|
||||
if (data.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
Log.Info($"Errore in chiamata getUpdateInfo per URL {remoteUrl}: status code: {data.StatusCode}");
|
||||
}
|
||||
else
|
||||
{
|
||||
using (Stream outStream = File.OpenWrite(localFile))
|
||||
{
|
||||
myReader.Result.CopyTo(outStream);
|
||||
}
|
||||
// ora lo copio come latest...
|
||||
File.Copy(localFile, localLast, true);
|
||||
// indico come fatto!
|
||||
var thisFile = new FileInfo(localLast);
|
||||
size = thisFile.Length;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
localFile = string.Format(@"{0}\Error.log", localRepo);
|
||||
// scrivo file in area target...
|
||||
using (StreamWriter sw = File.AppendText(localFile))
|
||||
{
|
||||
sw.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} ATTENZIONE! Installer NON disponibile | {remoteUrl}");
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
localFile = string.Format(@"{0}\Error.log", localRepo);
|
||||
// scrivo file in area target...
|
||||
using (StreamWriter sw = File.AppendText(localFile))
|
||||
{
|
||||
sw.WriteLine($"{DateTime.Now:yyyy-MM-dd HH:mm:ss} Errore in fase di download installers{Environment.NewLine}XML: {remoteUrl}{Environment.NewLine}URL: {DownloadURL}");
|
||||
sw.WriteLine(exc.ToString());
|
||||
}
|
||||
}
|
||||
return size;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera l'ultima versione disponibile
|
||||
/// </summary>
|
||||
/// <param name="remoteUrl"></param>
|
||||
/// <returns></returns>
|
||||
public UpdateInfoEventArgs getUpdateInfo(string remoteUrl)
|
||||
{
|
||||
//bool doAuth = !string.IsNullOrEmpty($"{userName}{passwd}");
|
||||
|
||||
UpdateInfoEventArgs args = new UpdateInfoEventArgs();
|
||||
Version CurrentVersion;
|
||||
bool Mandatory;
|
||||
XmlDocument recXml = new XmlDocument();
|
||||
try
|
||||
{
|
||||
// recupero dati
|
||||
using (var http = new HttpClient())
|
||||
{
|
||||
if (doAuth)
|
||||
{
|
||||
http.DefaultRequestHeaders.Accept.Clear();
|
||||
var byteArray = System.Text.ASCIIEncoding.UTF8.GetBytes($"{userName}:{passwd}");
|
||||
http.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", Convert.ToBase64String(byteArray));
|
||||
}
|
||||
// url da chiamare
|
||||
http.BaseAddress = new Uri(remoteUrl);
|
||||
// lettura
|
||||
var data = http.GetAsync(remoteUrl).Result;
|
||||
var myReader = data.Content.ReadAsStreamAsync();
|
||||
if (data.StatusCode != HttpStatusCode.OK)
|
||||
{
|
||||
Log.Info($"Errore in chiamata getUpdateInfo per URL {remoteUrl}: status code: {data.StatusCode}");
|
||||
}
|
||||
else
|
||||
{
|
||||
recXml.Load(myReader.Result);
|
||||
|
||||
XmlNodeList recData = recXml.SelectNodes("item");
|
||||
if (recData != null)
|
||||
{
|
||||
foreach (XmlNode item in recData)
|
||||
{
|
||||
XmlNode appCastVersion = item.SelectSingleNode("version");
|
||||
Version.TryParse(appCastVersion?.InnerText, out CurrentVersion);
|
||||
args.CurrentVersion = CurrentVersion;
|
||||
XmlNode appCastChangeLog = item.SelectSingleNode("changelog");
|
||||
args.ChangelogURL = appCastChangeLog?.InnerText;
|
||||
XmlNode appCastUrl = item.SelectSingleNode("url");
|
||||
args.DownloadURL = appCastUrl?.InnerText;
|
||||
XmlNode mandatory = item.SelectSingleNode("mandatory");
|
||||
Boolean.TryParse(mandatory?.InnerText, out Mandatory);
|
||||
args.Mandatory = Mandatory;
|
||||
args.IsUpdateAvailable = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Info($"Eccezione in getUpdateInfo:{Environment.NewLine}{exc}");
|
||||
// metto versione = 0 + errore...
|
||||
args.IsUpdateAvailable = false;
|
||||
args.CurrentVersion = new Version("0.0.0.0");
|
||||
}
|
||||
return args;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.Conf
|
||||
{
|
||||
/// <summary>
|
||||
/// Struttura conf del file conf TAG x IOB
|
||||
/// </summary>
|
||||
public class IobTags
|
||||
{
|
||||
/// <summary>
|
||||
/// Oggetto dizionario di configurazione x IOB
|
||||
/// </summary>
|
||||
public Dictionary<string, List<TagData>> IobSetup = new Dictionary<string, List<TagData>>();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data.Conf
|
||||
{
|
||||
/// <summary>
|
||||
/// Item da mostrare nei blocchi MON degli impianti come override ai dati MSE
|
||||
/// </summary>
|
||||
public class TagData
|
||||
{
|
||||
/// <summary>
|
||||
/// Indice della colonna (ordine) del dato
|
||||
/// </summary>
|
||||
public int ColNum { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Indice della riga del dato
|
||||
/// </summary>
|
||||
public int RowNum { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Override CSS (es fontSmall)
|
||||
/// </summary>
|
||||
public string TagCss { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Etichetta da mostrare
|
||||
/// </summary>
|
||||
public string TagName { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Indicazione della chiave REDIS dove recuperare il tag indicato (già in formato string)
|
||||
/// </summary>
|
||||
public string TagLocation { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Clone dell'oggetto
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public TagData Clone()
|
||||
{
|
||||
return (TagData)this.MemberwiseClone();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,15 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data
|
||||
{
|
||||
class Constants
|
||||
public class Constants
|
||||
{
|
||||
|
||||
// dati conf REDIS Cache
|
||||
public static readonly string BASE_HASH = "MAPO";
|
||||
|
||||
// REDIS KEY Dati correnti
|
||||
public static readonly string CONF_MON_KEY = $"{BASE_HASH}:Conf:MonDispData";
|
||||
public static readonly string ACT_FLUX_DATA_KEY = $"{BASE_HASH}:Current:FluxData";
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace MP.Data.Controllers
|
||||
{
|
||||
public class MpMonController : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public MpMonController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
Log.Info("Avviata classe MpMonController");
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Articoli da filtro
|
||||
/// </summary>
|
||||
/// <param name="numRecord"></param>
|
||||
/// <param name="searchVal"></param>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.AnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetArticoli
|
||||
.Where(x => x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella Macchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.Macchine> MacchineGetAll()
|
||||
{
|
||||
List<DatabaseModels.Macchine> dbResult = new List<DatabaseModels.Macchine>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMacchine
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella Macchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.ConfigModel> ConfigGetAll()
|
||||
{
|
||||
List<DatabaseModels.ConfigModel> dbResult = new List<DatabaseModels.ConfigModel>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetConfig
|
||||
.OrderBy(x => x.Chiave)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco da tabella MappaStatoExpl
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.MappaStatoExpl> MseGetAll(int maxAge = 2000)
|
||||
{
|
||||
List<DatabaseModels.MappaStatoExpl> dbResult = new List<DatabaseModels.MappaStatoExpl>();
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
var maxAgeSec = new SqlParameter("@maxAgeSec", maxAge);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetMSE
|
||||
.FromSqlRaw("EXEC stp_MSE_getData @maxAgeSec", maxAgeSec)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Annulla modifiche su una specifica entity (cancel update)
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns></returns>
|
||||
public bool RollBackEntity(object item)
|
||||
{
|
||||
bool answ = false;
|
||||
using (var dbCtx = new MoonProContext(_configuration))
|
||||
{
|
||||
try
|
||||
{
|
||||
if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified)
|
||||
{
|
||||
dbCtx.Entry(item).Reload();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,10 @@
|
||||
using System;
|
||||
using Microsoft.Data.SqlClient;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Configuration;
|
||||
using NLog;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Data.SqlClient;
|
||||
|
||||
namespace MP.Data.Controllers
|
||||
{
|
||||
@@ -16,7 +13,7 @@ namespace MP.Data.Controllers
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
private static MoonPro_STATSContext dbCtx;
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
@@ -26,7 +23,6 @@ namespace MP.Data.Controllers
|
||||
public MpStatsController(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
dbCtx = new MoonPro_STATSContext(configuration);
|
||||
Log.Info("Avviata classe MpStatsController");
|
||||
}
|
||||
|
||||
@@ -41,11 +37,12 @@ namespace MP.Data.Controllers
|
||||
public List<DatabaseModels.AzioniUL> ActionsGetAll()
|
||||
{
|
||||
List<DatabaseModels.AzioniUL> dbResult = new List<DatabaseModels.AzioniUL>();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetAzioniUL
|
||||
.ToList();
|
||||
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetAzioniUL
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -58,14 +55,15 @@ namespace MP.Data.Controllers
|
||||
public List<DatabaseModels.AnagArticoli> ArticoliGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.AnagArticoli> dbResult = new List<DatabaseModels.AnagArticoli>();
|
||||
|
||||
dbResult = dbCtx
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetArticoli
|
||||
.Where(x => x.CodArticolo.Contains(searchVal) || x.DescArticolo.Contains(searchVal) || x.Disegno.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
.OrderBy(x => x.CodArticolo)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -78,45 +76,39 @@ namespace MP.Data.Controllers
|
||||
public List<DatabaseModels.ODL> CommesseGetSearch(int numRecord, string searchVal = "")
|
||||
{
|
||||
List<DatabaseModels.ODL> dbResult = new List<DatabaseModels.ODL>();
|
||||
|
||||
dbResult = dbCtx
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.Where(x => x.KeyRichiesta.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
.OrderBy(x => x.KeyRichiesta)
|
||||
.Take(numRecord)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database context
|
||||
dbCtx.Dispose();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco tabella Macchine
|
||||
/// Elenco da tabella Macchine
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public List<DatabaseModels.Macchine> MacchineGetAll()
|
||||
{
|
||||
List<DatabaseModels.Macchine> dbResult = new List<DatabaseModels.Macchine>();
|
||||
|
||||
dbResult = dbCtx
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
dbResult = dbCtx
|
||||
.DbSetMacchine
|
||||
.OrderBy(x => x.IdxMacchina)
|
||||
.ToList();
|
||||
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
public void ResetController()
|
||||
{
|
||||
dbCtx = new MoonPro_STATSContext(_configuration);
|
||||
Log.Info("Effettuato reset MpStatsController");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Annulla modifiche su una specifica entity (cancel update)
|
||||
/// </summary>
|
||||
@@ -125,16 +117,19 @@ namespace MP.Data.Controllers
|
||||
public bool RollBackEntity(object item)
|
||||
{
|
||||
bool answ = false;
|
||||
try
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified)
|
||||
try
|
||||
{
|
||||
dbCtx.Entry(item).Reload();
|
||||
if (dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Deleted || dbCtx.Entry(item).State == Microsoft.EntityFrameworkCore.EntityState.Modified)
|
||||
{
|
||||
dbCtx.Entry(item).Reload();
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
||||
}
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error($"Eccezione in rollBackEntity{Environment.NewLine}{exc}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
@@ -148,19 +143,20 @@ namespace MP.Data.Controllers
|
||||
public List<DatabaseModels.ResControlli> StatControlliGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.ResControlli> dbResult = new List<DatabaseModels.ResControlli>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetControlli
|
||||
.FromSqlRaw("EXEC stp_UI_RC_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetControlli
|
||||
.FromSqlRaw("EXEC stp_UI_RC_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -179,21 +175,22 @@ namespace MP.Data.Controllers
|
||||
public List<DatabaseModels.DdbTurni> StatDdbGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo, int FirstRecord, int NumRecord)
|
||||
{
|
||||
List<DatabaseModels.DdbTurni> dbResult = new List<DatabaseModels.DdbTurni>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
var firstRecord = new SqlParameter("@FirstRecord", FirstRecord);
|
||||
var numRecord = new SqlParameter("@NumRecord", NumRecord);
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
var firstRecord = new SqlParameter("@FirstRecord", FirstRecord);
|
||||
var numRecord = new SqlParameter("@NumRecord", NumRecord);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetDdbTurni
|
||||
.FromSqlRaw("EXEC stp_UI_DDBTurni_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo,@FirstRecord,@NumRecord", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo, firstRecord, numRecord)
|
||||
.ToList();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetDdbTurni
|
||||
.FromSqlRaw("EXEC stp_UI_DDBTurni_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo,@FirstRecord,@NumRecord", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo, firstRecord, numRecord)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -209,12 +206,15 @@ namespace MP.Data.Controllers
|
||||
/// <returns></returns>
|
||||
public int StatDdbGetCount(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
var dbResult = dbCtx
|
||||
int numResult = 0;
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
numResult = dbCtx
|
||||
.DbSetDdbTurni
|
||||
.Where(x => (x.IdxMacchina == IdxMacchina || IdxMacchina == "*") && (x.IdxOdl == IdxODL || IdxODL == -999) && (x.KeyRichiesta == KeyRichiesta || KeyRichiesta == "*") && (x.CodArticolo == CodArticolo || CodArticolo == "*") && (x.InizioPeriodo >= DataStart && x.InizioPeriodo <= DataEnd))
|
||||
.Count();
|
||||
|
||||
return dbResult;
|
||||
}
|
||||
return numResult;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -226,19 +226,20 @@ namespace MP.Data.Controllers
|
||||
public List<DatabaseModels.ODL> StatOdlGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.ODL> dbResult = new List<DatabaseModels.ODL>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.FromSqlRaw("EXEC stp_UI_Odl_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetODL
|
||||
.FromSqlRaw("EXEC stp_UI_Odl_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -253,19 +254,20 @@ namespace MP.Data.Controllers
|
||||
public List<DatabaseModels.ResScarti> StatScartiGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.ResScarti> dbResult = new List<DatabaseModels.ResScarti>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetScarti
|
||||
.FromSqlRaw("EXEC stp_UI_RS_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetScarti
|
||||
.FromSqlRaw("EXEC stp_UI_RS_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -280,19 +282,20 @@ namespace MP.Data.Controllers
|
||||
public List<DatabaseModels.TurniOee> StatTurniOeeGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.TurniOee> dbResult = new List<DatabaseModels.TurniOee>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetTurniOee
|
||||
.FromSqlRaw("EXEC stp_UI_TurniOee_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetTurniOee
|
||||
.FromSqlRaw("EXEC stp_UI_TurniOee_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
@@ -305,26 +308,20 @@ namespace MP.Data.Controllers
|
||||
public List<DatabaseModels.UserActionLog> StatUserLogGetAll(DateTime DataStart, DateTime DataEnd, string IdxMacchina, int IdxODL, string KeyRichiesta, string CodArticolo)
|
||||
{
|
||||
List<DatabaseModels.UserActionLog> dbResult = new List<DatabaseModels.UserActionLog>();
|
||||
using (var dbCtx = new MoonPro_STATSContext(_configuration))
|
||||
{
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
//dbResult = dbCtx
|
||||
// .DbSetUserLog
|
||||
// .Where(x => x.Valore.Contains(searchVal) || x.Cognome.Contains(searchVal) || x.CodArticolo.Contains(searchVal) || string.IsNullOrEmpty(searchVal))
|
||||
// .OrderByDescending(x => x.DataOraRif)
|
||||
// .Take(numRecord)
|
||||
// .ToList();
|
||||
|
||||
var dataFrom = new SqlParameter("@dataFrom", DataStart);
|
||||
var dataTo = new SqlParameter("@dataTo", DataEnd);
|
||||
var idxMacchina = new SqlParameter("@idxMacchina", IdxMacchina);
|
||||
var idxODL = new SqlParameter("@IdxODL", IdxODL);
|
||||
var keyRichiesta = new SqlParameter("@KeyRichiesta", KeyRichiesta);
|
||||
var codArticolo = new SqlParameter("@CodArticolo", CodArticolo);
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetUserLog
|
||||
.FromSqlRaw("EXEC stp_UI_UL_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
|
||||
dbResult = dbCtx
|
||||
.DbSetUserLog
|
||||
.FromSqlRaw("EXEC stp_UI_UL_GetByFilter @dataFrom,@dataTo,@idxMacchina,@IdxODL,@KeyRichiesta,@CodArticolo", dataFrom, dataTo, idxMacchina, idxODL, keyRichiesta, codArticolo)
|
||||
.ToList();
|
||||
}
|
||||
return dbResult;
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
[Table("Config")]
|
||||
public partial class ConfigModel
|
||||
{
|
||||
public string Chiave { get; set; }
|
||||
public string Valore { get; set; }
|
||||
/// <summary>
|
||||
/// Valore di default/riferimento per la variabile
|
||||
/// </summary>
|
||||
public string ValoreStd { get; set; }
|
||||
public string Note { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace MP.Data.DatabaseModels
|
||||
{
|
||||
public partial class MappaStatoExpl
|
||||
{
|
||||
public int RowNum { get; set; }
|
||||
public DateTime? LastUpdate { get; set; }
|
||||
public string IdxMacchina { get; set; }
|
||||
public string CodMacchina { get; set; }
|
||||
public string Nome { get; set; }
|
||||
public string Url { get; set; }
|
||||
public int? IdxOdl { get; set; }
|
||||
public string CodArticolo { get; set; }
|
||||
public string Disegno { get; set; }
|
||||
public int? NumPezzi { get; set; }
|
||||
public decimal? TCAssegnato { get; set; }
|
||||
public DateTime? DataInizioOdl { get; set; }
|
||||
public string Semaforo { get; set; }
|
||||
public int? IdxStato { get; set; }
|
||||
public string DescrizioneStato { get; set; }
|
||||
public double? Durata { get; set; }
|
||||
public int? PezziProd { get; set; }
|
||||
public int? PezziConf { get; set; }
|
||||
public decimal? TempoOn { get; set; }
|
||||
public decimal? TempoAuto { get; set; }
|
||||
public decimal? TempoRun { get; set; }
|
||||
public decimal? TCMedio { get; set; }
|
||||
public decimal? TCLav { get; set; }
|
||||
public decimal? TCEff { get; set; }
|
||||
public decimal? TCMedioRt { get; set; }
|
||||
public decimal? TCLavRT { get; set; }
|
||||
public decimal? TCEffRT { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using System;
|
||||
|
||||
namespace MP.Data
|
||||
{
|
||||
public class Enums
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AssemblyName>MP.Data</AssemblyName>
|
||||
<RootNamespace>MP.Data</RootNamespace>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net5.0</TargetFramework>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<AssemblyName>MP.Data</AssemblyName>
|
||||
<RootNamespace>MP.Data</RootNamespace>
|
||||
</PropertyGroup>
|
||||
@@ -12,14 +12,14 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.6" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.6">
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.4" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.4">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
||||
<PackageReference Include="NLog" Version="4.7.10" />
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.4" />
|
||||
<PackageReference Include="NLog" Version="4.7.15" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,232 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Data.DatabaseModels;
|
||||
using NLog;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace MP.Data
|
||||
{
|
||||
public partial class MoonProContext : DbContext
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private IConfiguration _configuration;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public MoonProContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
}
|
||||
|
||||
public MoonProContext(DbContextOptions<MoonProContext> options) : base(options)
|
||||
{
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public virtual DbSet<AnagArticoli> DbSetArticoli { get; set; }
|
||||
public virtual DbSet<Macchine> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<MappaStatoExpl> DbSetMSE { get; set; }
|
||||
public virtual DbSet<ConfigModel> DbSetConfig { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
string connString = _configuration.GetConnectionString("Mp.Mon");
|
||||
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
//optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
modelBuilder.Entity<AnagArticoli>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
entity.ToView("v_UI_AnagArticoli");
|
||||
|
||||
entity.Property(e => e.CodArticolo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DescArticolo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(250);
|
||||
|
||||
entity.Property(e => e.Disegno)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Tipo)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<Macchine>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
entity.ToView("Macchine");
|
||||
|
||||
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Descrizione).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.IdxMacchina)
|
||||
.IsRequired()
|
||||
.HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.Nome).HasMaxLength(50);
|
||||
});
|
||||
|
||||
modelBuilder.Entity<MappaStatoExpl>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.RowNum);
|
||||
|
||||
entity.ToTable("MappaStatoExpl");
|
||||
|
||||
entity.Property(e => e.CodArticolo)
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('-')");
|
||||
|
||||
entity.Property(e => e.CodMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.DataInizioOdl)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("DataInizioODL");
|
||||
|
||||
entity.Property(e => e.DescrizioneStato)
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('n.d.')");
|
||||
|
||||
entity.Property(e => e.Disegno)
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.Durata)
|
||||
.HasColumnName("durata")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.IdxMacchina).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.IdxOdl).HasColumnName("idxODL");
|
||||
|
||||
entity.Property(e => e.IdxStato)
|
||||
.HasColumnName("idxStato")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.LastUpdate)
|
||||
.HasColumnType("datetime")
|
||||
.HasColumnName("lastUpdate");
|
||||
|
||||
entity.Property(e => e.Nome).HasMaxLength(50);
|
||||
|
||||
entity.Property(e => e.PezziConf).HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.PezziProd).HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.Semaforo)
|
||||
.HasMaxLength(50)
|
||||
.HasDefaultValueSql("('')");
|
||||
|
||||
entity.Property(e => e.TCAssegnato)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasColumnName("TCAssegnato")
|
||||
.HasDefaultValueSql("((1))");
|
||||
|
||||
entity.Property(e => e.TCEff)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasColumnName("TCEff")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.TCEffRT)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasColumnName("TCEffRT")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.TCLav)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasColumnName("TCLav")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.TCLavRT)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasColumnName("TCLavRT")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.TCMedio)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasColumnName("TCMedio")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.TCMedioRt)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasColumnName("TCMedioRT")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.TempoAuto)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.TempoOn)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.TempoRun)
|
||||
.HasColumnType("decimal(18, 8)")
|
||||
.HasDefaultValueSql("((0))");
|
||||
|
||||
entity.Property(e => e.Url)
|
||||
.HasMaxLength(250)
|
||||
.HasColumnName("url");
|
||||
});
|
||||
modelBuilder.Entity<ConfigModel>(entity =>
|
||||
{
|
||||
entity.HasKey(e => e.Chiave);
|
||||
|
||||
entity.ToTable("Config");
|
||||
|
||||
entity.Property(e => e.Chiave)
|
||||
.HasMaxLength(50)
|
||||
.HasColumnName("chiave");
|
||||
|
||||
entity.Property(e => e.Note).HasColumnName("note");
|
||||
|
||||
entity.Property(e => e.Valore).HasColumnName("valore");
|
||||
|
||||
entity.Property(e => e.ValoreStd)
|
||||
.HasColumnName("valoreStd")
|
||||
.HasComment("Valore di default/riferimento per la variabile");
|
||||
});
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -42,10 +42,6 @@ namespace MP.Data
|
||||
public virtual DbSet<ODL> DbSetODL { get; set; }
|
||||
public virtual DbSet<ResScarti> DbSetScarti { get; set; }
|
||||
public virtual DbSet<TurniOee> DbSetTurniOee { get; set; }
|
||||
#if false
|
||||
public virtual DbSet<TurniPareto> DbSetTurniPareto { get; set; }
|
||||
public virtual DbSet<TurniParetoOdl> DbSetTurniParetoOdl { get; set; }
|
||||
#endif
|
||||
public virtual DbSet<UserActionLog> DbSetUserLog { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
@@ -142,6 +138,7 @@ namespace MP.Data
|
||||
entity.Property(e => e.Nome).HasMaxLength(50);
|
||||
});
|
||||
|
||||
|
||||
modelBuilder.Entity<DdbTurni>(entity =>
|
||||
{
|
||||
entity.HasNoKey();
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Data
|
||||
{
|
||||
public class StatsDbContext
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
using System;
|
||||
|
||||
namespace MP.Data
|
||||
{
|
||||
public class chartJsData
|
||||
{
|
||||
#region Public Classes
|
||||
|
||||
public class chartJsTSerie
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime x { get; set; }
|
||||
public double y { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class chartJsXY
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public double x { get; set; }
|
||||
public double y { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
#endregion Public Classes
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.FileData.DTO
|
||||
{
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
public class ArchiveStatusDTO
|
||||
{
|
||||
/// <summary>
|
||||
/// Idx macchina
|
||||
/// </summary>
|
||||
public string IdxMacchina { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Nome macchina
|
||||
/// </summary>
|
||||
public string Nome { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Descrizione macchina
|
||||
/// </summary>
|
||||
public string Descrizione { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Percorso base x macchina
|
||||
/// </summary>
|
||||
public string BasePath { get; set; } = "";
|
||||
/// <summary>
|
||||
/// Totale file della amcchina
|
||||
/// </summary>
|
||||
public int TotFile { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// NBumero file modificati da confermare/rifiutare
|
||||
/// </summary>
|
||||
public int NumChanged { get; set; } = 0;
|
||||
/// <summary>
|
||||
/// Conteggio totale tags x macchina
|
||||
/// </summary>
|
||||
public int TotalTags { get; set; }
|
||||
/// <summary>
|
||||
/// Numero di file SENZA tag
|
||||
/// </summary>
|
||||
public int NoTags { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
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;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.FileData.DatabaseModels
|
||||
{
|
||||
/// <summary>
|
||||
/// Tabella archivio dei File Programma
|
||||
/// </summary>
|
||||
[Table("Files")]
|
||||
[Index(nameof(IdxMacchina), nameof(Active), nameof(DiskStatus))]
|
||||
public partial class FileModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
public int FileId { get; set; }
|
||||
public bool Active { get; set; } = true;
|
||||
public string IdxMacchina { get; set; } = "";
|
||||
public string Name { get; set; } = "";
|
||||
public int Rev { get; set; } = 0;
|
||||
public DateTime LastMod { get; set; }
|
||||
public long Size { get; set; } = 0;
|
||||
public string Path { get; set; } = "";
|
||||
public string MimeType { get; set; } = "";
|
||||
public string MD5 { get; set; } = "";
|
||||
public FileState DiskStatus { get; set; } = FileState.Ok;
|
||||
public DateTime LastCheck { get; set; } = DateTime.Now.AddYears(-1);
|
||||
public byte[] FileContent { get; set; }
|
||||
|
||||
public ICollection<TagModel> Tags { get; set; }
|
||||
|
||||
[NotMapped]
|
||||
public string FileStringContent
|
||||
{
|
||||
get
|
||||
{
|
||||
return Encoding.UTF8.GetString(FileContent);
|
||||
}
|
||||
set
|
||||
{
|
||||
// serializzo a byte
|
||||
FileContent = Encoding.ASCII.GetBytes(value);
|
||||
}
|
||||
}
|
||||
|
||||
[ForeignKey("IdxMacchina")]
|
||||
public virtual MacchinaModel Macchina { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
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;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.FileData.DatabaseModels
|
||||
{
|
||||
[Table("Macchine")]
|
||||
public partial class MacchinaModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
[Key]
|
||||
public string IdxMacchina { get; set; } = "";
|
||||
public string RuleName { get; set; } = "";
|
||||
public string Nome { get; set; } = "";
|
||||
public string Descrizione { get; set; } = "";
|
||||
public string BasePath { get; set; } = "";
|
||||
public string ImgUrl { get; set; } = "";
|
||||
public string Note { get; set; } = "";
|
||||
public int ShowOrder { get; set; } = 999;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
namespace MP.FileData.DatabaseModels
|
||||
{
|
||||
[Table("Tags")]
|
||||
public partial class TagModel
|
||||
{
|
||||
|
||||
[Key]
|
||||
public string TagId { get; set; }
|
||||
|
||||
public ICollection<FileModel> Files { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.FileData
|
||||
{
|
||||
/// <summary>
|
||||
/// Stato File
|
||||
/// </summary>
|
||||
public enum FileState
|
||||
{
|
||||
ND = 0,
|
||||
Changed,
|
||||
Deleted,
|
||||
Ok
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.FileData
|
||||
{
|
||||
public class FileUtils
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei file data la directory da controllare
|
||||
/// </summary>
|
||||
/// <param name="path"></param>
|
||||
/// <param name="searchPattern"></param>
|
||||
/// <returns></returns>
|
||||
public static FileInfo[] GetFileList(string path, string searchPattern)
|
||||
{
|
||||
//string[] answ = Directory.GetFiles(path, searchPattern);
|
||||
DriveInfo di = new DriveInfo(path);
|
||||
DirectoryInfo dirInfo = di.RootDirectory;
|
||||
FileInfo[] answ = dirInfo.GetFiles("*.*");
|
||||
|
||||
return answ;
|
||||
}
|
||||
|
||||
public static async Task SaveToCsv<T>(List<T> reportData, string path)
|
||||
{
|
||||
var lines = new List<string>();
|
||||
IEnumerable<PropertyDescriptor> props = TypeDescriptor.GetProperties(typeof(T)).OfType<PropertyDescriptor>();
|
||||
var header = string.Join(";", props.ToList().Select(x => x.Name));
|
||||
lines.Add(header);
|
||||
var valueLines = reportData.Select(row => string.Join(";", header.Split(';').Select(a => row.GetType().GetProperty(a).GetValue(row, null))));
|
||||
lines.AddRange(valueLines);
|
||||
await Task.Run(() => File.WriteAllLines(path, lines.ToArray()));
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="5.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="5.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="5.0.9" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="5.0.9">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.1" />
|
||||
<PackageReference Include="NLog" Version="4.7.11" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Folder Include="Migrations\" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -0,0 +1,170 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MP.FileData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace MP.FileData.Migrations
|
||||
{
|
||||
[DbContext(typeof(MoonPro_ProgContext))]
|
||||
[Migration("20210913153816_InitDb")]
|
||||
partial class InitDb
|
||||
{
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.9")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("FileModelTagModel", b =>
|
||||
{
|
||||
b.Property<int>("FilesFileId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TagsTagId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("FilesFileId", "TagsTagId");
|
||||
|
||||
b.HasIndex("TagsTagId");
|
||||
|
||||
b.ToTable("FileModelTagModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.FileModel", b =>
|
||||
{
|
||||
b.Property<int>("FileId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("DiskStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte[]>("FileContent")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<string>("IdxMacchina")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTime>("LastCheck")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("LastMod")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("MD5")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MimeType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Rev")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("Size")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("FileId");
|
||||
|
||||
b.HasIndex("IdxMacchina", "Active", "DiskStatus");
|
||||
|
||||
b.ToTable("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.MacchinaModel", b =>
|
||||
{
|
||||
b.Property<string>("IdxMacchina")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("BasePath")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImgUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Nome")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RuleName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ShowOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("IdxMacchina");
|
||||
|
||||
b.ToTable("Macchine");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
IdxMacchina = "0",
|
||||
BasePath = "",
|
||||
Descrizione = "--- Tutte ---",
|
||||
ImgUrl = "",
|
||||
Nome = "--- Tutte ---",
|
||||
Note = "",
|
||||
RuleName = "0",
|
||||
ShowOrder = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.TagModel", b =>
|
||||
{
|
||||
b.Property<string>("TagId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("TagId");
|
||||
|
||||
b.ToTable("Tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FileModelTagModel", b =>
|
||||
{
|
||||
b.HasOne("MP.FileData.DatabaseModels.FileModel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("FilesFileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MP.FileData.DatabaseModels.TagModel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsTagId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.FileModel", b =>
|
||||
{
|
||||
b.HasOne("MP.FileData.DatabaseModels.MacchinaModel", "Macchina")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdxMacchina");
|
||||
|
||||
b.Navigation("Macchina");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,124 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
namespace MP.FileData.Migrations
|
||||
{
|
||||
public partial class InitDb : Migration
|
||||
{
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Macchine",
|
||||
columns: table => new
|
||||
{
|
||||
IdxMacchina = table.Column<string>(type: "nvarchar(450)", nullable: false),
|
||||
RuleName = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Nome = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Descrizione = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
BasePath = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ImgUrl = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Note = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
ShowOrder = table.Column<int>(type: "int", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Macchine", x => x.IdxMacchina);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Tags",
|
||||
columns: table => new
|
||||
{
|
||||
TagId = table.Column<string>(type: "nvarchar(450)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Tags", x => x.TagId);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Files",
|
||||
columns: table => new
|
||||
{
|
||||
FileId = table.Column<int>(type: "int", nullable: false)
|
||||
.Annotation("SqlServer:Identity", "1, 1"),
|
||||
Active = table.Column<bool>(type: "bit", nullable: false),
|
||||
IdxMacchina = table.Column<string>(type: "nvarchar(450)", nullable: true),
|
||||
Name = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
Rev = table.Column<int>(type: "int", nullable: false),
|
||||
LastMod = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
Size = table.Column<long>(type: "bigint", nullable: false),
|
||||
Path = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
MimeType = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
MD5 = table.Column<string>(type: "nvarchar(max)", nullable: true),
|
||||
DiskStatus = table.Column<int>(type: "int", nullable: false),
|
||||
LastCheck = table.Column<DateTime>(type: "datetime2", nullable: false),
|
||||
FileContent = table.Column<byte[]>(type: "varbinary(max)", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Files", x => x.FileId);
|
||||
table.ForeignKey(
|
||||
name: "FK_Files_Macchine_IdxMacchina",
|
||||
column: x => x.IdxMacchina,
|
||||
principalTable: "Macchine",
|
||||
principalColumn: "IdxMacchina",
|
||||
onDelete: ReferentialAction.Restrict);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "FileModelTagModel",
|
||||
columns: table => new
|
||||
{
|
||||
FilesFileId = table.Column<int>(type: "int", nullable: false),
|
||||
TagsTagId = table.Column<string>(type: "nvarchar(450)", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_FileModelTagModel", x => new { x.FilesFileId, x.TagsTagId });
|
||||
table.ForeignKey(
|
||||
name: "FK_FileModelTagModel_Files_FilesFileId",
|
||||
column: x => x.FilesFileId,
|
||||
principalTable: "Files",
|
||||
principalColumn: "FileId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_FileModelTagModel_Tags_TagsTagId",
|
||||
column: x => x.TagsTagId,
|
||||
principalTable: "Tags",
|
||||
principalColumn: "TagId",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.InsertData(
|
||||
table: "Macchine",
|
||||
columns: new[] { "IdxMacchina", "BasePath", "Descrizione", "ImgUrl", "Nome", "Note", "RuleName", "ShowOrder" },
|
||||
values: new object[] { "0", "", "--- Tutte ---", "", "--- Tutte ---", "", "0", 0 });
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_FileModelTagModel_TagsTagId",
|
||||
table: "FileModelTagModel",
|
||||
column: "TagsTagId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_Files_IdxMacchina_Active_DiskStatus",
|
||||
table: "Files",
|
||||
columns: new[] { "IdxMacchina", "Active", "DiskStatus" });
|
||||
}
|
||||
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "FileModelTagModel");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Files");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Tags");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Macchine");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,168 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using MP.FileData;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
|
||||
namespace MP.FileData.Migrations
|
||||
{
|
||||
[DbContext(typeof(MoonPro_ProgContext))]
|
||||
partial class MoonPro_ProgContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder
|
||||
.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS")
|
||||
.HasAnnotation("Relational:MaxIdentifierLength", 128)
|
||||
.HasAnnotation("ProductVersion", "5.0.9")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
modelBuilder.Entity("FileModelTagModel", b =>
|
||||
{
|
||||
b.Property<int>("FilesFileId")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<string>("TagsTagId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("FilesFileId", "TagsTagId");
|
||||
|
||||
b.HasIndex("TagsTagId");
|
||||
|
||||
b.ToTable("FileModelTagModel");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.FileModel", b =>
|
||||
{
|
||||
b.Property<int>("FileId")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("int")
|
||||
.HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn);
|
||||
|
||||
b.Property<bool>("Active")
|
||||
.HasColumnType("bit");
|
||||
|
||||
b.Property<int>("DiskStatus")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<byte[]>("FileContent")
|
||||
.HasColumnType("varbinary(max)");
|
||||
|
||||
b.Property<string>("IdxMacchina")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<DateTime>("LastCheck")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<DateTime>("LastMod")
|
||||
.HasColumnType("datetime2");
|
||||
|
||||
b.Property<string>("MD5")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("MimeType")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Name")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Path")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("Rev")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.Property<long>("Size")
|
||||
.HasColumnType("bigint");
|
||||
|
||||
b.HasKey("FileId");
|
||||
|
||||
b.HasIndex("IdxMacchina", "Active", "DiskStatus");
|
||||
|
||||
b.ToTable("Files");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.MacchinaModel", b =>
|
||||
{
|
||||
b.Property<string>("IdxMacchina")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.Property<string>("BasePath")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Descrizione")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("ImgUrl")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Nome")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("Note")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<string>("RuleName")
|
||||
.HasColumnType("nvarchar(max)");
|
||||
|
||||
b.Property<int>("ShowOrder")
|
||||
.HasColumnType("int");
|
||||
|
||||
b.HasKey("IdxMacchina");
|
||||
|
||||
b.ToTable("Macchine");
|
||||
|
||||
b.HasData(
|
||||
new
|
||||
{
|
||||
IdxMacchina = "0",
|
||||
BasePath = "",
|
||||
Descrizione = "--- Tutte ---",
|
||||
ImgUrl = "",
|
||||
Nome = "--- Tutte ---",
|
||||
Note = "",
|
||||
RuleName = "0",
|
||||
ShowOrder = 0
|
||||
});
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.TagModel", b =>
|
||||
{
|
||||
b.Property<string>("TagId")
|
||||
.HasColumnType("nvarchar(450)");
|
||||
|
||||
b.HasKey("TagId");
|
||||
|
||||
b.ToTable("Tags");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("FileModelTagModel", b =>
|
||||
{
|
||||
b.HasOne("MP.FileData.DatabaseModels.FileModel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("FilesFileId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("MP.FileData.DatabaseModels.TagModel", null)
|
||||
.WithMany()
|
||||
.HasForeignKey("TagsTagId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("MP.FileData.DatabaseModels.FileModel", b =>
|
||||
{
|
||||
b.HasOne("MP.FileData.DatabaseModels.MacchinaModel", "Macchina")
|
||||
.WithMany()
|
||||
.HasForeignKey("IdxMacchina");
|
||||
|
||||
b.Navigation("Macchina");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using MP.FileData.DatabaseModels;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.FileData
|
||||
{
|
||||
public static class ModelBuilderExtensions
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Estensione per seed iniziale dei dati nel DB
|
||||
/// </summary>
|
||||
/// <param name="modelBuilder"></param>
|
||||
public static void Seed(this ModelBuilder modelBuilder)
|
||||
{
|
||||
// inizializzazione dei valori di default x MACCHINA
|
||||
modelBuilder.Entity<MacchinaModel>().HasData(
|
||||
new MacchinaModel { IdxMacchina = "0", RuleName = "0", Descrizione = "--- Tutte ---", Nome = "--- Tutte ---", BasePath = "", ImgUrl = "", Note = "", ShowOrder = 0 }
|
||||
);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.EntityFrameworkCore.Metadata;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.FileData.DatabaseModels;
|
||||
using NLog;
|
||||
|
||||
namespace MP.FileData
|
||||
{
|
||||
public partial class MoonPro_ProgContext : DbContext
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.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 MoonPro_ProgContext()
|
||||
{
|
||||
}
|
||||
|
||||
public MoonPro_ProgContext(IConfiguration configuration)
|
||||
{
|
||||
_configuration = configuration;
|
||||
try
|
||||
{
|
||||
// se non ci fosse... crea o migra!
|
||||
Database.Migrate();
|
||||
}
|
||||
catch (Exception exc)
|
||||
{
|
||||
Log.Error(exc, "Exception during context initialization 01");
|
||||
}
|
||||
}
|
||||
|
||||
public MoonPro_ProgContext(DbContextOptions<MoonPro_ProgContext> 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<MacchinaModel> DbSetMacchine { get; set; }
|
||||
public virtual DbSet<FileModel> DbSetProgFile { get; set; }
|
||||
public virtual DbSet<TagModel> DbSetTags { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
partial void OnModelCreatingPartial(ModelBuilder modelBuilder);
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
|
||||
{
|
||||
if (!optionsBuilder.IsConfigured)
|
||||
{
|
||||
string connString = _configuration.GetConnectionString("MP.Prog");
|
||||
if (!string.IsNullOrEmpty(connString))
|
||||
{
|
||||
optionsBuilder.UseSqlServer(connString);
|
||||
}
|
||||
else
|
||||
{
|
||||
optionsBuilder.UseSqlServer("Server=SQL2016DEV;Database=MoonPro_PROG;Trusted_Connection=True;");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.HasAnnotation("Relational:Collation", "SQL_Latin1_General_CP1_CI_AS");
|
||||
|
||||
//
|
||||
modelBuilder.Seed();
|
||||
|
||||
OnModelCreatingPartial(modelBuilder);
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.FileData
|
||||
{
|
||||
public enum SearchMode
|
||||
{
|
||||
/// <summary>
|
||||
/// Ricerca occorrenze di una RegExp dentro il contenuto del file
|
||||
/// </summary>
|
||||
StringOnFile,
|
||||
|
||||
/// <summary>
|
||||
/// Cerca da path relativo + nome file
|
||||
/// </summary>
|
||||
PathAndName
|
||||
}
|
||||
|
||||
public class SearchRules
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Estensioni file esclusi
|
||||
/// </summary>
|
||||
public List<string> ExcludedFileExt { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Pattern esclusione Tags (stop-words)
|
||||
/// </summary>
|
||||
public List<string> ExcludedTags { get; set; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Pattern in formato RegExp
|
||||
/// </summary>
|
||||
public Dictionary<string, string> FileNameExtReplace { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Quantità massima di caratteri da analizzare, 0 = tutti
|
||||
/// </summary>
|
||||
public int MaxChar2Search { get; set; } = 100;
|
||||
|
||||
/// <summary>
|
||||
/// Modalità ricerca
|
||||
/// </summary>
|
||||
public SearchMode Mode { get; set; } = SearchMode.StringOnFile;
|
||||
|
||||
/// <summary>
|
||||
/// Nome della regola di ricerca
|
||||
/// </summary>
|
||||
public string Name { get; set; } = "ND";
|
||||
|
||||
/// <summary>
|
||||
/// Configurazione opzionale x rimozione filename da output finali
|
||||
/// </summary>
|
||||
public bool OutExcludeFileName { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Replace in uscita per "bonificare" il tag
|
||||
/// </summary>
|
||||
public Dictionary<string, string> OutReplace { get; set; } = new Dictionary<string, string>();
|
||||
|
||||
/// <summary>
|
||||
/// Pattern in formato RegExp
|
||||
/// </summary>
|
||||
public string RegExPattern { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Configurazione opzionale x sostituzione placeholder {{fileName}} in RegExp con il VERO nome file
|
||||
/// </summary>
|
||||
public bool RegExRepFileName { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Configurazione opzionale x sostituzione carriage return --> spazi
|
||||
/// </summary>
|
||||
public bool ReplaceCR { get; set; } = true;
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
using NLog;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.FileData
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper estrazione tag x programmi
|
||||
/// </summary>
|
||||
public class TagsUtils
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
protected static List<string> ExcludeTags = new List<string>();
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Cerca tag a aprtire da directory + nome file, ignorando delle stopword
|
||||
///
|
||||
/// es: ...\BUSSOLE.WPD\172L_EST8.MPF --> "BUSSOLE", "172L_EST8"
|
||||
/// </summary>
|
||||
/// <param name="filePath">Nome del file (path completo)</param>
|
||||
/// <param name="currRule">Parametri analisi</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> searchPathName(string filePath, string basePath, SearchRules currRule)
|
||||
{
|
||||
List<string> answ = new List<string>();
|
||||
string fileName = Path.GetFileName(filePath);
|
||||
#if false
|
||||
// dal nome se richeisto estraggo...
|
||||
if (!currRule.OutExcludeFileName)
|
||||
{
|
||||
// bonifico
|
||||
foreach (var item in currRule.OutReplace)
|
||||
{
|
||||
fileName = fileName.Replace(item.Key, item.Value);
|
||||
}
|
||||
// aggiungo fileName
|
||||
answ.Add(fileName);
|
||||
}
|
||||
#endif
|
||||
// ora da path... escludo base e file...
|
||||
string dirPath = filePath.Replace(basePath, "");
|
||||
// bonifico
|
||||
foreach (var item in currRule.OutReplace)
|
||||
{
|
||||
dirPath = dirPath.Replace(item.Key, item.Value);
|
||||
}
|
||||
// splitto per "/"
|
||||
var pathTags = dirPath.Split(@"\");
|
||||
foreach (var item in pathTags)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(item))
|
||||
{
|
||||
// fix replace filtro
|
||||
answ.Add(item);
|
||||
}
|
||||
}
|
||||
|
||||
// se nullo --> segnalo!
|
||||
if (answ.Count == 0)
|
||||
{
|
||||
Log.Warn($"searchPathName Attenzione Tag non trovati | {filePath} | basePath: {basePath}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cerca tag di commento inseriti nel formato
|
||||
/// NOME_PROG(commento)
|
||||
///
|
||||
/// es: O00123(172L D20.5) --> estrae 172L, D20.5
|
||||
/// </summary>
|
||||
/// <param name="fileName">Nome del file (da cercare per contenuto)</param>
|
||||
/// <param name="fileContent">Contenuto del file da analizzare</param>
|
||||
/// <param name="currRule">Parametri analisi</param>
|
||||
/// <returns></returns>
|
||||
public static List<string> searchProgComment(string fileName, string fileContent, SearchRules currRule)
|
||||
{
|
||||
// verifico se trimmare contenuto file
|
||||
if (fileContent.Length > currRule.MaxChar2Search && currRule.MaxChar2Search > 0)
|
||||
{
|
||||
fileContent = fileContent.Substring(0, currRule.MaxChar2Search);
|
||||
}
|
||||
// bonifico: a capo --> spazi
|
||||
fileContent = fileContent.Replace(Environment.NewLine, " ").ToUpper();
|
||||
//string pattern = $"\\b{fileName}" + @".{0,2}\([\w\d\s.]+\)";
|
||||
string pattern = currRule.RegExPattern;
|
||||
if (currRule.RegExRepFileName)
|
||||
{
|
||||
pattern = pattern.Replace("{{fileName}}", fileName);
|
||||
}
|
||||
List<string> answ = new List<string>();
|
||||
if (fileContent.Length > 0)
|
||||
{
|
||||
// uso regexp
|
||||
MatchCollection matchTags = Regex.Matches(fileContent, pattern);
|
||||
if (matchTags.Count > 0)
|
||||
{
|
||||
for (int count = 0; count < matchTags.Count; count++)
|
||||
{
|
||||
string currMatch = matchTags[count].Value;
|
||||
// bonifica preliminare (se richiesta)
|
||||
if (currRule.OutExcludeFileName)
|
||||
{
|
||||
currMatch = currMatch.Replace(fileName, "");
|
||||
}
|
||||
if (currRule.OutReplace.Count > 0)
|
||||
{
|
||||
foreach (var item in currRule.OutReplace)
|
||||
{
|
||||
currMatch = currMatch.Replace(item.Key, item.Value);
|
||||
}
|
||||
}
|
||||
// trim finale
|
||||
currMatch = currMatch.Trim();
|
||||
|
||||
// split con spazi
|
||||
var splitTags = currMatch.Split(" ");
|
||||
foreach (var item in splitTags)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(item))
|
||||
{
|
||||
if (!currRule.ExcludedTags.Contains(item) && item != fileName)
|
||||
{
|
||||
// esclusione valori ignorati
|
||||
answ.Add(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// se nullo --> segnalo!
|
||||
if (answ.Count == 0)
|
||||
{
|
||||
Log.Warn($"searchProgComment Attenzione Tag non trovati | {fileName} | pattern: {pattern}{Environment.NewLine}{fileContent}");
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"version": 1,
|
||||
"isRoot": true,
|
||||
"tools": {}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<Router AppAssembly="@typeof(Program).Assembly" PreferExactMatches="@true">
|
||||
<Found Context="routeData">
|
||||
<RouteView RouteData="@routeData" DefaultLayout="@typeof(MainLayout)" />
|
||||
</Found>
|
||||
<NotFound>
|
||||
<LayoutView Layout="@typeof(MainLayout)">
|
||||
<p>Sorry, there's nothing at this address.</p>
|
||||
</LayoutView>
|
||||
</NotFound>
|
||||
</Router>
|
||||
@@ -0,0 +1,16 @@
|
||||
<div class="form-row text-light">
|
||||
<div class="col-5 pr-0 text-left">
|
||||
MP.Land <span class="small">v.@version</span>
|
||||
</div>
|
||||
<div class="col-7 pl-0 text-right">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
protected DateTime adesso = DateTime.Now;
|
||||
|
||||
Version version = typeof(Program).Assembly.GetName().Version;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6">
|
||||
Gruppi
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<select @bind="@groupName" class="form-control form-control-sm">
|
||||
<option value="">--- Tutti ---</option>
|
||||
@if (ListGroups != null)
|
||||
{
|
||||
@foreach (var item in ListGroups)
|
||||
{
|
||||
<option value="@item.CodGruppo">@item.DescrGruppo</option>
|
||||
}
|
||||
}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Land;
|
||||
using MP.Land.Shared;
|
||||
using MP.AppAuth.Models;
|
||||
using MP.Land.Data;
|
||||
|
||||
namespace MP.Land.Components
|
||||
{
|
||||
public partial class CmpGroupFilt
|
||||
{
|
||||
|
||||
[Inject]
|
||||
protected MessageService AppMService { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService DataService { get; set; }
|
||||
|
||||
private List<AnagraficaGruppi> ListGroups;
|
||||
private string groupName
|
||||
{
|
||||
get
|
||||
{
|
||||
return AppMService.CodGruppo;
|
||||
}
|
||||
set
|
||||
{
|
||||
AppMService.CodGruppo = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
await ReloadData();
|
||||
}
|
||||
|
||||
private async Task ReloadData()
|
||||
{
|
||||
// carico i gruppi
|
||||
ListGroups = await DataService.AnagGruppiFilt("REPARTO");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
@using MP.Land.Components
|
||||
@using System.Security.Claims
|
||||
@*@using Microsoft.AspNetCore.Components.Authorization*@
|
||||
@using MP.Land.Data
|
||||
|
||||
@inject MessageService AppMessages
|
||||
@*@inject AuthenticationStateProvider AuthenticationStateProvider*@
|
||||
|
||||
<div class="form-row pt-3">
|
||||
<div class="col-7 col-md-6 col-lg-4 col-xl-3">
|
||||
@*<LoginDisplay></LoginDisplay>*@
|
||||
@*<i class="fas fa-user-alt"></i> <b>@userName</b>*@
|
||||
</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
|
||||
</div>
|
||||
<div class="col-5 col-md-6 col-lg-4 col-xl-3 text-right">
|
||||
@if (ShowSearch)
|
||||
{
|
||||
<SearchMod></SearchMod>
|
||||
}
|
||||
</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()
|
||||
{
|
||||
userName = "N.A.";
|
||||
await Task.Delay(1);
|
||||
#if false
|
||||
var authState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
|
||||
var user = authState.User;
|
||||
|
||||
if (user.Identity.IsAuthenticated)
|
||||
{
|
||||
userName = $"{user.Identity.Name}";
|
||||
}
|
||||
else
|
||||
{
|
||||
userName = "N.A.";
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@* // 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*@
|
||||
@@ -0,0 +1,54 @@
|
||||
<div class="row">
|
||||
<div class="col-12 col-lg-9 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-3">
|
||||
<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="3">3</option>
|
||||
<option value="6">6</option>
|
||||
<option value="9">9</option>
|
||||
</select>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,189 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Land.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; } = 6;
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,154 @@
|
||||
@using MP.Land.Data
|
||||
@using System.Text
|
||||
@using DiffMatchPatch
|
||||
|
||||
<div class="row">
|
||||
<div class="col-6 table-success">
|
||||
<div class="row">
|
||||
<div class="col-4 text-success">
|
||||
<h4>Archivio</h4>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
</div>
|
||||
<div class="col-4 text-right">
|
||||
<input @bind="@pHeight" class="text-right" width="20" inputmode="numeric" /> <i class="fas fa-arrows-alt-v"></i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@if (numChanges > 0)
|
||||
{
|
||||
<div class="col-6 table-danger">
|
||||
<div class="row">
|
||||
<div class="col-4 text-danger">
|
||||
<h4>Attuale</h4>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
</div>
|
||||
<div class="col-4 text-right p-2">
|
||||
<span class="border border-danger table-danger py-1 px-2"><b>@numChanges</b> modifiche</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
<div class="row" style="height: @(pHeight)em; overflow-y: scroll;">
|
||||
<div class="col-6 table-success">
|
||||
<div class="border border-success p-2 bg-light">
|
||||
<p>@((MarkupString)oldResult)</p>
|
||||
</div>
|
||||
</div>
|
||||
@if (numChanges > 0)
|
||||
{
|
||||
<div class="col-6 table-danger">
|
||||
<div class="border border-danger p-2 bg-light">
|
||||
<p>@((MarkupString)newResult)</p>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
string sepDest = "<br />";
|
||||
|
||||
protected int pHeight = 25;
|
||||
|
||||
protected string oldResult = "";
|
||||
protected string newResult = "";
|
||||
|
||||
protected string _oldText = "";
|
||||
protected string _newText = "";
|
||||
|
||||
[Parameter]
|
||||
public EventCallback<int> diffDone { get; set; }
|
||||
|
||||
protected int numChanges { get; set; } = 0;
|
||||
|
||||
[Parameter]
|
||||
public string oldText
|
||||
{
|
||||
get
|
||||
{
|
||||
return _oldText;
|
||||
}
|
||||
set
|
||||
{
|
||||
_oldText = value;
|
||||
}
|
||||
}
|
||||
|
||||
protected string oldTextFix
|
||||
{
|
||||
get
|
||||
{
|
||||
return _oldText.Replace(Environment.NewLine, sepDest).Replace("\n", sepDest).Replace("\r", sepDest);
|
||||
}
|
||||
}
|
||||
|
||||
protected string newTextFix
|
||||
{
|
||||
get
|
||||
{
|
||||
return _newText.Replace(Environment.NewLine, sepDest).Replace("\n", sepDest).Replace("\r", sepDest);
|
||||
}
|
||||
}
|
||||
[Parameter]
|
||||
public string newText
|
||||
{
|
||||
get
|
||||
{
|
||||
return _newText;
|
||||
}
|
||||
set
|
||||
{
|
||||
_newText = value;
|
||||
ReloadData();
|
||||
}
|
||||
}
|
||||
protected void ReloadData()
|
||||
{
|
||||
numChanges = 0;
|
||||
// calcolo diff
|
||||
diff_match_patch dmp = new diff_match_patch();
|
||||
List<Diff> diff = dmp.diff_main(oldTextFix, newTextFix);
|
||||
dmp.diff_cleanupSemantic(diff);
|
||||
|
||||
// predispongo la stringa secondo l'elenco dei diff....
|
||||
StringBuilder sbNew = new StringBuilder();
|
||||
StringBuilder sbOld = new StringBuilder();
|
||||
foreach (var item in diff)
|
||||
{
|
||||
switch (item.operation)
|
||||
{
|
||||
case Operation.DELETE:
|
||||
sbOld.Append($"<span class=\"border border-success table-success\">{item.text}</span>");
|
||||
break;
|
||||
case Operation.INSERT:
|
||||
sbNew.Append($"<span class=\"border border-danger table-danger\">{item.text}</span>");
|
||||
numChanges++;
|
||||
break;
|
||||
case Operation.EQUAL:
|
||||
sbNew.Append($"<span class=\"text-dark\">{item.text}</span>");
|
||||
sbOld.Append($"<span class=\"text-dark\">{item.text}</span>");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
newResult = sbNew.ToString().Trim();
|
||||
oldResult = sbOld.ToString().Trim();
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
await diffDone.InvokeAsync(numChanges);
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
|
||||
protected override Task OnInitializedAsync()
|
||||
{
|
||||
ReloadData();
|
||||
return base.OnInitializedAsync();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
@using MP.AppAuth.Models
|
||||
@using MP.Land.Data
|
||||
@using Microsoft.Extensions.Configuration
|
||||
|
||||
@inject IConfiguration Configuration
|
||||
@inject AppAuthService DataService
|
||||
@inject LicenseService LicServ
|
||||
|
||||
@if (authOk()) // disegno box cliccabile e programma attivato
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<a target="_blank" href="@(fullUrl(CurrItem.AppUrl))" class="btn btn-outline-info btn-block" title="Apri">
|
||||
<i class="@(traduci($"{CurrItem.AppName}-ICON"))"></i>
|
||||
<h3 class="mb-0">@CurrItem.AppName </h3>
|
||||
</a>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row text-dark">
|
||||
<div class="col-4 text-left">
|
||||
<b>@(traduci($"{CurrItem.AppName}-TITLE"))</b>
|
||||
<div class="border-bottom"></div>
|
||||
<div class="badge badge-success"> Licenza Attiva</div>
|
||||
</div>
|
||||
<div class="col-8 border-left text-left">
|
||||
@(traduci($"{CurrItem.AppName}-LIST"))
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
else // disegno box non cliccabile e licenza mancante
|
||||
{
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<button class="btn btn-outline-secondary btn-block" title="Manca Licenza" disabled>
|
||||
<i class="@(traduci($"{CurrItem.AppName}-ICON"))"></i>
|
||||
<h3 class="mb-0">@CurrItem.AppName</h3>
|
||||
</button>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row text-muted">
|
||||
<div class="col-4 text-left">
|
||||
<b>@(traduci($"{CurrItem.AppName}-TITLE"))</b>
|
||||
<div class="border-bottom"></div>
|
||||
<div class="badge badge-danger"> Licenza Mancante</div>
|
||||
</div>
|
||||
<div class="col-8 border-left text-left">
|
||||
@(traduci($"{CurrItem.AppName}-LIST"))
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public UpdMan CurrItem { get; set; }
|
||||
|
||||
protected List<AnagKeyValueModel> AKVList
|
||||
{
|
||||
get
|
||||
{
|
||||
return LicServ.AKVList;
|
||||
}
|
||||
set
|
||||
{
|
||||
LicServ.AKVList = value;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
// check init AKV
|
||||
if (AKVList == null || AKVList.Count == 0)
|
||||
{
|
||||
AKVList = await DataService.AnagKeyValList();
|
||||
LicServ.InitAkv();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected string getAKVString(string nomeVar)
|
||||
{
|
||||
string answ = "";
|
||||
if (AKVList != null)
|
||||
{
|
||||
var currRec = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar);
|
||||
if (currRec != null)
|
||||
{
|
||||
answ = currRec.ValString;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected AnagKeyValueModel getAKVRec(string nomeVar)
|
||||
{
|
||||
AnagKeyValueModel answ = new AnagKeyValueModel();
|
||||
if (AKVList != null)
|
||||
{
|
||||
answ = AKVList.FirstOrDefault(x => x.NomeVar == nomeVar);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
protected bool authOk()
|
||||
{
|
||||
bool allOk = !string.IsNullOrEmpty(CurrItem.LicenseKey);
|
||||
if (allOk)
|
||||
{
|
||||
allOk = LicServ.checkLicenseActive(CurrItem.LicenseKey);
|
||||
}
|
||||
return allOk;
|
||||
}
|
||||
|
||||
protected string fullUrl(string relUrl)
|
||||
{
|
||||
return $"{Configuration["BaseUrl"]}{relUrl}";
|
||||
}
|
||||
|
||||
protected MarkupString traduci(string lemma)
|
||||
{
|
||||
MarkupString answ;
|
||||
string rawHtml = DataService.Traduci(lemma, "IT");
|
||||
answ = new MarkupString(rawHtml);
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
@*<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>
|
||||
@@ -0,0 +1,61 @@
|
||||
@using Microsoft.AspNetCore.Components.Authorization
|
||||
|
||||
@inject AuthenticationStateProvider AuthenticationStateProvider
|
||||
|
||||
<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">
|
||||
<div class="d-none d-sm-block">
|
||||
<i class="fas fa-user-alt"></i> @StringLim(userName, 30)
|
||||
</div>
|
||||
<div class="d-block d-sm-none">
|
||||
<i class="fas fa-user-alt"></i> @StringLim(userName, 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>
|
||||
<div class="form-control form-control-sm">
|
||||
<i class="fas fa-user-alt"></i> @userName
|
||||
</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)}...";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
@using MP.Land.Components
|
||||
@using MP.Land.Data
|
||||
@using Majorsoft.Blazor.Components.Debounce
|
||||
|
||||
@inject MessageService MessageService
|
||||
|
||||
<div class="input-group input-group-sm">
|
||||
<DebounceInput id="sVal" class="form-control" placeholder="@("Ricerca libera")" autocomplete="off" @ref="debInput" @bind-Value="@_searchVal" @bind-Value:event="OnInput" DebounceTime="@_debMsec" MinLength="@_minChar" OnValueChanged="e => { searchVal = e; }" ForceNotifyByEnter="true" ForceNotifyOnBlur="true" />
|
||||
|
||||
<div class="input-group-append">
|
||||
<button @onclick="reset" class="btn btn-success input-group-text">reset</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
private string _searchVal = "";
|
||||
private int _debMsec = 300;
|
||||
private int _minChar = 0;
|
||||
private DebounceInput debInput;
|
||||
|
||||
[Parameter]
|
||||
public string searchVal
|
||||
{
|
||||
get
|
||||
{
|
||||
return MessageService.SearchVal;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!MessageService.SearchVal.Equals(value))
|
||||
{
|
||||
MessageService.SearchVal = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void reset()
|
||||
{
|
||||
_searchVal = "";
|
||||
searchVal = "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
@using MP.Land.Data
|
||||
@inject LicenseService LicServ
|
||||
|
||||
<div class="row text-center">
|
||||
@if (authOk())
|
||||
{
|
||||
<div class="col-12 mt-2">
|
||||
<h3 class="mb-0">@CurrItem.AppName <i class="fas fa-download"></i></h3>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
<button class="btn btn-block btn-outline-secondary" @onclick="() => DownloadPack()">@updArgs.CurrentVersion</button>
|
||||
</div>
|
||||
<div class="col-12">
|
||||
@outMessage
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
@@ -0,0 +1,115 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using MP.AppAuth;
|
||||
using MP.AppAuth.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using MP.Land.Data;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace MP.Land.Components
|
||||
{
|
||||
public partial class SingleDownload
|
||||
{
|
||||
#region Protected Fields
|
||||
|
||||
protected string outMessage = "";
|
||||
protected UpdateInfoEventArgs updArgs = new UpdateInfoEventArgs();
|
||||
protected UpdateMan updateManAuth = new UpdateMan("SWDownloader", "viaD@nte16");
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Protected Properties
|
||||
|
||||
[Inject]
|
||||
protected IConfiguration Configuration { get; set; }
|
||||
|
||||
[Inject]
|
||||
protected AppAuthService DataService { get; set; }
|
||||
|
||||
#endregion Protected Properties
|
||||
|
||||
#region Public Properties
|
||||
|
||||
[Parameter]
|
||||
public UpdMan CurrItem { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected bool authOk()
|
||||
{
|
||||
bool answ = !string.IsNullOrEmpty(CurrItem.LicenseKey);
|
||||
if (answ)
|
||||
{
|
||||
answ = LicServ.checkLicenseActive(CurrItem.LicenseKey);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effettua download del pacchetto indicato
|
||||
/// </summary>
|
||||
protected void DownloadPack()
|
||||
{
|
||||
long size = 0;
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
if (CurrItem.IsAuth)
|
||||
{
|
||||
size = updateManAuth.downloadLatest(CurrItem.ManifestUrl, localPath(CurrItem.LocalRepo), CurrItem.PackName);
|
||||
}
|
||||
else
|
||||
{
|
||||
size = UpdateMan.obj.downloadLatest(CurrItem.ManifestUrl, localPath(CurrItem.LocalRepo), CurrItem.PackName);
|
||||
}
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
|
||||
if (size > 0)
|
||||
{
|
||||
outMessage = $"Scaricati {(double)size / (1024 * 1024):N2} Mb in {ts.TotalSeconds:N2} s";
|
||||
}
|
||||
else
|
||||
{
|
||||
outMessage = $"Download non riuscito per {CurrItem.AppName}";
|
||||
}
|
||||
}
|
||||
|
||||
protected string fullUrl(string relUrl)
|
||||
{
|
||||
return $"{Configuration["BaseUrl"]}{relUrl}";
|
||||
}
|
||||
|
||||
protected string localPath(string localRepo)
|
||||
{
|
||||
return @$"{Configuration["downloadPath"]}\{localRepo}\{Configuration["appVers"]}"; ;
|
||||
}
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
// Recupero info ADM...
|
||||
if (CurrItem.IsAuth)
|
||||
{
|
||||
updArgs = updateManAuth.getUpdateInfo(CurrItem.ManifestUrl);
|
||||
}
|
||||
else
|
||||
{
|
||||
updArgs = UpdateMan.obj.getUpdateInfo(CurrItem.ManifestUrl);
|
||||
}
|
||||
}
|
||||
|
||||
protected MarkupString traduci(string lemma)
|
||||
{
|
||||
MarkupString answ;
|
||||
string rawHtml = DataService.Traduci(lemma, "IT");
|
||||
answ = new MarkupString(rawHtml);
|
||||
return answ;
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
@using MP.AppAuth.Models
|
||||
|
||||
@inject IJSRuntime JSRuntime
|
||||
|
||||
<div class="card text-center my-2">
|
||||
<div class="card-header list-group-item-info">
|
||||
<div class="row">
|
||||
<div class="col-6 text-left">
|
||||
<b>@Environment</b>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<b>Matr. @CurrItem.MatrOpr</b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body text-center">
|
||||
<div class="img-fluid" id="qrCodeImg_@(CurrItem.MatrOpr)"></div>
|
||||
</div>
|
||||
<div class="card-footer text-center">
|
||||
<b>@CurrItem.Cognome @CurrItem.Nome</b>
|
||||
</div>
|
||||
@*<div class="card-footer text-muted py-1">
|
||||
Card login MAPO-TAB
|
||||
</div>*@
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public AnagraficaOperatori CurrItem { get; set; }
|
||||
|
||||
protected override async Task OnAfterRenderAsync(bool firstRender)
|
||||
{
|
||||
if (firstRender)
|
||||
{
|
||||
await JSRuntime.InvokeVoidAsync("clearContent", $"qrCodeImg_{CurrItem.MatrOpr}");
|
||||
await JSRuntime.InvokeVoidAsync("displayQr", $"qrCodeImg_{CurrItem.MatrOpr}", rawCode);
|
||||
}
|
||||
}
|
||||
|
||||
[Parameter]
|
||||
public string BaseUrl { get; set; }
|
||||
|
||||
[Parameter]
|
||||
public string Environment { get; set; }
|
||||
|
||||
protected string rawCode
|
||||
{
|
||||
get
|
||||
{
|
||||
string answ = "";
|
||||
if (CurrItem != null)
|
||||
{
|
||||
answ = $"{BaseUrl}MatrOpr={CurrItem.MatrOpr}&UserAuthKey={CurrItem.AuthKey}";
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"ExcludedTags": [
|
||||
"M4",
|
||||
"M5",
|
||||
"M4+A",
|
||||
"M4+B",
|
||||
"M5+A",
|
||||
"M5+B"
|
||||
],
|
||||
"ExcludedFileExt": [
|
||||
".xls",
|
||||
".xls#",
|
||||
".xlsx"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
".P-2": ""
|
||||
},
|
||||
"MaxChar2Search": 100,
|
||||
"Mode": 0,
|
||||
"Name": "Tag da Commento Filename",
|
||||
"OutExcludeFileName": true,
|
||||
"OutReplace": {
|
||||
"(": " ",
|
||||
")": " "
|
||||
},
|
||||
"RegExPattern": "\\b{{fileName}}.{0,2}\\([\\w\\d\\s./\\-=]+\\)",
|
||||
"RegExRepFileName": true,
|
||||
"ReplaceCR": true
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
{
|
||||
"ExcludedTags": [],
|
||||
"ExcludedFileExt": [
|
||||
".xls",
|
||||
".xls#",
|
||||
".xlsx"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
".P-2": ""
|
||||
},
|
||||
"MaxChar2Search": 1,
|
||||
"Mode": 1,
|
||||
"Name": "Tag da Directory + Filename",
|
||||
"OutExcludeFileName": false,
|
||||
"OutReplace": {
|
||||
".WPD": "",
|
||||
".MPF": "",
|
||||
".SPF": ""
|
||||
},
|
||||
"RegExPattern": "",
|
||||
"RegExRepFileName": true,
|
||||
"ReplaceCR": false
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
{
|
||||
"ExcludedTags": [
|
||||
"M4",
|
||||
"M5",
|
||||
"M4+A",
|
||||
"M4+B",
|
||||
"M5+A",
|
||||
"M5+B",
|
||||
"M6+A",
|
||||
"M6+B",
|
||||
"+A"
|
||||
],
|
||||
"ExcludedFileExt": [
|
||||
".xls",
|
||||
".xls#",
|
||||
".xlsx"
|
||||
],
|
||||
"FileNameExtReplace": {
|
||||
".P-2": "",
|
||||
".tim": ""
|
||||
},
|
||||
"MaxChar2Search": 100,
|
||||
"Mode": 0,
|
||||
"Name": "Tag da Commento Filename Tornoss TISIS",
|
||||
"OutExcludeFileName": true,
|
||||
"OutReplace": {
|
||||
"(": " ",
|
||||
")": " ",
|
||||
"<": " ",
|
||||
">": " "
|
||||
},
|
||||
"RegExPattern": "\\b{{fileName}}.{0,2}\\([\\<\\w\\d\\s./\\-=\\+\\>]+\\)",
|
||||
"RegExRepFileName": true,
|
||||
"ReplaceCR": true
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using System;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using NLog;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Caching.Memory;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace MP.Land.Data
|
||||
{
|
||||
public class AppAuthService : IDisposable
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration _configuration;
|
||||
|
||||
private static ILogger<AppAuthService> _logger;
|
||||
|
||||
private static List<MP.AppAuth.Models.Macchine> ElencoMacchine = new List<MP.AppAuth.Models.Macchine>();
|
||||
|
||||
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
|
||||
|
||||
private readonly IDistributedCache distributedCache;
|
||||
|
||||
private readonly IMemoryCache memoryCache;
|
||||
|
||||
/// <summary>
|
||||
/// Durata assoluta massima della cache
|
||||
/// </summary>
|
||||
private int chAbsExp = 15;
|
||||
|
||||
/// <summary>
|
||||
/// Durata della cache in modalità inattiva (non acceduta) prima di venire rimossa
|
||||
/// NON estende oltre il tempo massimo di validità della cache (chAbsExp)
|
||||
/// </summary>
|
||||
private int chSliExp = 5;
|
||||
|
||||
private Dictionary<string, string> Vocabolario = new Dictionary<string, string>();
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Fields
|
||||
|
||||
public static AppAuth.Controllers.AppAuthController dbController;
|
||||
public static AppAuth.Controllers.MPController MpDbController;
|
||||
|
||||
#endregion Public Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
public AppAuthService(IConfiguration configuration, ILogger<AppAuthService> logger, IMemoryCache memoryCache, IDistributedCache distributedCache)
|
||||
{
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
// conf cache
|
||||
this.memoryCache = memoryCache;
|
||||
this.distributedCache = distributedCache;
|
||||
// conf DB
|
||||
string connStr = _configuration.GetConnectionString("MP.Land");
|
||||
if (string.IsNullOrEmpty(connStr))
|
||||
{
|
||||
_logger.LogError("ConnString empty!");
|
||||
}
|
||||
else
|
||||
{
|
||||
dbController = new AppAuth.Controllers.AppAuthController(configuration);
|
||||
MpDbController = new AppAuth.Controllers.MPController(configuration);
|
||||
_logger.LogInformation("DbController OK");
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Private Properties
|
||||
|
||||
private DistributedCacheEntryOptions cacheOpt
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
}
|
||||
}
|
||||
|
||||
private DistributedCacheEntryOptions cacheOptLong
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddMinutes(chAbsExp * 10)).SetSlidingExpiration(TimeSpan.FromMinutes(chSliExp));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
protected void CheckVoc()
|
||||
{
|
||||
string cacheKey = ":MP:VOCAB";
|
||||
string rawData;
|
||||
if (Vocabolario.Count == 0)
|
||||
{
|
||||
var redisDataList = distributedCache.Get(cacheKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
rawData = Encoding.UTF8.GetString(redisDataList);
|
||||
Vocabolario = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
|
||||
}
|
||||
else
|
||||
{
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
Vocabolario = dbController.VocabolarioGetAll().ToDictionary(x => $"{x.Lingua}#{x.Lemma}", x => x.Traduzione);
|
||||
rawData = JsonConvert.SerializeObject(Vocabolario);
|
||||
redisDataList = Encoding.UTF8.GetBytes(rawData);
|
||||
distributedCache.Set(cacheKey, redisDataList, cacheOptLong);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuato rilettura da DB + caching per Vocabolario: {ts.TotalMilliseconds} ms");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public async Task<List<AppAuth.Models.AnagraficaGruppi>> AnagGruppiAll()
|
||||
{
|
||||
List<AppAuth.Models.AnagraficaGruppi> dbResult = new List<AppAuth.Models.AnagraficaGruppi>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
dbResult = dbController.AnagGruppiGetAll();
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata lettura da DB per AnagGruppiAll: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<List<AppAuth.Models.AnagraficaGruppi>> AnagGruppiFilt(string codTipo)
|
||||
{
|
||||
List<AppAuth.Models.AnagraficaGruppi> dbResult = new List<AppAuth.Models.AnagraficaGruppi>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
dbResult = dbController.AnagGruppiFilt(codTipo);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata lettura da DB per AnagGruppiFilt: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
public async Task<List<AppAuth.Models.AnagraficaOperatori>> AnagOperByGroupList(string codGruppo, string searchVal)
|
||||
{
|
||||
List<AppAuth.Models.AnagraficaOperatori> dbResult = new List<AppAuth.Models.AnagraficaOperatori>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
var rawData = dbController
|
||||
.AnagOpByGruppoGetFilt(codGruppo, searchVal);
|
||||
dbResult = rawData
|
||||
.GroupBy(user => user.MatrOpr)
|
||||
.Select(grp => grp.First())
|
||||
.ToList();
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata lettura da DB per AnagOperByGroupList: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<List<AppAuth.Models.AnagraficaOperatori>> AnagOperList(string searchVal)
|
||||
{
|
||||
List<AppAuth.Models.AnagraficaOperatori> dbResult = new List<AppAuth.Models.AnagraficaOperatori>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
dbResult = dbController.AnagOpGetAll(searchVal);
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata lettura da DB per AnagOperList: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
// Clear database controller
|
||||
dbController.Dispose();
|
||||
MpDbController.Dispose();
|
||||
}
|
||||
|
||||
public string Traduci(string lemma, string lingua = "IT")
|
||||
{
|
||||
string answ = $"__{lemma}__";
|
||||
string keyReq = $"{lingua}#{lemma}";
|
||||
CheckVoc();
|
||||
// cerco in vocabolario...
|
||||
if (Vocabolario.ContainsKey(keyReq))
|
||||
{
|
||||
answ = Vocabolario[keyReq];
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
public async Task<List<AppAuth.Models.UpdMan>> UpdManList()
|
||||
{
|
||||
List<AppAuth.Models.UpdMan> dbResult = new List<AppAuth.Models.UpdMan>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
dbResult = dbController.UpdManGetAll();
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata lettura da DB per UpdManList: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task<List<AppAuth.Models.AnagKeyValueModel>> AnagKeyValList()
|
||||
{
|
||||
List<AppAuth.Models.AnagKeyValueModel> dbResult = new List<AppAuth.Models.AnagKeyValueModel>();
|
||||
Stopwatch stopWatch = new Stopwatch();
|
||||
stopWatch.Start();
|
||||
dbResult = MpDbController.AnagKeyValuesGetAll();
|
||||
stopWatch.Stop();
|
||||
TimeSpan ts = stopWatch.Elapsed;
|
||||
Log.Trace($"Effettuata lettura da DB per AnagKeyValList: {ts.TotalMilliseconds} ms");
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
public async Task ResetCache()
|
||||
{
|
||||
string cacheKey = ":MP:VOCAB";
|
||||
await distributedCache.RemoveAsync(cacheKey);
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Land.Data
|
||||
{
|
||||
public class AutocompleteModel
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public string LabelField { get; set; }
|
||||
public string ValueField { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,498 @@
|
||||
using Egw.Core;
|
||||
using Microsoft.Extensions.Caching.Distributed;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MP.AppAuth.Models;
|
||||
using Newtonsoft.Json;
|
||||
using RestSharp;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Web;
|
||||
|
||||
namespace MP.Land.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Servizi e dati condivisi a livello applicazione
|
||||
/// </summary>
|
||||
public class LicenseService
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private static IConfiguration? _configuration;
|
||||
private static ILogger<LicenseService>? _logger;
|
||||
|
||||
/// <summary>
|
||||
/// URL dell'API x chiamate gestione licenze
|
||||
/// </summary>
|
||||
private static string apiUrl = "https://liman.egalware.com/ELM.API/";
|
||||
//private static string apiUrl = "https://localhost:44351/";
|
||||
|
||||
/// <summary>
|
||||
/// Chiave redis x info della licenza
|
||||
/// </summary>
|
||||
private static string rkeyAppInfo = "LongCache:AppInfo";
|
||||
|
||||
private readonly IDistributedCache distributedCache;
|
||||
|
||||
/// <summary>
|
||||
/// Elenco obj in cache
|
||||
/// </summary>
|
||||
private List<string> cachedDataList = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Fattorte conversione cache sliding --> 1 h
|
||||
/// </summary>
|
||||
private int cacheFact = 12;
|
||||
|
||||
/// <summary>
|
||||
/// Durata assoluta massima della cache IN SECONDI
|
||||
/// </summary>
|
||||
private int chAbsExp = 60 * 5;
|
||||
|
||||
/// <summary>
|
||||
/// Durata della cache IN SECONDI in modalità inattiva (non acceduta) prima di venire rimossa
|
||||
/// NON estende oltre il tempo massimo di validità della cache (chAbsExp)
|
||||
/// </summary>
|
||||
private int chSliExp = 60 * 1;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Protected Fields
|
||||
|
||||
/// <summary>
|
||||
/// Chiave redis x attivazioni della licenza
|
||||
/// </summary>
|
||||
protected const string rKeyAttByLic = "LongCache:AttByLic";
|
||||
|
||||
#endregion Protected Fields
|
||||
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Init classe
|
||||
/// </summary>
|
||||
/// <param name="configuration"></param>
|
||||
/// <param name="logger"></param>
|
||||
/// <param name="distributedCache"></param>
|
||||
public LicenseService(IConfiguration configuration, ILogger<LicenseService> logger, IDistributedCache distributedCache)
|
||||
{
|
||||
_logger = logger;
|
||||
_configuration = configuration;
|
||||
this.distributedCache = distributedCache;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_InfoUpdated = null!;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public List<LiManObj.AttivazioneDTO> ActivList { get; set; } = new List<LiManObj.AttivazioneDTO>();
|
||||
|
||||
public List<AnagKeyValueModel> AKVList { get; set; } = new List<AnagKeyValueModel>();
|
||||
|
||||
public string Applicazione { get; set; } = "";
|
||||
|
||||
public bool HasActivData
|
||||
{
|
||||
get
|
||||
{
|
||||
bool answ = ValidData;
|
||||
// se ok controllo che ci siano attivazioni
|
||||
if (answ)
|
||||
{
|
||||
// provo classe locale...
|
||||
answ = ActivList != null && ActivList.Count > 0;
|
||||
// se non le avessi carico!
|
||||
if (!answ)
|
||||
{
|
||||
var pUpd = Task.Run(async () =>
|
||||
{
|
||||
ActivList = await ActivListCache();
|
||||
});
|
||||
pUpd.Wait();
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
}
|
||||
|
||||
public DateTime infoExpiry { get; set; } = DateTime.Today.AddDays(1);
|
||||
|
||||
/// <summary>
|
||||
/// Codice cliente/installazione
|
||||
/// </summary>
|
||||
public string Installazione { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Master key licenza principale
|
||||
/// </summary>
|
||||
public string MasterKey { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Numero licenze da DB
|
||||
/// </summary>
|
||||
public int NumLicDb { get; set; } = -1;
|
||||
|
||||
/// <summary>
|
||||
/// Numero licenze da auth remota
|
||||
/// </summary>
|
||||
public int NumLicRemote { get; set; } = -1;
|
||||
|
||||
public bool ValidData
|
||||
{
|
||||
get
|
||||
{
|
||||
// controllo valori string base
|
||||
bool checkData = !string.IsNullOrEmpty(Installazione) && !string.IsNullOrEmpty(Applicazione) && !string.IsNullOrEmpty(MasterKey) && ActivList != null && ActivList.Count > 0;
|
||||
return checkData;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Opzioni cache con moltiplicatore durata risp durata base (1/5 minuti)
|
||||
/// </summary>
|
||||
/// <param name="multFact"></param>
|
||||
/// <returns></returns>
|
||||
private DistributedCacheEntryOptions cacheOpt(int multFact)
|
||||
{
|
||||
var numSecAbsExp = chAbsExp * multFact;
|
||||
var numSecSliExp = chSliExp * multFact;
|
||||
return new DistributedCacheEntryOptions().SetAbsoluteExpiration(DateTime.Now.AddSeconds(numSecAbsExp)).SetSlidingExpiration(TimeSpan.FromSeconds(numSecSliExp));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco attivazioni attuali
|
||||
/// </summary>
|
||||
private async Task<List<LiManObj.AttivazioneDTO>?> OnlineActivationList()
|
||||
{
|
||||
List<LiManObj.AttivazioneDTO>? answ = new List<LiManObj.AttivazioneDTO>();
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
//client.Authenticator = new HttpBasicAuthenticator("username", "password");
|
||||
string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
|
||||
var request = new RestRequest($"api/attivazioni/?chiave={MKeyEnc}", Method.Get);
|
||||
var response = await client.GetAsync(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
// salvo in redis contenuto serializzato
|
||||
string rawData = $"{response.Content}";
|
||||
answ = JsonConvert.DeserializeObject<List<LiManObj.AttivazioneDTO>?>(rawData);
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera info licenza da remoto
|
||||
/// </summary>
|
||||
private async Task<List<LiManObj.ApplicativoDTO>> OnlineAppInfo()
|
||||
{
|
||||
List<LiManObj.ApplicativoDTO> answ = new List<LiManObj.ApplicativoDTO>();
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
string MKeyEnc = HttpUtility.UrlEncode(MasterKey);
|
||||
//string mKey = System.Net.WebUtility.UrlEncode(MasterKey);
|
||||
string reqUrl = $"api/licenza/{Installazione}?CodApp={Applicazione}&Chiave={MKeyEnc}";
|
||||
var request = new RestRequest(reqUrl, Method.Get);
|
||||
var response = await client.GetAsync(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
// verifico risposta
|
||||
string rawData = $"{response.Content}";
|
||||
answ = JsonConvert.DeserializeObject<List<LiManObj.ApplicativoDTO>?>(rawData);
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
private void ReportUpdated()
|
||||
{
|
||||
if (EA_InfoUpdated != null)
|
||||
{
|
||||
EA_InfoUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
/// <summary>
|
||||
/// Cerca di recuperare valore INT da elenco AKV
|
||||
/// </summary>
|
||||
/// <param name="varReq">Chiave AKV richiesta</param>
|
||||
/// <returns></returns>
|
||||
protected int getAVKInt(string varReq)
|
||||
{
|
||||
int answ = -9999;
|
||||
if (AKVList != null && AKVList.Count > 0)
|
||||
{
|
||||
var currRec = AKVList.Where(x => x.NomeVar == varReq).FirstOrDefault();
|
||||
if (currRec != null)
|
||||
{
|
||||
answ = currRec.ValInt ?? 0;
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Cerca di recuperare valore string da elenco AKV
|
||||
/// </summary>
|
||||
/// <param name="varReq">Chiave AKV richiesta</param>
|
||||
/// <returns></returns>
|
||||
protected string getAVKStr(string varReq)
|
||||
{
|
||||
string answ = "";
|
||||
if (AKVList != null && AKVList.Count > 0)
|
||||
{
|
||||
var currRec = AKVList.Where(x => x.NomeVar == varReq).FirstOrDefault();
|
||||
if (currRec != null)
|
||||
{
|
||||
answ = $"{currRec.ValString}";
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupero chiave da redis
|
||||
/// </summary>
|
||||
/// <param name="rKey"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task<string> getRSV(string rKey)
|
||||
{
|
||||
string answ = "";
|
||||
var redisDataList = await distributedCache.GetAsync(rKey);
|
||||
if (redisDataList != null)
|
||||
{
|
||||
answ = Encoding.UTF8.GetString(redisDataList);
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio chiave in redis
|
||||
/// </summary>
|
||||
/// <param name="rKey"></param>
|
||||
/// <param name="rVal"></param>
|
||||
/// <param name="cacheMult"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> setRSV(string rKey, string rVal, int cacheMult)
|
||||
{
|
||||
bool fatto = false;
|
||||
var redisDataList = Encoding.UTF8.GetBytes(rVal);
|
||||
await distributedCache.SetAsync(rKey, redisDataList, cacheOpt(cacheMult));
|
||||
fatto = true;
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Salvataggio chiave in redis
|
||||
/// </summary>
|
||||
/// <param name="rKey"></param>
|
||||
/// <param name="rValInt"></param>
|
||||
/// <param name="cacheMult"></param>
|
||||
/// <returns></returns>
|
||||
protected async Task<bool> setRSV(string rKey, int rValInt, int cacheMult)
|
||||
{
|
||||
bool fatto = false;
|
||||
var redisDataList = Encoding.UTF8.GetBytes($"{rValInt}");
|
||||
await distributedCache.SetAsync(rKey, redisDataList, cacheOpt(cacheMult));
|
||||
fatto = true;
|
||||
return fatto;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Registra in cache chiave se non fosse già in elenco
|
||||
/// </summary>
|
||||
/// <param name="newKey"></param>
|
||||
protected void trackCache(string newKey)
|
||||
{
|
||||
if (!cachedDataList.Contains(newKey))
|
||||
{
|
||||
cachedDataList.Add(newKey);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Protected Methods
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public async Task<List<LiManObj.AttivazioneDTO>> ActivListCache()
|
||||
{
|
||||
List<LiManObj.AttivazioneDTO> dbResult = new List<LiManObj.AttivazioneDTO>();
|
||||
string cacheKey = $"{rKeyAttByLic}:{MasterKey}";
|
||||
trackCache(cacheKey);
|
||||
string rawData = await getRSV(cacheKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
var cacheRes = JsonConvert.DeserializeObject<List<LiManObj.AttivazioneDTO>?>(rawData);
|
||||
if (cacheRes != null)
|
||||
{
|
||||
dbResult = cacheRes;
|
||||
}
|
||||
}
|
||||
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica attivazione licenza
|
||||
/// </summary>
|
||||
/// <param name="authKey"></param>
|
||||
/// <returns></returns>
|
||||
public bool checkLicenseActive(string authKey)
|
||||
{
|
||||
bool answ = false;
|
||||
//cerco anche nelle info AKV
|
||||
if (AKVList != null)
|
||||
{
|
||||
var recLic = AKVList.Where(x => x.ValString == authKey).FirstOrDefault();
|
||||
int numLic = 0;
|
||||
//cerco in record
|
||||
if (recLic != null)
|
||||
{
|
||||
numLic = (int)recLic.ValInt;
|
||||
// verifico scadenza licenza!
|
||||
DateTime scadenza = licenseManGLS.expiryDateByAuthKey(Installazione, recLic.NomeVar, numLic, authKey);
|
||||
answ = scadenza > DateTime.Today;
|
||||
}
|
||||
else
|
||||
{
|
||||
_logger.LogInformation($"Record non trovato per {authKey}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Stato server gestione licenze
|
||||
/// </summary>
|
||||
public async Task<string> checkLimanServer()
|
||||
{
|
||||
string answ = "ND";
|
||||
// cerco online
|
||||
RestClient client = new RestClient(apiUrl);
|
||||
var request = new RestRequest($"api/health", Method.Get);
|
||||
var response = await client.GetAsync(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == System.Net.HttpStatusCode.OK)
|
||||
{
|
||||
// verifico risposta
|
||||
answ = response.Content.Replace("\"", "");
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init della classe con variabili di base da Redis/DB
|
||||
/// </summary>
|
||||
public bool InitAkv()
|
||||
{
|
||||
bool fatto = false;
|
||||
Applicazione = "MAPO";
|
||||
Installazione = getAVKStr("Installazione");
|
||||
MasterKey = getAVKStr(Applicazione);
|
||||
NumLicDb = getAVKInt(Applicazione);
|
||||
fatto = !string.IsNullOrEmpty($"{Installazione}{MasterKey}");
|
||||
return fatto;
|
||||
}
|
||||
|
||||
public async Task<List<LiManObj.ApplicativoDTO>> LicAppCache()
|
||||
{
|
||||
List<LiManObj.ApplicativoDTO> dbResult = new List<LiManObj.ApplicativoDTO>();
|
||||
string cacheKey = $"{rkeyAppInfo}:{MasterKey}";
|
||||
trackCache(cacheKey);
|
||||
string rawData = await getRSV(cacheKey);
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
var cacheRes = JsonConvert.DeserializeObject<List<LiManObj.ApplicativoDTO>?>(rawData);
|
||||
if (cacheRes != null)
|
||||
{
|
||||
dbResult = cacheRes;
|
||||
}
|
||||
}
|
||||
|
||||
return await Task.FromResult(dbResult);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Init della classe con variabili di base da Redis/DB
|
||||
/// </summary>
|
||||
public async Task<bool> RefreshLicense()
|
||||
{
|
||||
bool fatto = false;
|
||||
// scadenza info a 15 gg...
|
||||
int numDays = 15;
|
||||
|
||||
// dati applicativo
|
||||
var appData = await OnlineAppInfo();
|
||||
if (appData != null)
|
||||
{
|
||||
if (appData.Count > 0)
|
||||
{
|
||||
fatto = await setAppInfo(appData, numDays);
|
||||
// salvo info licenza...
|
||||
NumLicRemote = appData[0].NumLicenze;
|
||||
}
|
||||
}
|
||||
|
||||
// dati attivazioni
|
||||
var onlineAct = await OnlineActivationList();
|
||||
if (onlineAct != null)
|
||||
{
|
||||
if (onlineAct.Count > 0)
|
||||
{
|
||||
infoExpiry = DateTime.Now.AddDays(numDays);
|
||||
ActivList = onlineAct;
|
||||
fatto = await setActivList(onlineAct, numDays);
|
||||
}
|
||||
}
|
||||
await Task.Delay(1);
|
||||
return fatto;
|
||||
}
|
||||
|
||||
public async Task<bool> setActivList(List<LiManObj.AttivazioneDTO> newActList, int numDays)
|
||||
{
|
||||
bool fatto = false;
|
||||
string cacheKey = $"{rKeyAttByLic}:{MasterKey}";
|
||||
var rawData = JsonConvert.SerializeObject(newActList);
|
||||
await setRSV(cacheKey, rawData, numDays * cacheFact * 24);
|
||||
fatto = true;
|
||||
if (EA_InfoUpdated != null)
|
||||
{
|
||||
EA_InfoUpdated?.Invoke();
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
public async Task<bool> setAppInfo(List<LiManObj.ApplicativoDTO> newAppInfo, int numDays)
|
||||
{
|
||||
bool fatto = false;
|
||||
string cacheKey = $"{rkeyAppInfo}:{MasterKey}";
|
||||
var rawData = JsonConvert.SerializeObject(newAppInfo);
|
||||
await setRSV(cacheKey, rawData, numDays * cacheFact * 24);
|
||||
fatto = true;
|
||||
if (EA_InfoUpdated != null)
|
||||
{
|
||||
EA_InfoUpdated?.Invoke();
|
||||
}
|
||||
return fatto;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,170 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Timers;
|
||||
|
||||
namespace MP.Land.Data
|
||||
{
|
||||
public class MessageService
|
||||
{
|
||||
#region Private Fields
|
||||
|
||||
private string _pageIcon;
|
||||
private string _pageName;
|
||||
private string _searchVal = "";
|
||||
private SelectData _selFilter = SelectData.Init(4, 15);
|
||||
private bool showSearch;
|
||||
|
||||
#endregion Private Fields
|
||||
|
||||
#region Public Events
|
||||
|
||||
public event Action EA_FilterUpdated;
|
||||
|
||||
public event Action EA_HideSearch;
|
||||
|
||||
public event Action EA_PageUpdated;
|
||||
|
||||
public event Action EA_SearchUpdated;
|
||||
|
||||
public event Action EA_ShowSearch;
|
||||
|
||||
#endregion Public Events
|
||||
|
||||
#region Public Properties
|
||||
|
||||
public string PageIcon
|
||||
{
|
||||
get => _pageIcon;
|
||||
set
|
||||
{
|
||||
if (_pageIcon != value)
|
||||
{
|
||||
_pageIcon = value;
|
||||
ReportPageUpd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string PageName
|
||||
{
|
||||
get => _pageName;
|
||||
set
|
||||
{
|
||||
if (_pageName != value)
|
||||
{
|
||||
_pageName = value;
|
||||
ReportPageUpd();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string SearchVal
|
||||
{
|
||||
get => _searchVal;
|
||||
set
|
||||
{
|
||||
if (_searchVal != value)
|
||||
{
|
||||
_searchVal = value;
|
||||
ReportSearch();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public SelectData SelFilter
|
||||
{
|
||||
get => _selFilter;
|
||||
set
|
||||
{
|
||||
if (_selFilter != value)
|
||||
{
|
||||
_selFilter = value;
|
||||
ReportFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShowSearch
|
||||
{
|
||||
get => showSearch;
|
||||
set
|
||||
{
|
||||
if (showSearch != value)
|
||||
{
|
||||
showSearch = value;
|
||||
if (showSearch)
|
||||
{
|
||||
ReportShowSearch();
|
||||
}
|
||||
else
|
||||
{
|
||||
ReportHideSearch();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected string _groupName { get; set; } = "";
|
||||
public string CodGruppo
|
||||
{
|
||||
get => _groupName;
|
||||
set
|
||||
{
|
||||
if (_groupName != value)
|
||||
{
|
||||
_groupName = value;
|
||||
ReportFilter();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private void ReportFilter()
|
||||
{
|
||||
if (EA_FilterUpdated != null)
|
||||
{
|
||||
EA_FilterUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportHideSearch()
|
||||
{
|
||||
if (EA_HideSearch != null)
|
||||
{
|
||||
EA_HideSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportPageUpd()
|
||||
{
|
||||
if (EA_PageUpdated != null)
|
||||
{
|
||||
EA_PageUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportSearch()
|
||||
{
|
||||
if (EA_SearchUpdated != null)
|
||||
{
|
||||
EA_SearchUpdated?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
private void ReportShowSearch()
|
||||
{
|
||||
if (EA_ShowSearch != null)
|
||||
{
|
||||
EA_ShowSearch?.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MP.Land.Data
|
||||
{
|
||||
public class SelectData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public DateTime DateEnd { get; set; } = DateTime.Now.AddMinutes(1);
|
||||
public DateTime DateStart { get; set; } = DateTime.Now.AddDays(-7);
|
||||
|
||||
public string FileName { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Primo record x selezione paginata, tipicamente primo della "decina" della pagina corrente
|
||||
/// </summary>
|
||||
public int FirstRecord
|
||||
{
|
||||
get
|
||||
{
|
||||
int primaPag = PageNum % 10;
|
||||
int decina = PageNum - primaPag;
|
||||
return PageSize * decina + 1;
|
||||
}
|
||||
}
|
||||
|
||||
public string IdxMacchina { get; set; } = "";
|
||||
|
||||
/// <summary>
|
||||
/// Recorda da saltare x arrivare alla pagina corrente
|
||||
/// </summary>
|
||||
public int NumSkip
|
||||
{
|
||||
get
|
||||
{
|
||||
return PageSize * (PageNum - 1);
|
||||
}
|
||||
}
|
||||
|
||||
public bool OnlyActive { get; set; } = true;
|
||||
public bool OnlyMod { get; set; } = false;
|
||||
public bool OnlyNoTag { get; set; } = false;
|
||||
public int PageNum { get; set; } = 1;
|
||||
public int PageSize { get; set; } = 6;
|
||||
public string SearchVal { get; set; } = "";
|
||||
public string Tag { get; set; } = "";
|
||||
|
||||
#endregion Public Properties
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Inizializzazione con periodo e arrotondamento
|
||||
/// </summary>
|
||||
/// <param name="minRound"></param>
|
||||
/// <param name="numDayPrev"></param>
|
||||
/// <returns></returns>
|
||||
public static SelectData Init(int minRound, int numDayPrev)
|
||||
{
|
||||
TimeSpan DayElapsed = DateTime.Now.Subtract(DateTime.Today);
|
||||
int minDay = (int)((DayElapsed.TotalMinutes / minRound) + 1) * minRound;
|
||||
DateTime endRounded = DateTime.Today.AddMinutes(minDay);
|
||||
SelectData answ = new SelectData()
|
||||
{
|
||||
DateEnd = endRounded,
|
||||
DateStart = endRounded.AddDays(-numDayPrev),
|
||||
SearchVal = ""
|
||||
};
|
||||
return answ;
|
||||
}
|
||||
|
||||
public override bool Equals(object obj)
|
||||
{
|
||||
if (!(obj is SelectData item))
|
||||
return false;
|
||||
|
||||
if (PageSize != item.PageSize)
|
||||
return false;
|
||||
if (PageNum != item.PageNum)
|
||||
return false;
|
||||
if (OnlyActive != item.OnlyActive)
|
||||
return false;
|
||||
if (OnlyMod != item.OnlyMod)
|
||||
return false;
|
||||
if (OnlyNoTag != item.OnlyNoTag)
|
||||
return false;
|
||||
if (SearchVal != item.SearchVal)
|
||||
return false;
|
||||
if (FileName != item.FileName)
|
||||
return false;
|
||||
if (IdxMacchina != item.IdxMacchina)
|
||||
return false;
|
||||
if (Tag != item.Tag)
|
||||
return false;
|
||||
if (DateEnd != item.DateEnd)
|
||||
return false;
|
||||
if (DateStart != item.DateStart)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public override int GetHashCode()
|
||||
{
|
||||
return base.GetHashCode();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using Microsoft.AspNetCore.WebUtilities;
|
||||
|
||||
namespace MP.Land.Extensions
|
||||
{
|
||||
public static class NavigationManagerExtension
|
||||
{
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Estensione metodo NavigationManager
|
||||
///
|
||||
/// https://code-maze.com/query-strings-blazor-webassembly/
|
||||
/// </summary>
|
||||
/// <typeparam name="T"></typeparam>
|
||||
/// <param name="navManager"></param>
|
||||
/// <param name="key"></param>
|
||||
/// <returns></returns>
|
||||
public static T ExtractQueryStringByKey<T>(this NavigationManager navManager, string key)
|
||||
{
|
||||
var uri = navManager.ToAbsoluteUri(navManager.Uri);
|
||||
QueryHelpers.ParseQuery(uri.Query)
|
||||
.TryGetValue(key, out var queryValue);
|
||||
|
||||
if (typeof(T).Equals(typeof(int)))
|
||||
{
|
||||
int.TryParse(queryValue, out int result);
|
||||
return (T)(object)result;
|
||||
}
|
||||
|
||||
if (typeof(T).Equals(typeof(string)))
|
||||
return (T)(object)queryValue.ToString();
|
||||
|
||||
return default;
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk.Web">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net6.0</TargetFramework>
|
||||
<RootNamespace>MP.Land</RootNamespace>
|
||||
<Version>6.15.2207.0419</Version>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Components\ArchiveStatus.razor.cs" />
|
||||
<Compile Remove="Components\FileEditor.razor.cs" />
|
||||
<Compile Remove="Components\TagSearch.razor.cs" />
|
||||
<Compile Remove="Data\FileArchDataService.cs" />
|
||||
<Compile Remove="Pages\Archive.razor.cs" />
|
||||
<Compile Remove="Pages\Setup.razor.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Content Remove="Components\ArchiveStatus.razor" />
|
||||
<Content Remove="Components\CodArtSelector.razor" />
|
||||
<Content Remove="Components\FileEditor.razor" />
|
||||
<Content Remove="Components\TagSearch.razor" />
|
||||
<Content Remove="Pages\Archive.razor" />
|
||||
<Content Remove="Pages\Setup.razor" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<_WebToolingArtifacts Remove="Properties\PublishProfiles\IIS03.pubxml" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml.user" />
|
||||
<None Include="Properties\PublishProfiles\IIS01.pubxml.user" />
|
||||
<None Include="Properties\PublishProfiles\IIS02.pubxml.user" />
|
||||
<None Include="Properties\PublishProfiles\IISProfile.pubxml.user" />
|
||||
<None Include="Properties\PublishProfiles\IIS03.pubxml.user" />
|
||||
<None Include="wwwroot\lib\index.svg" />
|
||||
<None Include="wwwroot\lib\jquery.min.js" />
|
||||
<None Include="wwwroot\lib\LICENSE" />
|
||||
<None Include="wwwroot\lib\qrcode.js" />
|
||||
<None Include="wwwroot\lib\qrcode.min.js" />
|
||||
<None Include="wwwroot\lib\README.md" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="DiffMatchPatch" Version="1.0.3" />
|
||||
<PackageReference Include="Majorsoft.Blazor.Components.Debounce" Version="1.5.0" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="5.0.10">
|
||||
<PrivateAssets>all</PrivateAssets>
|
||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="5.0.0" />
|
||||
<PackageReference Include="Microsoft.VisualStudio.Web.CodeGeneration.Design" Version="5.0.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
|
||||
<PackageReference Include="NLog.Web.AspNetCore" Version="4.14.0" />
|
||||
<PackageReference Include="RestSharp" Version="107.1.2" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MP.AppAuth\MP.AppAuth.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent">
|
||||
<Exec Command="powershell.exe -ExecutionPolicy Unrestricted -NoProfile -NonInteractive -File $(ProjectDir)\post-build.ps1 -ProjectDir $(ProjectDir) -ProjectPath $(ProjectPath)" />
|
||||
</Target>
|
||||
</Project>
|
||||
@@ -0,0 +1,46 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<nlog xmlns="http://www.nlog-project.org/schemas/NLog.xsd"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.nlog-project.org/schemas/NLog.xsd NLog.xsd"
|
||||
autoReload="true"
|
||||
throwExceptions="false"
|
||||
internalLogLevel="Off" internalLogFile="c:\temp\nlog-internal.log">
|
||||
|
||||
<!-- optional, add some variables
|
||||
https://github.com/nlog/NLog/wiki/Configuration-file#variables
|
||||
-->
|
||||
<variable name="myvar" value="myvalue" />
|
||||
|
||||
<!--
|
||||
See https://github.com/nlog/nlog/wiki/Configuration-file
|
||||
for information on customizing logging rules and outputs.
|
||||
-->
|
||||
<targets>
|
||||
|
||||
<!--
|
||||
add your targets here
|
||||
See https://github.com/nlog/NLog/wiki/Targets for possible targets.
|
||||
See https://github.com/nlog/NLog/wiki/Layout-Renderers for the possible layout renderers.
|
||||
-->
|
||||
|
||||
<!--
|
||||
Write events to a file with the date in the filename.
|
||||
<target xsi:type="File" name="f" fileName="${basedir}/logs/${shortdate}.log"
|
||||
layout="${longdate} ${uppercase:${level}} ${message}" />
|
||||
-->
|
||||
<target xsi:type="File" name="fileTarget" fileName="${basedir}/logs/${shortdate}.log" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=false} | ${message}" />
|
||||
<target xsi:type="ColoredConsole" name="consoleTarget" layout="${longdate} | ${uppercase:${level}} | ${logger:shortName=true}| ${message}" />
|
||||
</targets>
|
||||
|
||||
<rules>
|
||||
<!-- add your logging rules here -->
|
||||
|
||||
<!--
|
||||
Write all events with minimal level of Debug (So Debug, Info, Warn, Error and Fatal, but not Trace) to "f"
|
||||
<logger name="*" minlevel="Debug" writeTo="f" />
|
||||
-->
|
||||
<logger name="*" minlevel="Trace" writeTo="consoleTarget" />
|
||||
<!--<logger name="Microsoft.*" maxlevel="Info" final="true" />-->
|
||||
<logger name="*" minlevel="Info" writeTo="fileTarget" />
|
||||
</rules>
|
||||
</nlog>
|
||||
@@ -0,0 +1,99 @@
|
||||
@page "/About"
|
||||
@using MP.Land.Data
|
||||
|
||||
@inject MessageService AppMService
|
||||
@inject LicenseService LicServ
|
||||
|
||||
<div class="row mx-2">
|
||||
<div class="col-12 col-lg-10 offset-lg-1">
|
||||
<div class="card">
|
||||
<div class="card-header text-center">
|
||||
<div class="row">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-4">
|
||||
<h2>@Titolo</h2>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="badge badge-pill badge-dark px-4 py-2">
|
||||
<div class="px-1">
|
||||
<a class="text-light" href="https://www.egalware.com/" target="_blank">powered by EgalWare <img width="24" class="img-fluid" src="img/LogoBluGreen.png" /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-3"></div>
|
||||
<div class="col-12 col-lg-6 py-3">
|
||||
<img src="img/LogoMapoFull.png" class="img-fluid" />
|
||||
</div>
|
||||
<div class="col-lg-3"></div>
|
||||
<div class="col-6">
|
||||
<h4 class="card-title">@Messaggio</h4>
|
||||
<br />
|
||||
<p>MoonPro / MAPO sono una suite di applicazioni e dispositivi hw dedicati per l'IOT,l'industry 4.0 e la gestione automatizzata dei processi produttivi.</p>
|
||||
<hr />
|
||||
<p>Per maggiori informazioni <a href="http://www.steamware.net/iot" target="_blank">visita il link</a> sul nostro sito.</p>
|
||||
</div>
|
||||
<div class="col-6 text-right">
|
||||
<div runat="server" id="divCheck" class="@mainCss">
|
||||
<h4>Info installazione</h4>
|
||||
<hr />
|
||||
<div class="d-flex justify-content-between @remSrvCss">
|
||||
<div class="px-2">
|
||||
<i class="fa fa-server" aria-hidden="true"></i> Remote Server:
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<b>@ServerStatus</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<i class="fa fa-certificate" aria-hidden="true"></i> Cliente:
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<b>@Installazione</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<i class="fa fa-desktop" aria-hidden="true"></i> App:
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<b>@Applicazione</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<i class="fa fa-users" aria-hidden="true"></i> Licenze:
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<b title="# Licenze locali / # Licenze Remote">@Licenze</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between @expDateCss">
|
||||
<div class="px-2">
|
||||
<i class="far fa-calendar-check" aria-hidden="true"></i> Scadenza:
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<b>@($"{Scadenza:yyyy/MM/dd}")</b>
|
||||
</div>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<div class="px-2">
|
||||
<i class="fa fa-key" aria-hidden="true"></i> Key
|
||||
</div>
|
||||
<div class="px-2">
|
||||
<span Font-Size="0.6em" class="small">@MastKey</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -0,0 +1,78 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Components;
|
||||
using System.Net.Http;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Authorization;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Microsoft.AspNetCore.Components.Routing;
|
||||
using Microsoft.AspNetCore.Components.Web;
|
||||
using Microsoft.AspNetCore.Components.Web.Virtualization;
|
||||
using Microsoft.JSInterop;
|
||||
using MP.Land;
|
||||
using MP.Land.Shared;
|
||||
using MP.Land.Data;
|
||||
|
||||
namespace MP.Land.Pages
|
||||
{
|
||||
public partial class About
|
||||
{
|
||||
protected string Titolo = "";
|
||||
protected string Messaggio = "";
|
||||
|
||||
protected string ServerStatus = "SrvState";
|
||||
protected string Installazione = "Inst";
|
||||
protected string Applicazione = "App";
|
||||
protected string Licenze = "#";
|
||||
protected DateTime Scadenza = DateTime.Today;
|
||||
protected string MastKey = "########################";
|
||||
|
||||
protected string mainCss = "alert alert-info";
|
||||
protected string remSrvCss = "bg-danger text-warning";
|
||||
protected string expDateCss = "bg-danger text-warning";
|
||||
|
||||
protected override async Task OnInitializedAsync()
|
||||
{
|
||||
updatePageHead();
|
||||
|
||||
await reloadLicenseData();
|
||||
}
|
||||
|
||||
private async Task reloadLicenseData()
|
||||
{
|
||||
int cDelay = 5;
|
||||
// recupero dati
|
||||
await Task.Delay(cDelay);
|
||||
LicServ.InitAkv();
|
||||
Installazione = LicServ.Installazione;
|
||||
Applicazione = LicServ.Applicazione;
|
||||
MastKey = LicServ.MasterKey;
|
||||
await Task.Delay(cDelay);
|
||||
var fatto = await LicServ.RefreshLicense();
|
||||
await Task.Delay(cDelay);
|
||||
Licenze = $"{LicServ.NumLicDb}/{LicServ.NumLicRemote}";
|
||||
// verifico stati
|
||||
ServerStatus = await LicServ.checkLimanServer();
|
||||
bool okRemoteSrv = ServerStatus == "OK";
|
||||
bool okScadenza = LicServ.checkLicenseActive(LicServ.MasterKey);
|
||||
bool okNumLic = (LicServ.NumLicDb <= LicServ.NumLicRemote);
|
||||
|
||||
// aggiornamento css secondo status colore da check
|
||||
mainCss = okNumLic ? "alert alert-success shadowBox" : "alert alert-warning shadowBox";
|
||||
expDateCss = okScadenza ? "d-flex justify-content-between" : "d-flex justify-content-between bg-danger text-warning";
|
||||
remSrvCss = okRemoteSrv ? "d-flex justify-content-between" : "d-flex justify-content-between bg-danger text-warning";
|
||||
await Task.Delay(cDelay);
|
||||
}
|
||||
|
||||
private void updatePageHead()
|
||||
{
|
||||
Titolo = "MES | SCADA | IOT";
|
||||
Messaggio = "Soluzione integrata per la gestione della produzione";
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "About";
|
||||
AppMService.PageIcon = "fas fa-info-circle pr-2";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
@page "/Contacts"
|
||||
@using MP.Land.Data
|
||||
|
||||
@inject MessageService AppMService
|
||||
|
||||
<div class="row mx-2">
|
||||
<div class="col-12 col-lg-8 offset-lg-2">
|
||||
<div class="card">
|
||||
<div class="card-header text-center">
|
||||
<div class="row">
|
||||
<div class="col-4"></div>
|
||||
<div class="col-4">
|
||||
<h2>@Titolo</h2>
|
||||
</div>
|
||||
<div class="col-4">
|
||||
<div class="badge badge-pill badge-dark px-4 py-2">
|
||||
<div class="px-1">
|
||||
<a class="text-light" href="https://www.egalware.com/" target="_blank">powered by EgalWare <img width="24" class="img-fluid" src="img/LogoBluGreen.png" /></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<div class="row">
|
||||
<div class="col-lg-3"></div>
|
||||
<div class="col-12 col-lg-6 py-3">
|
||||
<img src="img/LogoMapoFull.png" class="img-fluid" />
|
||||
</div>
|
||||
<div class="col-lg-3"></div>
|
||||
<div class="col-12">
|
||||
<h4 class="card-title">@Messaggio</h4>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h4>Sede Operativa</h4>
|
||||
<address>
|
||||
<strong>EgalWare s.r.l.</strong><br />
|
||||
via Nazionale, 93<br />
|
||||
24068 Seriate - BG<br />
|
||||
<abbr title="Phone">P:</abbr>
|
||||
035.290178<br />
|
||||
<abbr title="Phone">P:</abbr>
|
||||
035.460560
|
||||
</address>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h4>Sede Legale</h4>
|
||||
<address>
|
||||
<strong>EgalWare s.r.l.</strong><br />
|
||||
via Nazionale, 93<br />
|
||||
24068 Seriate - BG<br />
|
||||
<br />
|
||||
<abbr title="P.Iva">VAT:</abbr>03985390164
|
||||
</address>
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<h4>Supporto</h4>
|
||||
<address>
|
||||
<strong>Web:</strong><br />
|
||||
Accedi al supporto dal <a href="https://support.egalware.com/" target="_blank">nostro sito web</a><br />
|
||||
<br />
|
||||
<strong>Email:</strong><br />
|
||||
Scrivi un email a <a href="mailto:info@egalware.com">info at egalware.com</a>
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@code {
|
||||
|
||||
protected string Titolo = "";
|
||||
protected string Messaggio = "";
|
||||
|
||||
protected override void OnInitialized()
|
||||
{
|
||||
Titolo = "Mapo MES";
|
||||
Messaggio = "I nostri contattatti e siti di supporto";
|
||||
AppMService.ShowSearch = false;
|
||||
AppMService.PageName = "Contacts";
|
||||
AppMService.PageIcon = "fas fa-envelope pr-2";
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user