3 Commits

Author SHA1 Message Date
Samuele Locatelli 317508f37b Merge branch 'develop' into SDK 2024-08-08 17:34:46 +02:00
Samuele Locatelli 6d190dd95c Merge branch 'develop' into SDK 2024-08-08 17:31:45 +02:00
Samuele Locatelli 912dd3579b Merge branch 'develop' into SDK 2024-08-07 18:48:48 +02:00
243 changed files with 25584 additions and 49221 deletions
+166 -60
View File
@@ -1,11 +1,8 @@
variables:
VERS_MAIN: '2.1'
NEXUS_PATH: 'LiMan'
APP_NAME: 'LiMan.UI'
SOL_NAME: 'LiMan.UI'
NUGET_PATH: 'C:\Tools\nuget.exe'
MSBUILD_PATH: 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\MSBuild\Current\Bin\MSBuild.exe'
SRC_ZIP_PATH: 'bin\publish\net6.0'
VERS_MAIN: '1.0'
NEXUS_PATH: 'LiMan'
APP_NAME: 'LiMan.UI'
NUGET_PATH: 'C:\Tools\nuget.exe'
# helper x fix pacchetti nuget da repo locale nexus.steamware.net
.nuget-fix: &nuget-fix
@@ -14,19 +11,18 @@ variables:
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"
dotnet nuget remove source "`"Steamware Nexus Proxy`""
}
$hasSource = dotnet nuget list source | Select-String -Pattern "Steamware Nexus"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source "Steamware Nexus"
dotnet nuget remove source "`"Steamware Nexus`""
}
$hasSource = dotnet nuget list source | Select-String -Pattern "nexus-proxy-v3"
if (! [String]::IsNullOrWhiteSpace($hasSource)) {
dotnet nuget remove source nexus-proxy-v3
}
dotnet nuget add source https://nexus.steamware.net/repository/nuget-group-3/index.json -n "Steamware Nexus" -u nugetUser -p $NEXUS_PASSWD --store-password-in-clear-text
echo "Steamware Nexus Source added, final state:"
dotnet nuget list source
echo "Steamware Nexus Source added"
# helper creazione files zip
.zipper: &zipper
@@ -37,9 +33,9 @@ variables:
}
Set-Alias 7zip $7zipPath
$Target = "$env:APP_NAME\Releases\" + $CI_COMMIT_BRANCH + "\" + $env:APP_NAME + ".zip"
$Source = "$env:APP_NAME\$SRC_ZIP_PATH\*"
echo "calling 7zip $Source --> $Target"
$Source = "$env:APP_NAME\bin\publish\net6.0\*"
7zip a -tzip $Target $Source -xr!DATA
echo "called ZIP $Source --> $Target"
#cd "$env:APP_NAME\bin\publish\net6.0"
@@ -126,11 +122,13 @@ variables:
echo "replace completati"
stages:
- build
- deploy
- release
# --------------------------------
# BUILD
# --------------------------------
@@ -138,46 +136,46 @@ UI:build:
stage: build
tags:
- win
except:
- EgwAppControlCenter
variables:
SOL_NAME: LiMan
APP_NAME: LiMan.UI
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- dotnet restore LiMan.sln
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet build LiMan.UI/LiMan.UI.csproj
API:build:
stage: build
tags:
- win
except:
- EgwAppControlCenter
variables:
SOL_NAME: LiMan
APP_NAME: LiMan.Api
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- dotnet restore LiMan.sln
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet build LiMan.Api/LiMan.Api.csproj
Transfer:build:
stage: build
tags:
- win
except:
- EgwAppControlCenter
variables:
SOL_NAME: LiMan
APP_NAME: LiMan.Transfer
before_script:
- *nuget-fix
- dotnet restore "$env:SOL_NAME.sln"
- dotnet restore LiMan.sln
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet build LiMan.Transfer/LiMan.Transfer.csproj
EgwProxy.LiMan:build:
stage: build
tags:
- win
variables:
APP_NAME: EgwProxy.LiMan
SOL_NAME: EgwProxy.LiMan
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:APP_NAME.sln" -verbosity quiet'
script:
- echo $CI_COMMIT_BRANCH
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
# --------------------------------
# DEPLOY
@@ -186,17 +184,13 @@ UI:IIS01:deploy:
stage: deploy
tags:
- win
variables:
SOL_NAME: LiMan
APP_NAME: LiMan.UI
SRC_ZIP_PATH: bin\Release\net6.0
only:
- develop
needs: ["UI:build"]
before_script:
- *nuget-fix
script:
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.UI/LiMan.UI.csproj
- *zipper
- *hashBuild
- *nexusUpload
@@ -206,16 +200,14 @@ API:IIS01:deploy:
tags:
- win
variables:
SOL_NAME: LiMan
APP_NAME: LiMan.Api
SRC_ZIP_PATH: bin\Release\net6.0
APP_NAME: 'LiMan.Api'
only:
- develop
needs: ["API:build"]
before_script:
- *nuget-fix
script:
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS01.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.Api/LiMan.Api.csproj
- *zipper
- *hashBuild
- *nexusUpload
@@ -224,38 +216,29 @@ UI:IIS04:deploy:
stage: deploy
tags:
- win
variables:
SOL_NAME: LiMan
APP_NAME: LiMan.UI
SRC_ZIP_PATH: bin\Release\net6.0
only:
- main
needs: ["UI:build"]
before_script:
- *nuget-fix
script:
- dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.UI/LiMan.UI.csproj
- *zipper
- *hashBuild
- *nexusUpload
API:IIS04:deploy:
stage: deploy
tags:
- win
except:
- EgwAppControlCenter
variables:
SOL_NAME: LiMan
APP_NAME: LiMan.Api
SRC_ZIP_PATH: bin\Release\net6.0
APP_NAME: 'LiMan.Api'
only:
- main
needs: ["API:build"]
before_script:
- *nuget-fix
script:
- dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=IIS04.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release -p:username=jenkins -p:Password=$IIS_PWD -p:AllowUntrustedCertificate=true LiMan.Api/LiMan.Api.csproj
- *zipper
- *hashBuild
- *nexusUpload
@@ -264,17 +247,140 @@ Transfer:deploy:
stage: deploy
tags:
- win
except:
- EgwAppControlCenter
variables:
SOL_NAME: LiMan
APP_NAME: LiMan.Transfer
needs: ["Transfer:build"]
before_script:
- *nuget-fix
script:
- dotnet build $env:APP_NAME/$env:APP_NAME.csproj
- dotnet publish -p:PublishProfile=SingleFileX86.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release $env:APP_NAME/$env:APP_NAME.csproj
- dotnet build LiMan.Transfer/LiMan.Transfer.csproj
- dotnet publish -p:PublishProfile=SingleFileX86.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release LiMan.Transfer/LiMan.Transfer.csproj
- *zipper
- *hashBuild
- *nexusUpload
EgwProxy.LiMan:deploy:
stage: deploy
needs: ["EgwProxy.LiMan:build"]
tags:
- win
variables:
CONFIG: Debug
APP_NAME: EgwProxy.LiMan
SOL_NAME: EgwProxy.LiMan
only:
refs:
- develop
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet'
- *version-fix
- *nuspec-fix
script:
# - '& "$env:MSBUILD_PATH" "$env:APP_NAME\$env:APP_NAME.csproj" -target:Build /p:Configuration=$env:CONFIG /p:Platform="Any CPU" /p:OutputPath=bin/$env:CONFIG /verbosity:minimal /m'
- dotnet build "$env:APP_NAME\$env:APP_NAME.csproj"
- '& Remove-Item *.nupkg'
- '& $env:NUGET_PATH pack "$env:APP_NAME.Debug.nuspec"'
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_DEB.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# --------------------------------
# RELEASE
# --------------------------------
EgwProxy.LiMan:release:
stage: release
needs: ["EgwProxy.LiMan:build"]
tags:
- win
variables:
CONFIG: Release
APP_NAME: EgwProxy.LiMan
SOL_NAME: EgwProxy.LiMan
only:
refs:
- SDK
before_script:
- *nuget-fix
- '& "$env:NUGET_PATH" restore "$env:SOL_NAME.sln" -verbosity quiet'
- *version-fix
- *nuspec-fix
script:
- dotnet build "$env:APP_NAME\$env:APP_NAME.csproj"
- '& Remove-Item *.nupkg'
- '& $env:NUGET_PATH pack "$env:APP_NAME.Release.nuspec"'
- '& "$env:NUGET_PATH" setapikey $NUGET_API_KEY -source http://nexus.steamware.net/repository/nuget-hosted'
- '& "$env:NUGET_PATH" push *$env:NUM_REL.nupkg -Source http://nexus.steamware.net/repository/nuget-hosted'
# UI:installer:
# stage: installer
# tags:
# - win
# only:
# - develop
# - main
# needs: ["UI:build"]
# variables:
# APP_NAME: LiMan.UI
# NEXUS_PATH: MP-LAND
# before_script:
# # - *nuget-fix
# # - dotnet restore
# script:
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release LiMan.UI/LiMan.UI.csproj -o:publish
# # qui il deploy su nexus...
# - *hashBuild
# - *nexusUpload
# API:installer:
# stage: installer
# tags:
# - win
# only:
# - develop
# - main
# needs: ["API:build"]
# variables:
# APP_NAME: LiMan.Api
# NEXUS_PATH: MP-PROG
# before_script:
# # - *nuget-fix
# # - dotnet restore
# script:
# - dotnet publish -p:PublishProfile=IISProfile.pubxml -p:RunCodeAnalysis=false -p:Configuration=Release LiMan.Api/LiMan.Api.csproj -o:publish
# # qui il deploy su nexus...
# - *hashBuild
# - *nexusUpload
# UI:release:
# stage: release
# tags:
# - win
# only:
# #- feature/Deploy_CI_CD
# # - main
# - tags
# except:
# - branches
# needs: ["UI:build"]
# artifacts:
# paths:
# - publish/
# script:
# - dotnet publish -c Release -o ./publish LiMan.UI/LiMan.UI.csproj
# API:release:
# stage: release
# tags:
# - win
# only:
# #- feature/Deploy_CI_CD
# # - main
# - tags
# except:
# - branches
# needs: ["API:build"]
# artifacts:
# paths:
# - publish/
# script:
# - dotnet publish -c Release -o ./publish LiMan.Api/LiMan.Api.csproj
-67
View File
@@ -1,67 +0,0 @@
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Core.Enum;
namespace Core
{
public class AppRelVersion
{
#region Public Properties
/// <summary>
/// Installazione funzionalità uploader
/// </summary>
public string CodInst { get; set; } = "";
/// <summary>
/// ID upload app
/// </summary>
public string UplAppID { get; set; } = "";
/// <summary>
/// Chiave di autorizzazione alla comunicazione
/// </summary>
public string MasterKey { get; set; } = "";
/// <summary>
/// Cod applicativo di riferimento
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// Tipo Applicazione
/// </summary>
public string Tipo { get; set; } = "";
/// <summary>
/// Versione applicativo formato semver numerico 4 blocchi
/// </summary>
public string VersNum { get; set; } = "0.0.0.0";
/// <summary>
/// Versione applicativo, formato testuale libero, può essere uguale a VersNum
/// </summary>
public string VersText { get; set; } = "a.b";
/// <summary>
/// Data di release
/// </summary>
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
/// <summary>
/// Tag associati a versione, comma separated
/// </summary>
public string RelTags { get; set; } = "";
public bool IsValid
{
get => !string.IsNullOrEmpty(CodInst) && !string.IsNullOrEmpty(UplAppID) && !string.IsNullOrEmpty(MasterKey) && !string.IsNullOrEmpty(CodApp) && !string.IsNullOrEmpty(VersNum) && !string.IsNullOrEmpty(VersText);
}
#endregion Public Properties
}
}
+1 -4
View File
@@ -10,10 +10,7 @@ namespace Core
{
// classi utilità x cache REDIS dati DB
public const string redisBaseAddr = "LiMan:Ui";
public const string redisBaseAddr = "MagManUi";
public const string rKeyConfig = $"{redisBaseAddr}:Cache";
public const string ENRL_MSG_PIPE = $"{redisBaseAddr}:MPipe:Enroll";
public const string TASK_MSG_PIPE = $"{redisBaseAddr}:MPipe:Tasks";
public const string UPDT_MSG_PIPE = $"{redisBaseAddr}:MPipe:Update";
}
}
-41
View File
@@ -1,41 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class AuthDataDTO
{
/// <summary>
/// Master Key
/// </summary>
public string MastKey { get; set; } = "";
/// <summary>
/// Codice Impiego istanza SubLic
/// </summary>
public string CodImp { get; set; } = "";
/// <summary>
/// Chiave SubLic
/// </summary>
public string AppKey { get; set; } = "";
/// <summary>
/// Verifica complessiva validità richiesta:
/// CodApp presente
/// - MainKey oppure CodImp + AppKey presenti
/// </summary>
[NotMapped]
public virtual bool IsValid
{
get => (!string.IsNullOrEmpty(MastKey) || (!string.IsNullOrEmpty(CodImp) && !string.IsNullOrEmpty(AppKey)));
}
}
}
-31
View File
@@ -1,31 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ManDeclareDTO : AuthDataDTO
{
/// <summary>
/// Elenco delle CodApp Gestite
/// </summary>
public List<string> ListCodApp { get; set; } = new List<string>();
/// <summary>
/// Verifica complessiva validità richiesta:
/// CodApp presente
/// - MainKey oppure CodImp + AppKey presenti
/// </summary>
[NotMapped]
public override bool IsValid
{
get => (ListCodApp != null && ListCodApp.Count > 0) && (!string.IsNullOrEmpty(MastKey) || (!string.IsNullOrEmpty(CodImp) && !string.IsNullOrEmpty(AppKey)));
}
}
}
-47
View File
@@ -1,47 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class ReleaseReqDTO : AuthDataDTO
{
/// <summary>
/// CodApp Richiesta
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// Versione minima richiesta
/// </summary>
public string VersMin { get; set; } = "";
/// <summary>
/// Versione MAX richiesta
/// </summary>
public string VersMax { get; set; } = "";
/// <summary>
/// Numero di Impieghi attivi (es num di IOB relativi)
/// </summary>
public int NumImp { get; set; } = 1;
/// <summary>
/// Verifica complessiva validità richiesta:
/// CodApp presente
/// - MainKey oppure CodImp + AppKey presenti
/// </summary>
[NotMapped]
public override bool IsValid
{
get => !string.IsNullOrEmpty(CodApp) && (!string.IsNullOrEmpty(MastKey) || (!string.IsNullOrEmpty(CodImp) && !string.IsNullOrEmpty(AppKey)));
}
}
}
-22
View File
@@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class TaskResultDTO : AuthDataDTO
{
/// <summary>
/// Payload informazione ricevuto come dizionario chiavi/valore, il valore potrebbe essere un info ulteriormente serializzata
/// </summary>
public Dictionary<string,string> DataPayload { get; set; } = new Dictionary<string, string>();
}
}
-3
View File
@@ -3,9 +3,6 @@ using static Core.Enum;
namespace Core.DTO
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
public class TicketDTO
{
#region Public Properties
+3 -118
View File
@@ -1,9 +1,4 @@
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.Text.Json.Serialization;
namespace Core
namespace Core
{
public class Enum
{
@@ -43,14 +38,9 @@ namespace Core
UserKey,
/// <summary>
/// Chiave tipo Checksum basata su licenza master + checksum MD5 di una serie di dati (child licenses)
/// Chiave tiupo Checksum basata su licenza masster + checksum MD5 di una serie di dati (child licenses)
/// </summary>
CheckSumKey,
/// <summary>
/// Chiave tiupo SubLicenza applicativa (es AppControlCenter)
/// </summary>
AppSubLic
CheckSumKey
}
/// <summary>
@@ -62,110 +52,5 @@ namespace Core
Licenze,
FileUpload
}
/// <summary>
/// Elenco tipi app ammessi
/// </summary>
public static Dictionary<string, string> AppType = new Dictionary<string, string>{
{ "", "---Selezionare---" },
{ "Cli", "Cli (Console)" },
{ "EgwACC", "EgwAppCtrCenter" },
{ "LicenceApp", "LicenceApp" },
{ "Machine", "Machine" },
{ "WebApp", "WebApp" },
{ "WinApp", "WinApp" }
};
#if false
[JsonConverter(typeof(StringEnumConverter))]
public enum AppType
{
None,
Cli,
Machine,
WebApp,
WinApp,
LicenceApp
}
#endif
/// <summary>
/// Elenco tipi di azioni che si possono chiedere ad EgwACC
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum EgwAccTask
{
/// <summary>
/// Non definito (init)
/// </summary>
ND = 0,
/// <summary>
/// Richiesta ricerca generica app da sorgenti mappate (registro, path...) ricevute in input
/// </summary>
AppSearch,
/// <summary>
/// Effettua backup ed invio cartella CONF delle app gestite x update
/// </summary>
BackupSendConf,
/// <summary>
/// Richiesta info device (analoghe a quelle del setup iniziale in Enroll)
/// </summary>
DeviceInfoGet,
/// <summary>
/// Richiesta verifica forzata da remoto
/// </summary>
ForceCheck,
/// <summary>
/// Richiede reload forzato (come da tray menu con Reload senza check update)
/// </summary>
ForceReload,
/// <summary>
/// Richiede update forzato (come da tray menu con restart tramite bootstrap process esterno)
/// </summary>
ForceUpdate,
/// <summary>
/// Info tipo License (Oxysec key)
/// </summary>
OxyLicenseGet,
/// <summary>
/// Forza Reset parametri opzionali impostabili da remoto
/// </summary>
ParamDictReset,
/// <summary>
/// Upsert di parametri operativi (gestiti in remoto)
/// </summary>
ParamUpsert,
/// <summary>
/// Upsert valori TargetList (gestiti in remoto)
/// </summary>
TargetListUpsert,
/// <summary>
/// Aggiorno di un applicazione richiamato da remoto
/// </summary>
TargetAppUpdate
}
/// <summary>
/// /Status di aggiornamento di un applicativo updater
/// </summary>
[JsonConverter(typeof(StringEnumConverter))]
public enum UpdStatus
{
None,
Pending,
Running,
Done
}
}
}
-53
View File
@@ -1,53 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core
{
public class MeasureUtils
{
#region Public Fields
public static readonly string[] SizeSuffixes = { "bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
#endregion Public Fields
#region Public Methods
/// <summary>
/// Calcola dimensione file automaticamwente secondo dimensione
/// </summary>
/// <param name="value"></param>
/// <param name="decimalPlaces"></param>
/// <returns></returns>
/// <exception cref="ArgumentOutOfRangeException"></exception>
public static string SizeSuffix(Int64 value, int decimalPlaces = 1)
{
if (decimalPlaces < 0) { throw new ArgumentOutOfRangeException("decimalPlaces"); }
if (value < 0) { return "-" + SizeSuffix(-value, decimalPlaces); }
if (value == 0) { return string.Format("{0:n" + decimalPlaces + "} bytes", 0); }
// mag is 0 for bytes, 1 for KB, 2, for MB, etc.
int mag = (int)Math.Log(value, 1024);
// 1L << (mag * 10) == 2 ^ (10 * mag) [i.e. the number of bytes in the unit
// corresponding to mag]
decimal adjustedSize = (decimal)value / (1L << (mag * 10));
// make adjustment when the value is large enough that it would round up to 1000 or more
if (Math.Round(adjustedSize, decimalPlaces) >= 1000)
{
mag += 1;
adjustedSize /= 1024;
}
return string.Format("{0:n" + decimalPlaces + "} {1}",
adjustedSize,
SizeSuffixes[mag]);
}
#endregion Public Methods
}
}
-45
View File
@@ -1,45 +0,0 @@
using Newtonsoft.Json.Converters;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core.Models
{
public class ControlTarget
{
[Key]
public int Idx { get; set; } = 0;
/// <summary>
/// Tipo applicazione da monitorare
/// </summary>
public string ApplicationType { get; set; } = "";
#if false
[JsonConverter(typeof(StringEnumConverter))]
public CoreEnum.AppType ApplicationType { get; set; } = CoreEnum.AppType.None;
#endif
/// <summary>
/// Path di base da monitorare
/// </summary>
public string BasePath { get; set; } = "";
/// <summary>
/// Pattern di ricerca
/// </summary>
public string SearchPattern { get; set; } = "";
/// <summary>
/// Indica se il path sia abilitato
/// </summary>
public bool IsEnabled { get; set; } = true;
/// <summary>
/// Indica se sia abilitato l'update x l'item
/// </summary>
public bool UpdateEnabled { get; set; } = false;
}
}
+2 -2
View File
@@ -2,9 +2,9 @@
{
public class UploadResult
{
public bool Uploaded { get; set; } = false;
public bool Uploaded { get; set; }
public string FileName { get; set; } = "";
public string StoredFileName { get; set; } = "";
public int ErrorCode { get; set; } = 0;
public int ErrorCode { get; set; }
}
}
-2
View File
@@ -3,7 +3,6 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Core.Enum;
namespace Core
{
@@ -12,7 +11,6 @@ namespace Core
#region Public Properties
public string MasterKey { get; set; } = "";
public TipoLicenza LicType { get; set; } = TipoLicenza.UserKey;
public Dictionary<string, string> ParamDict { get; set; } = new Dictionary<string, string>();
#endregion Public Properties
-55
View File
@@ -1,55 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Core
{
public class Utils
{
/// <summary>
/// Effettua arrotondamento di un timespan ad un dato step di minuti
///
/// vedere qui: https://stackoverflow.com/questions/1393696/rounding-datetime-objects
/// </summary>
/// <param name="TSpanOrig">DataOra originale</param>
/// <param name="roundMin">Minuti di arrotondamento richeisti</param>
/// <param name="isFloor">Arrotondamento x difetto (floor = true) o eccesso (false)</param>
/// <returns></returns>
public static TimeSpan TSpanRounded(TimeSpan TSpanOrig, int roundMin, bool isFloor)
{
long ticks = 0;
roundMin = roundMin <= 0 ? 1 : roundMin;
TimeOnly step = new TimeOnly(0, roundMin);
if (isFloor)
{
ticks = TSpanOrig.Ticks / step.Ticks;
}
else
{
ticks = (TSpanOrig.Ticks + step.Ticks - 1) / step.Ticks;
}
TimeSpan answ = new TimeSpan(ticks * step.Ticks);
return answ;
}
/// <summary>
/// Effettua arrotondamento di un timespan ad un dato step di minuti
///
/// vedere qui: https://stackoverflow.com/questions/1393696/rounding-datetime-objects
/// </summary>
/// <param name="DateOrig">DataOra originale</param>
/// <param name="roundMin">Minuti di arrotondamento richeisti</param>
/// <returns></returns>
public static TimeSpan TSpanRounded(TimeSpan TSpanOrig, int roundMin)
{
long ticks = 0;
roundMin = roundMin <= 0 ? 1 : roundMin;
TimeOnly step = new TimeOnly(0, roundMin);
ticks = (TSpanOrig.Ticks + step.Ticks / 2) / step.Ticks;
TimeSpan answ = new TimeSpan(ticks * step.Ticks);
return answ;
}
}
}
+22
View File
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{5DADD362-4B14-45AD-AB0A-B30361D7449B}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>EgwProxy.LiMan.ConsoleTest</RootNamespace>
<AssemblyName>EgwProxy.LiMan.ConsoleTest</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\EgwProxy.LiMan\EgwProxy.LiMan.csproj">
<Project>{1b8191a0-dd4e-4320-878b-246a9b61c368}</Project>
<Name>EgwProxy.LiMan</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+77
View File
@@ -0,0 +1,77 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.LiMan.ConsoleTest
{
internal class Program
{
static void Main(string[] args)
{
string separator = "-----------------";
string codApp = "EgtBeamWall";
string answ = "";
#if DEBUG
string srvUrl = "localhost:5003";
//string srvUrl = "liman.egalware.com/ELM.API";
#else
string srvUrl = "liman.egalware.com/ELM.API";
#endif
Console.WriteLine(separator);
Console.WriteLine("EgwProxy.LiMan | Console test app");
Console.WriteLine(separator);
Console.WriteLine("premere un tasto per continuare...");
Console.ReadLine();
// per prima cosa instanzio (cablato) la classe di comnicazione
var commLib = new DataSyncro(srvUrl);
// test ping
Console.WriteLine("Premere ENT per check ping");
answ = Console.ReadLine();
bool servOk = commLib.CheckRemote();
string esito = servOk ? "OK" : "KO";
Console.WriteLine($"Esito controllo server: {esito}");
// chiamo e mostro elenco
var listAll = commLib.ReleaseGetAll(codApp);
// mostro elenco
Console.WriteLine(separator);
Console.WriteLine("Elenco versioni completo:");
Console.WriteLine(separator);
Console.WriteLine("");
foreach (var item in listAll)
{
Console.WriteLine($"{item.CodApp} | {item.VersNum} | {item.VersText} | {item.ReleaseDate:yyyy-MM-dd}");
}
Console.WriteLine(separator);
Console.WriteLine("premere un tasto per continuare...");
Console.WriteLine("");
Console.ReadLine();
Console.WriteLine(separator);
Console.WriteLine("Elenco versioni filtrato:");
Console.WriteLine(separator);
Console.WriteLine("");
Console.WriteLine("Inserire versione minima richiesta (default: 0.0.0.0)");
answ = Console.ReadLine();
answ = string.IsNullOrEmpty(answ) ? "0.0.0.0" : answ;
while (!string.IsNullOrEmpty(answ))
{
var listFilt = commLib.ReleaseGetFilt(codApp, answ);
foreach (var item in listFilt)
{
Console.WriteLine($"{item.CodApp} | {item.VersNum} | {item.VersText} | {item.ReleaseDate:yyyy-MM-dd}");
}
Console.WriteLine(separator);
Console.WriteLine("");
Console.WriteLine("Inserire versione minima richiesta (se vuoto esce)");
answ = Console.ReadLine();
}
}
}
}
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EgwProxy.LiMan.ConsoleTest")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EgwProxy.LiMan.ConsoleTest")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("5dadd362-4b14-45ad-ab0a-b30361d7449b")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+24
View File
@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>EgwProxy.LiMan</id>
<version>#version#</version>
<title>EgwProxy.LiMan</title>
<authors>Samuele E. Locatelli, EgalWare</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<description>Libreria per comunicazione REST con server LiMan - beta/unstable</description>
<releaseNotes>#releaseNotes#</releaseNotes>
<copyright>#copyright#</copyright>
<tags>EgwProxy.LiMan LiMan Rest</tags>
<dependencies>
<dependency id="RestSharp" version="111.2.0.0" />
<dependency id="Newtonsoft.Json" version="13.0.0.0" />
</dependencies>
</metadata>
<files>
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.dll" target="lib" />
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.config" target="lib" />
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.pdb" target="lib" />
</files>
</package>
+23
View File
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
<metadata>
<id>EgwProxy.LiMan</id>
<version>#version#</version>
<title>EgwProxy.LiMan</title>
<authors>Samuele E. Locatelli, EgalWare</authors>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<license type="expression">MIT</license>
<description>Libreria per comunicazione REST con server LiMan</description>
<releaseNotes>#releaseNotes#</releaseNotes>
<copyright>#copyright#</copyright>
<tags>EgwProxy.LiMan LiMan Rest</tags>
<dependencies>
<dependency id="RestSharp" version="111.2.0.0" />
<dependency id="Newtonsoft.Json" version="13.0.0.0" />
</dependencies>
</metadata>
<files>
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.dll" target="lib" />
<file src="EgwProxy.LiMan\bin\Debug\EgwProxy.LiMan*.config" target="lib" />
</files>
</package>
+37
View File
@@ -0,0 +1,37 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.9.34902.65
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.LiMan", "EgwProxy.LiMan\EgwProxy.LiMan.csproj", "{1B8191A0-DD4E-4320-878B-246A9B61C368}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EgwProxy.LiMan.ConsoleTest", "EgwProxy.LiMan.ConsoleTest\EgwProxy.LiMan.ConsoleTest.csproj", "{5DADD362-4B14-45AD-AB0A-B30361D7449B}"
EndProject
Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "TestWinFormVB", "TestWinFormVB\TestWinFormVB.vbproj", "{CC0A7D8F-0888-45F5-B791-FCD90349CD21}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{1B8191A0-DD4E-4320-878B-246A9B61C368}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{1B8191A0-DD4E-4320-878B-246A9B61C368}.Debug|Any CPU.Build.0 = Debug|Any CPU
{1B8191A0-DD4E-4320-878B-246A9B61C368}.Release|Any CPU.ActiveCfg = Release|Any CPU
{1B8191A0-DD4E-4320-878B-246A9B61C368}.Release|Any CPU.Build.0 = Release|Any CPU
{5DADD362-4B14-45AD-AB0A-B30361D7449B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5DADD362-4B14-45AD-AB0A-B30361D7449B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5DADD362-4B14-45AD-AB0A-B30361D7449B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5DADD362-4B14-45AD-AB0A-B30361D7449B}.Release|Any CPU.Build.0 = Release|Any CPU
{CC0A7D8F-0888-45F5-B791-FCD90349CD21}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CC0A7D8F-0888-45F5-B791-FCD90349CD21}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CC0A7D8F-0888-45F5-B791-FCD90349CD21}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CC0A7D8F-0888-45F5-B791-FCD90349CD21}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4898F98F-F4DF-4114-A026-D03C28F288A3}
EndGlobalSection
EndGlobal
+62
View File
@@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace EgwProxy.LiMan.DTO
{
public class ReleaseDTO
{
/// <summary>
/// Codice/Nome applicativo
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// Versione applicativo formato semver numerico 4 blocchi
/// </summary>
public string VersNum { get; set; } = "0.0.0.0";
/// <summary>
/// Versione applicativo, formato testuale libero, può essere uguale a VersNum
/// </summary>
public string VersText { get; set; } = "a.b";
/// <summary>
/// Oggetto versione calcolato da VersNum
/// </summary>
public Version VersVal { get; set; } = new Version();
/// <summary>
/// Verifica se sia permessa la versione quando viene valutata la versione massima consentita
/// </summary>
public bool IsPermitted { get; set; } = false;
/// <summary>
/// Data di release
/// </summary>
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
/// <summary>
/// Url pagina web di changelog (traduzione gestita sul sito target) - calcolato da CodApp + vers
/// </summary>
public string UrlChangelog { get; set; } = "http://releases.egalware.com";
/// <summary>
/// Url pagina web di changelog estesa (traduzione gestita sul sito target) - calcolato da CodApp + vers
/// </summary>
[NotMapped]
public string UrlChangelogExt { get; set; } = "http://releases.egalware.com";
/// <summary>
/// Indica se il record sia da considerare attivo/pubblico
/// </summary>
[NotMapped]
public bool IsActive { get; set; } = false;
}
}
+327
View File
@@ -0,0 +1,327 @@
using EgwProxy.LiMan.DTO;
using Newtonsoft.Json;
using NLog;
using NLog.Fluent;
using RestSharp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.NetworkInformation;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Web;
namespace EgwProxy.LiMan
{
public class DataSyncro
{
#region Public Constructors
/// <summary>
/// Inizializza la libreria di comunicazione con il token assegnato
/// </summary>
/// <param name="serverUrl">URL del server</param>
public DataSyncro(string serverUrl)
{
servAddr = serverUrl;
apiUrl = $"https://{servAddr}/api/";
rcOptions = new RestClientOptions { BaseUrl = new Uri(apiUrl), Timeout = TimeSpan.FromMilliseconds(callTimeout) };
Log.Info($"DataSyncro initialized | api: {apiUrl} | timeout: {callTimeout}");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Test ping x indirizzo indicato
/// </summary>
/// <param name="tgtAddr">Indirizzo da pingare</param>
/// <returns></returns>
public static IPStatus pingAddress(string tgtAddr)
{
IPStatus answ = IPStatus.Unknown;
IPAddress address;
PingReply reply;
using (Ping pingSender = new Ping())
{
address = IPAddress.Loopback;
int pingMsTimeout = 500;
IPAddress.TryParse(tgtAddr, out address);
try
{
// se != null --> uso tgtAddr...
if (address != null)
{
reply = pingSender.Send(address, pingMsTimeout);
}
else
{
reply = pingSender.Send(tgtAddr, pingMsTimeout);
}
}
catch
{
reply = pingSender.Send(IPAddress.Loopback, pingMsTimeout);
}
answ = reply.Status;
}
return answ;
}
/// <summary>
/// Test ping x indirizzo indicato
/// </summary>
/// <param name="tgtAddr">Indirizzo da pingare</param>
/// <param name="timeout">Timeout chiamata in ms</param>
/// <returns></returns>
public static IPStatus pingAddress(string tgtAddr, int timeout)
{
IPStatus answ = IPStatus.Unknown;
IPAddress address;
PingReply reply;
using (Ping pingSender = new Ping())
{
address = IPAddress.Loopback;
int pingMsTimeout = timeout;
IPAddress.TryParse(tgtAddr, out address);
try
{
// se != null --> uso tgtAddr...
if (address != null && address != IPAddress.Loopback)
{
reply = pingSender.Send(address, pingMsTimeout);
}
else
{
reply = pingSender.Send(tgtAddr, pingMsTimeout);
}
answ = reply.Status;
}
catch (Exception exc)
{
answ = IPStatus.Unknown;
Log.Error($"Errore in ping:{Environment.NewLine}{exc}");
}
}
return answ;
}
/// <summary>
/// Effettua chiamata test sul server (ping), se fallisse riprova fino a maxTry volte
/// </summary>
/// <param name="maxTry">num tentativi in caso di KO</param>
/// <param name="waitTime">tempo di attesa medio tra tentativi in ms</param>
/// <returns></returns>
public bool CheckRemote(int maxTry = 5, int waitTime = 200)
{
bool res = false;
int numTry = 0;
IPAddress address = IPAddress.Loopback;
string srvName = servAddr;
// tolgo eventuale nome con ":"
if (servAddr.Contains(":"))
{
srvName = servAddr.Substring(0, servAddr.IndexOf(":"));
}
// tolgo eventuale nome con "/"
if (servAddr.Contains("/"))
{
srvName = servAddr.Substring(0, servAddr.IndexOf("/"));
}
while (!res && numTry < maxTry)
{
res = pingAddress(srvName, callTimeout) == IPStatus.Success;
numTry++;
if (!res)
{
Thread.Sleep(waitTime);
}
}
return res;
}
/// <summary>
/// Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseGetAll(string CodApp)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/{CodAppEnc}", Method.Get);
var response = client.Get(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return answ;
}
/// <summary>
/// Versione Async Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <returns></returns>
public async Task<List<ReleaseDTO>> ReleaseGetAllAsync(string CodApp)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/{CodAppEnc}", Method.Get);
var response = await client.GetAsync(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return await Task.FromResult(answ);
}
/// <summary>
/// Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseGetFilt(string CodApp, string VersMin)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/filt/{CodAppEnc}?VersMin={VersMin}", Method.Get);
var response = client.Get(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return answ;
}
/// <summary>
/// Versione Async Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <returns></returns>
public async Task<List<ReleaseDTO>> ReleaseGetFiltAsync(string CodApp, string VersMin)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/filt/{CodAppEnc}?VersMin={VersMin}", Method.Get);
var response = await client.GetAsync(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return await Task.FromResult(answ);
}
/// <summary>
/// Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <param name="VersMax">Versione massima consentita</param>
/// <returns></returns>
public List<ReleaseDTO> ReleaseGetFiltLimit(string CodApp, string VersMin, string VersMax)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/filtLimit/{CodAppEnc}?VersMin={VersMin}&VersMax={VersMax}", Method.Get);
var response = client.Get(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return answ;
}
/// <summary>
/// Versione Async Elenco Release applicazione
/// </summary>
/// <param name="CodApp">CodApp richiesta</param>
/// <param name="VersMin">Versione minima richiesta</param>
/// <param name="VersMax">Versione massima consentita</param>
/// <returns></returns>
public async Task<List<ReleaseDTO>> ReleaseGetFiltLimitAsync(string CodApp, string VersMin, string VersMax)
{
List<ReleaseDTO> answ = new List<ReleaseDTO>();
using (RestClient client = new RestClient(rcOptions))
{
string CodAppEnc = HttpUtility.UrlEncode(CodApp);
var request = new RestRequest($"Release/filtLimit/{CodAppEnc}?VersMin={VersMin}&VersMax={VersMax}", Method.Get);
var response = await client.GetAsync(request);
// controllo risposta
if (response.StatusCode == HttpStatusCode.OK)
{
// contenuto serializzato
string rawData = $"{response.Content}";
answ = JsonConvert.DeserializeObject<List<ReleaseDTO>>(rawData);
}
}
return await Task.FromResult(answ);
}
#endregion Public Methods
#region Private Fields
/// <summary>
/// Istanza logger
/// </summary>
private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// URL dell'API x chiamate gestione licenze
/// </summary>
private string apiUrl = $"";
private int callTimeout = 10000;
/// <summary>
/// Opzioni standard di chiamata
/// </summary>
private RestClientOptions rcOptions = new RestClientOptions();
/// <summary>
/// Indirizzo server (URL con eventuale porta)
/// </summary>
private string servAddr = $"";
#endregion Private Fields
}
}
+96
View File
@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{1B8191A0-DD4E-4320-878B-246A9B61C368}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>EgwProxy.LiMan</RootNamespace>
<AssemblyName>EgwProxy.LiMan</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.Bcl.AsyncInterfaces, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\Microsoft.Bcl.AsyncInterfaces.8.0.0\lib\net462\Microsoft.Bcl.AsyncInterfaces.dll</HintPath>
</Reference>
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\packages\Newtonsoft.Json.13.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
</Reference>
<Reference Include="NLog, Version=5.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.5.0.1\lib\net46\NLog.dll</HintPath>
</Reference>
<Reference Include="RestSharp, Version=111.2.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75, processorArchitecture=MSIL">
<HintPath>..\packages\RestSharp.111.2.0\lib\net471\RestSharp.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Buffers, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Buffers.4.5.1\lib\net461\System.Buffers.dll</HintPath>
</Reference>
<Reference Include="System.ComponentModel.DataAnnotations" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.IO.Compression" />
<Reference Include="System.Memory, Version=4.0.1.2, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Memory.4.5.5\lib\net461\System.Memory.dll</HintPath>
</Reference>
<Reference Include="System.Numerics" />
<Reference Include="System.Numerics.Vectors, Version=4.1.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Numerics.Vectors.4.5.0\lib\net46\System.Numerics.Vectors.dll</HintPath>
</Reference>
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.6.0.0\lib\net461\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
</Reference>
<Reference Include="System.Text.Encodings.Web, Version=8.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Encodings.Web.8.0.0\lib\net462\System.Text.Encodings.Web.dll</HintPath>
</Reference>
<Reference Include="System.Text.Json, Version=8.0.0.3, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Text.Json.8.0.3\lib\net462\System.Text.Json.dll</HintPath>
</Reference>
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.4\lib\net461\System.Threading.Tasks.Extensions.dll</HintPath>
</Reference>
<Reference Include="System.ValueTuple, Version=4.0.3.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\packages\System.ValueTuple.4.5.0\lib\net461\System.ValueTuple.dll</HintPath>
</Reference>
<Reference Include="System.Web" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="DataSyncro.cs" />
<Compile Include="RestPayload.cs" />
<Compile Include="DTO\ReleaseDTO.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
+36
View File
@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("EgwProxy.LiMan")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EgwProxy.LiMan")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("1b8191a0-dd4e-4320-878b-246a9b61c368")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
+24
View File
@@ -0,0 +1,24 @@
using EgwProxy.LiMan.DTO;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace EgwProxy.LiMan
{
public class RestPayload
{
public class ReleaseData
{
#region Public Properties
/// <summary>
/// Elenco record ReleaseDTO x verifica versioni disponibili
/// </summary>
public List<ReleaseDTO> ReleaseList { get; set; }
#endregion Public Properties
}
}
}
+19
View File
@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-6.0.0.0" newVersion="6.0.0.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Text.Json" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.3" newVersion="8.0.0.3" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="Microsoft.Bcl.AsyncInterfaces" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-8.0.0.0" newVersion="8.0.0.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" /></startup></configuration>
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net472" />
<package id="Newtonsoft.Json" version="13.0.3" targetFramework="net472" />
<package id="NLog" version="5.0.1" targetFramework="net462" />
<package id="RestSharp" version="111.2.0" targetFramework="net472" />
<package id="System.Buffers" version="4.5.1" targetFramework="net472" />
<package id="System.Memory" version="4.5.5" targetFramework="net472" />
<package id="System.Numerics.Vectors" version="4.5.0" targetFramework="net472" />
<package id="System.Runtime.CompilerServices.Unsafe" version="6.0.0" targetFramework="net472" />
<package id="System.Text.Encodings.Web" version="8.0.0" targetFramework="net472" />
<package id="System.Text.Json" version="8.0.3" targetFramework="net462" />
<package id="System.Threading.Tasks.Extensions" version="4.5.4" targetFramework="net472" />
<package id="System.ValueTuple" version="4.5.0" targetFramework="net462" requireReinstallation="true" />
</packages>
File diff suppressed because one or more lines are too long
-357
View File
@@ -1,357 +0,0 @@
using Core;
using Core.DTO;
using ICSharpCode.SharpZipLib.Core;
using ICSharpCode.SharpZipLib.Zip;
using LiMan.APi.Data;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Configuration;
using NLog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.APi.Controllers
{
[Route("api/apptask")]
[ApiController]
public class AppTaskController : ControllerBase
{
#region Public Constructors
/// <summary>
/// Init generico
/// </summary>
/// <param name="configuration"></param>
/// <param name="DataService"></param>
/// <param name="env"></param>
public AppTaskController(IConfiguration configuration, ApiDataService DataService, IWebHostEnvironment env)
{
_configuration = configuration;
this.env = env;
dataService = DataService;
Log.Info("Avviata classe TaskController");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Elimina tutte le registrazioni req/run/done x device
/// </summary>
/// <param name="dev">dev richiedente</param>
/// <param name="CurrReq">Obj AuthDataDTO con chiavi (master o app)</param>
[HttpDelete("cleanup/{dev}")]
public async Task<Dictionary<string, string>> TaskClearAll(string dev, [FromBody] TaskResultDTO CurrReq)
{
Dictionary<string, string> result = new Dictionary<string, string>();
// verifica validità richiesta...
if (CurrReq.IsValid)
{
// FixMe ToDo !!! effettuare verifica valori chiavi/imp/device...
// elimina tutte le richieste x la macchina...
var rawData = dataService.TaskListReset(CurrReq.CodImp);
// registro updater...
dataService.UpdaterRecordAction(CurrReq.CodImp, "TaskClearAll");
if (rawData != null)
{
result = rawData;
}
// salva in redis e toglie dai task da eseguire la richiesta relativa...
// registro infine chiamata
await dataService.recordCall(dev, CurrReq.CodImp, $"POST:api/apptask/clear/ | {CurrReq.MastKey} | {CurrReq.CodImp}");
}
return result;
}
/// <summary>
/// Richiede elenco di task da eseguire x il dev richiedente
/// </summary>
/// <param name="dev">dev richiedente</param>
/// <param name="AppKey">Cod Auth applicativo</param>
/// <param name="CodImp">CodImp del dev</param>
[HttpGet("pend/{dev}")]
public async Task<Dictionary<string, string>> TaskGetPending(string dev, [FromHeader] string AppKey, [FromHeader] string CodImp)
//public async Task<ActionResult<Dictionary<string, string>>> TaskGetPending(string dev, [FromHeader] string CodInst, [FromHeader] string CodImp)
{
Dictionary<string, string> result = new Dictionary<string, string>();
// verifica validità richiesta...
if (!string.IsNullOrEmpty(AppKey) && !string.IsNullOrEmpty(CodImp))
{
// FixMe ToDo !!! effettuare verifica valori chiavi/imp/device...
// recupero da REDIS le richieste pending x la macchina...
result = dataService.TaskListGet(CodImp);
// registro updater...
dataService.UpdaterRecordAction(CodImp, "TaskGetPending");
// registro infine chiamata
await dataService.recordCall(dev, CodImp, $"POST:api/apptask/pending/ | {dev} | {CodImp} | {AppKey}");
}
return result;
}
/// <summary>
/// Registra risultato esecuzione task richiesti al device
/// </summary>
/// <param name="dev">dev richiedente</param>
/// <param name="CurrReq">Obj AuthDataDTO con chiavi (master o app)</param>
[HttpPost("done/{dev}")]
public async Task<string> TaskSetDone(string dev, [FromBody] TaskResultDTO CurrReq)
{
string result = "NA";
// verifica validità richiesta...
if (CurrReq.IsValid)
{
// FixMe ToDo !!! effettuare verifica valori chiavi/imp/device...
// recupero da REDIS le richieste pending x la macchina...
int numDone = dataService.TaskSetDone(CurrReq.CodImp, CurrReq.DataPayload);
// registro updater...
dataService.UpdaterRecordAction(CurrReq.CodImp, "TaskSetDone");
result = $"saved {numDone}/{CurrReq.DataPayload.Count}";
// salva in redis e toglie dai task da eseguire la richiesta relativa...
// registro infine chiamata
await dataService.recordCall(CurrReq.CodImp, CurrReq.CodImp, $"POST:api/apptask/done/ | {CurrReq.MastKey} | {CurrReq.CodImp}");
}
return result;
}
/// <summary>
/// Registra in esecuzione itask richiesti al device
/// </summary>
/// <param name="dev">dev richiedente</param>
/// <param name="CurrReq">Obj AuthDataDTO con chiavi (master o app)</param>
[HttpPost("running/{dev}")]
public async Task<string> TaskSetRunning(string dev, [FromBody] TaskResultDTO CurrReq)
{
string result = "NA";
// verifica validità richiesta...
if (CurrReq.IsValid)
{
// FixMe ToDo !!! effettuare verifica valori chiavi/imp/device...
// recupero da REDIS le richieste pending x la macchina...
int numDone = dataService.TaskSetRunning(CurrReq.CodImp, CurrReq.DataPayload);
// registro updater...
dataService.UpdaterRecordAction(CurrReq.CodImp, "TaskSetRunning");
result = $"saved {numDone}/{CurrReq.DataPayload.Count}";
// registro infine chiamata
await dataService.recordCall(dev, CurrReq.CodImp, $"POST:api/apptask/running/ | {CurrReq.MastKey} | {CurrReq.CodImp}");
}
return result;
}
/// <summary>
/// Caricamento file backup applicativo in formato ZIP via FORM POST (backup configurazione applicativo)
/// </summary>
/// <param name="CodApp">Applicazione di riferimento</param>
/// <param name="AppKey">Chiave istanza</param>
/// <param name="CodImp">CodImpiego istanza</param>
/// <param name="DoUnzip">Richiesta UnZip file post caricamento</param>
/// <param name="ForceApprov">Richiesta di approvazione salvataggio files modificati post upload + unzip</param>
/// <param name="ZipFile">File da caricare ed estrarre</param>
/// <returns></returns>
[HttpPost("zipbackup")]
public async Task<ActionResult<UploadResult>> ZipFileSaveExtract([FromForm] string CodApp,
[FromForm] string AppKey,
[FromForm] string CodImp,
[FromForm] bool DoUnzip,
[FromForm] bool ForceApprov,
[FromForm] IFormFile ZipFile)
{
// preparo oggetti x risposta
var resourcePath = new Uri($"{Request.Scheme}://{Request.Host}/api/filesave/");
List<UploadResult> uploadResults = new List<UploadResult>();
var uploadResult = new UploadResult();
string CodInst = "";
// max 20 mb
long maxFileSize = 1024 * 1024 * 20;
// in primis verifica CodImp e AppKey
var sLicList = await SubLicGet(AppKey, CodImp);
if (sLicList == null || sLicList.Count == 0)
{
Log.Error($"ZipUpload backup failed: received code not validated | CodApp: {CodApp} | AppKey: {AppKey} | CodImp: {CodImp}");
uploadResult.ErrorCode = 3;
}
else
{
var fRec = sLicList.FirstOrDefault();
if (fRec == null || fRec.LicenzaNav == null)
{
Log.Error($"ZipUpload backup failed: Impossible to find CodInst for current data | CodApp: {CodApp} | AppKey: {AppKey} | CodImp: {CodImp}");
uploadResult.ErrorCode = 4;
}
else
{
CodInst = fRec.LicenzaNav.CodInst;
string fileDir = env.ContentRootPath;
string relDir = env.EnvironmentName;
string authKey = "";
uploadResult.FileName = ZipFile.FileName;
// controllo size e procedo
if (ZipFile.Length == 0)
{
Log.Info($"{ZipFile.FileName} length is 0 (Err: 1)");
uploadResult.ErrorCode = 1;
}
else if (ZipFile.Length > maxFileSize)
{
Log.Info($"{ZipFile.FileName} of {CalcSize(ZipFile.Length)} is larger than the limit of {CalcSize(maxFileSize)} (Err: 2)");
uploadResult.ErrorCode = 2;
}
else
{
try
{
relDir = _configuration["ServerConf:FileShareAppBackup"];
fileDir = Path.Combine(relDir, CodApp, CodInst);
if (!Directory.Exists(fileDir))
{
Directory.CreateDirectory(fileDir);
}
var filePath = Path.Combine(fileDir, ZipFile.FileName);
// elimino se ci fosse già il file...
if (System.IO.File.Exists(filePath))
{
System.IO.File.Delete(filePath);
}
// salvo da filestream a file locale
using (FileStream fs = new(filePath, FileMode.Create))
{
await ZipFile.CopyToAsync(fs);
}
// log!
Log.Info($"{ZipFile.FileName} saved at {filePath}");
uploadResult.Uploaded = true;
uploadResult.StoredFileName = ZipFile.FileName;
// se richiesto unzip eseguo
if (DoUnzip)
{
bool extractDone = false;
// recupero applicativi connessi
var listLic = await dataService.AppDtoSearch(CodInst, CodApp, false);
var currLic = listLic.Where(x => x.IsActive).FirstOrDefault();
// procedo SOLO SE ho una licenza attiva x questo cliente
if (currLic != null)
{
// esegue unzip
await Task.Run(() =>
{
System.IO.Compression.ZipFile.ExtractToDirectory(filePath, fileDir, true);
});
extractDone = true;
// elimino zip e altro...
if (extractDone)
{
System.IO.File.Delete(filePath);
}
// se richiesta auto approvazione eseguo...
string reqAppFile = Path.Combine(fileDir, "ChangeApprove.req");
if (System.IO.File.Exists(reqAppFile))
{
System.IO.File.Delete(reqAppFile);
}
if (ForceApprov)
{
// FixMe ToDo !!!
// deve chiamare metodo x approvare, in MP-PROG, la directory dei
// documenti caricati.. x ora segnaposto con file (così se scansiona
// trova e approva)...
System.IO.File.WriteAllText(reqAppFile, authKey);
}
}
}
}
catch (IOException ex)
{
Log.Error($"{ZipFile.FileName} error on upload (Err: 3): {ex.Message}");
uploadResult.ErrorCode = 3;
}
}
Log.Info($"ZipUpload backup completed | CodInst: {CodInst} | CodApp: {CodApp} | {uploadResults.Count} files");
}
}
uploadResults.Add(uploadResult);
// registro updater...
dataService.UpdaterRecordAction(CodImp, "ZipFileSaveExtract");
return new CreatedResult(resourcePath, uploadResult);
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected ApiDataService dataService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Restituisce size calcolata
/// </summary>
/// <param name="origSize"></param>
/// <returns></returns>
protected string CalcSize(long origSize)
{
return MeasureUtils.SizeSuffix(origSize, 1);
}
#endregion Protected Methods
#region Private Fields
private static IConfiguration _configuration;
/// <summary>
/// Classe per logging
/// </summary>
private static Logger Log = LogManager.GetCurrentClassLogger();
private readonly IWebHostEnvironment env;
#endregion Private Fields
#region Private Methods
/// <summary>
/// Verifica validità codici
/// </summary>
/// <param name="AppKey"></param>
/// <param name="CodImp"></param>
/// <returns></returns>
private async Task<List<DB.DBModels.SubLicenzaModel>> SubLicGet(string AppKey, string CodImp)
{
List<DB.DBModels.SubLicenzaModel> listRes = await dataService.AttivazioniGetAppImp(AppKey, CodImp);
return listRes;
}
#endregion Private Methods
}
}
@@ -60,7 +60,7 @@ namespace LiMan.APi.Controllers
[HttpGet("{id}")]
public async Task<List<DB.DTO.ApplicativoDTO>> Get(string id, string CodApp)
{
var result = await dataService.AppDtoSearch(id, CodApp, true);
var result = await dataService.ApplicativiSearch(id, CodApp, true);
await dataService.recordCall(id, CodApp, $"GET:api/applicazione");
return result;
}
@@ -93,10 +93,9 @@ namespace LiMan.APi.Controllers
public async Task<List<DB.DTO.AttivazioneDTO>> Post([FromBody] UserLicenseRequest CurrRequest)
{
List<DB.DTO.AttivazioneDTO> currData = new List<DB.DTO.AttivazioneDTO>();
// giorni veto riattivazione: 60 x lic utente GPW, 7 altrimenti
int dayVeto = CurrRequest.LicType == Core.Enum.TipoLicenza.UserKey ? 60 : 7;
// eseguo tentativo generazione attivazioni da licenza...
bool done = await dataService.AttivazioniTryAdd(CurrRequest.MasterKey, CurrRequest.ParamDict, dayVeto, CurrRequest.LicType);
bool done = await dataService.AttivazioniTryAdd(CurrRequest.MasterKey, CurrRequest.ParamDict, 60);
currData = await dataService.AttivazioniByMasterKey(CurrRequest.MasterKey, false);
// se ho qualcosa da loggare...
foreach (var item in CurrRequest.ParamDict)
@@ -148,7 +147,7 @@ namespace LiMan.APi.Controllers
/// <param name="chiave">Licenza MASTER</param>
/// <param name="codImpiego">Codice univoco impiego licenza</param>
/// <returns></returns>
// GET api/attivazioni/verifica/5?codImpiego=abcd
// GET api/attivazioni/verifica/5
[HttpGet("verifica")]
public async Task<DB.DTO.AttivazioneDTO> VerificaImpiego(string chiave, string codImpiego)
{
-137
View File
@@ -1,137 +0,0 @@
using Core;
using LiMan.APi.Data;
using LiMan.DB.DBModels;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Newtonsoft.Json;
using NLog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.APi.Controllers
{
/// <summary>
/// Controller livello APPLICAZIONE
/// </summary>
[Route("api/enroller")]
[ApiController]
public class EnrollerController : ControllerBase
{
#region Public Constructors
/// <summary>
/// Init generico
/// </summary>
/// <param name="DataService"></param>
public EnrollerController(ApiDataService DataService)
{
dataService = DataService;
Log.Info("Avviata classe ApplicazioneController");
}
#endregion Public Constructors
#region Public Methods
/// <summary>
/// Recupera record di enroll di una richiesta x ricavarne ID licenza da applicare
/// </summary>
/// <param name="id">ID richiesta</param>
/// <param name="passcode">passcode associato</param>
/// <returns></returns>
[HttpGet("{id}")]
public async Task<EnrollRequestModel> Get(string id, int passcode)
{
string CodInst = "NA";
string CodApp = "Updater";
int reqId = 0;
int.TryParse(id, out reqId);
EnrollRequestModel reqRec = await dataService.EnrollReqGetById(reqId);
// solo se il passcode è corretto restituisco record, altrimenti fake one...
if (reqRec != null && reqRec.Passcode != passcode)
{
reqRec = new EnrollRequestModel() { IdReq = reqId };
}
await dataService.recordCall(CodInst, CodApp, $"GET:api/enroller/{id}");
return reqRec;
}
/// <summary>
/// Recupera record della licenza (mainKey) associata ad una richiesta date le sue info ID, passcode, ID licenza asegnata
/// </summary>
/// <param name="id">ID richiesta</param>
/// <param name="passcode">passcode associato</param>
/// <param name="idLic">ID licenza associato</param>
/// <returns></returns>
[HttpGet("getLicense/{id}")]
public async Task<LicenzaModel> GetLicData(string id, int passcode, int idLic)
{
string CodInst = "NA";
string CodApp = "Updater";
int reqId = 0;
int.TryParse(id, out reqId);
EnrollRequestModel reqRec = await dataService.EnrollReqGetById(reqId);
// init licenza non valida
LicenzaModel licRec = new LicenzaModel()
{
IdxLic = idLic,
Chiave = "",
CodInst = "NA",
CodApp = "None",
NumLicenze = 0,
Scadenza = DateTime.Today.AddYears(-1),
Payload = "",
Enigma = ""
};
// solo se sono corretti passcode e idLic corretto restituisco record, altrimenti fake one...
if (reqRec != null && reqRec.Passcode == passcode && reqRec.IdxLic == idLic)
{
licRec = await dataService.LicenzaById(idLic);
CodInst = licRec.CodInst;
CodApp = licRec.CodApp;
}
await dataService.recordCall(CodInst, CodApp, $"GET:api/enroller/getLicense/{id}");
return licRec;
}
/// <summary>
/// Richiesta di un record con codice TOTP per l'enroll di un app client
/// </summary>
[HttpPost("getNewEnrollRec")]
public async Task<EnrollRequestModel> GetNewEnrollRec([FromBody] Dictionary<string, string> MachineInfo)
{
string CodInst = "NA";
string CodApp = "Updater";
var newRec = await dataService.EnrollReqCreate(MachineInfo);
await dataService.recordCall(CodInst, CodApp, $"GET:api/enroller/GetEnrollRec");
return newRec;
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected ApiDataService dataService { get; set; }
#endregion Protected Properties
#region Private Fields
/// <summary>
/// Classe per logging
/// </summary>
private static Logger Log = LogManager.GetCurrentClassLogger();
/// <summary>
/// Generatore pseudocasuale
/// </summary>
private Random rnd = new Random();
#endregion Private Fields
}
}
+49 -205
View File
@@ -1,6 +1,4 @@
using Core;
using ICSharpCode.SharpZipLib.Core;
using ICSharpCode.SharpZipLib.Zip;
using LiMan.APi.Data;
using LiMan.DB.DBModels;
using Microsoft.AspNetCore.Hosting;
@@ -12,7 +10,6 @@ using NLog;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Threading.Tasks;
@@ -25,6 +22,19 @@ namespace LiMan.APi.Controllers
[Route("api/filesave")]
public class FilesaveController : ControllerBase
{
#region Private Fields
private static IConfiguration _configuration;
/// <summary>
/// Classe per logging
/// </summary>
private static NLog.Logger Log = LogManager.GetCurrentClassLogger();
private readonly IWebHostEnvironment env;
#endregion Private Fields
#region Public Constructors
/// <summary>
@@ -43,6 +53,35 @@ namespace LiMan.APi.Controllers
#endregion Public Constructors
#region Protected Properties
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected ApiDataService dataService { get; set; }
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Calcolo correetto mimetype da nome file
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
protected string GetMimeType(string fileName)
{
var provider = new FileExtensionContentTypeProvider();
string contentType;
if (!provider.TryGetContentType(fileName, out contentType))
{
contentType = "application/octet-stream";
}
return contentType;
}
#endregion Protected Methods
#region Public Methods
/// GET api/filesave/id/filename
@@ -56,7 +95,7 @@ namespace LiMan.APi.Controllers
[HttpGet("{id}/{secureName}/{fileName}")]
public async Task<ActionResult> DownloadFile(string id, string secureName, string fileName)
{
string relDir = _configuration["ServerConf:FileShareTickets"];
string relDir = _configuration["FileShare"];
string ticketDir = Path.Combine(relDir, id);
var filePath = Path.Combine(ticketDir, secureName);
// verifico esistenza..
@@ -72,11 +111,12 @@ namespace LiMan.APi.Controllers
}
/// <summary>
/// Elenco files associati a ticket supporto POST api/filesave/list/1
/// Elenco files assaociati a ticket supporto
/// </summary>
/// <param name="id"></param>
/// <param name="CurrRequest"></param>
/// <returns></returns>
// POST api/filesave/list/1
[HttpPost("list/{id}")]
public async Task<List<FileAttachModel>> list(int id, [FromBody] SupportRequest CurrRequest)
{
@@ -128,7 +168,7 @@ namespace LiMan.APi.Controllers
}
else if (file.Length > maxFileSize)
{
Log.Info($"{trustedFileNameForDisplay} of {CalcSize(file.Length)} is larger than the limit of {CalcSize(maxFileSize)} (Err: 2)");
Log.Info($"{trustedFileNameForDisplay} of {file.Length} bytes is larger than the limit of {maxFileSize} bytes (Err: 2)");
uploadResult.ErrorCode = 2;
}
else
@@ -137,7 +177,7 @@ namespace LiMan.APi.Controllers
{
DateTime oggi = DateTime.Today;
trustedFileNameForFileStorage = Path.GetRandomFileName();
relDir = _configuration["ServerConf:FileShareTickets"];
relDir = _configuration["FileShare"];
fileDir = Path.Combine(relDir, ticketDir);
if (!Directory.Exists(fileDir))
{
@@ -206,7 +246,7 @@ namespace LiMan.APi.Controllers
}
else if (file.Length > maxFileSize)
{
Log.Info($"{trustedFileNameForDisplay} of {CalcSize(file.Length)} is larger than the limit of {CalcSize(maxFileSize)} (Err: 2)");
Log.Info($"{trustedFileNameForDisplay} of {file.Length} bytes is larger than the limit of {maxFileSize} bytes (Err: 2)");
uploadResult.ErrorCode = 2;
}
else
@@ -215,7 +255,7 @@ namespace LiMan.APi.Controllers
{
DateTime oggi = DateTime.Today;
trustedFileNameForFileStorage = Path.GetRandomFileName();
relDir = _configuration["ServerConf:FileShareTickets"];
relDir = _configuration["FileShare"];
fileDir = Path.Combine(relDir, ticketDir);
if (!Directory.Exists(fileDir))
{
@@ -245,202 +285,6 @@ namespace LiMan.APi.Controllers
return new CreatedResult(resourcePath, uploadResult);
}
/// <summary>
/// Caricamento file backup applicativo in formato ZIP via FORM POST (backup configurazione applicativo, file protetto da masterKey)
/// </summary>
/// <param name="CodApp">Applicazione di riferimento</param>
/// <param name="CodInst">Installazione di riferimento</param>
/// <param name="DoUnzip">Richiesta UnZip file post caricamento</param>
/// <param name="ForceApprov">
/// Richiesta di approvazione salvataggio files modificati post upload + unzip
/// </param>
/// <param name="ZipFile">File da caricare ed estrarre</param>
/// <returns></returns>
[HttpPost("zipbackup")]
public async Task<ActionResult<UploadResult>> PostZipFile([FromForm] string CodApp, [FromForm] string CodInst, [FromForm] bool DoUnzip, [FromForm] bool ForceApprov, [FromForm] IFormFile ZipFile)
{
// max 200 mb
long maxFileSize = 1024 * 1024 * 200;
// preparo oggetti x risposta
var resourcePath = new Uri($"{Request.Scheme}://{Request.Host}/api/filesave/");
List<UploadResult> uploadResults = new List<UploadResult>();
string fileDir = env.ContentRootPath;
string relDir = env.EnvironmentName;
string authKey = "";
var uploadResult = new UploadResult();
uploadResult.FileName = ZipFile.FileName;
// controllo size e procedo
if (ZipFile.Length == 0)
{
Log.Info($"{ZipFile.FileName} length is 0 (Err: 1)");
uploadResult.ErrorCode = 1;
}
else if (ZipFile.Length > maxFileSize)
{
Log.Info($"{ZipFile.FileName} of {CalcSize(ZipFile.Length)} is larger than the limit of {CalcSize(maxFileSize)} (Err: 2)");
uploadResult.ErrorCode = 2;
}
else
{
try
{
DateTime oggi = DateTime.Today;
relDir = _configuration["ServerConf:FileShareAppBackup"];
fileDir = Path.Combine(relDir, CodApp, CodInst);
if (!Directory.Exists(fileDir))
{
Directory.CreateDirectory(fileDir);
}
var filePath = Path.Combine(fileDir, ZipFile.FileName);
// elimino se ci fosse già il file...
if (System.IO.File.Exists(filePath))
{
System.IO.File.Delete(filePath);
}
// salvo da filestream a file locale
using (FileStream fs = new(filePath, FileMode.Create))
{
await ZipFile.CopyToAsync(fs);
}
// log!
Log.Info($"{ZipFile.FileName} saved at {filePath}");
uploadResult.Uploaded = true;
uploadResult.StoredFileName = ZipFile.FileName;
// se richiesto unzip eseguo
if (DoUnzip)
{
bool extractDone = false;
// recupero applicativi connessi
var listLic = await dataService.AppDtoSearch(CodInst, CodApp, false);
var currLic = listLic.Where(x => x.IsActive).FirstOrDefault();
// procedo SOLO SE ho una licenza attiva x questo cliente
if (currLic != null)
{
//recupero authKey
authKey = currLic.Chiave;
using (ZipFile zf = new ZipFile(filePath))
{
zf.Password = authKey;
foreach (ZipEntry zipEntry in zf)
{
// Manipulate the output filename here as desired.
var entryFileName = zipEntry.Name;
var fullZipToPath = Path.Combine(fileDir, entryFileName);
Console.WriteLine(zipEntry.Name);
if (!zipEntry.IsFile)
{
Directory.CreateDirectory(fullZipToPath);
// Ignore directories
continue;
}
// 4K is optimum
var buffer = new byte[4096];
// Unzip file in buffered chunks. This is just as fast as
// unpacking to a buffer the full size of the file, but does not
// waste memory. The "using" will close the stream even if an
// exception occurs.
using (var zipStream = zf.GetInputStream(zipEntry))
{
using (Stream fsOutput = System.IO.File.Create(fullZipToPath))
{
StreamUtils.Copy(zipStream, fsOutput, buffer);
}
}
extractDone = true;
}
}
// elimino zip e altro...
if (extractDone)
{
System.IO.File.Delete(filePath);
}
// se richiesta auto approvazione eseguo...
string reqAppFile = Path.Combine(fileDir, "ChangeApprove.req");
if (System.IO.File.Exists(reqAppFile))
{
System.IO.File.Delete(reqAppFile);
}
if (ForceApprov)
{
// FixMe ToDo !!!
// deve chiamare metodo x approvare, in MP-PROG, la directory dei
// documenti caricati.. x ora segnaposto con file (così se scansiona
// trova e approva)...
System.IO.File.WriteAllText(reqAppFile, authKey);
}
}
}
}
catch (IOException ex)
{
Log.Error($"{ZipFile.FileName} error on upload (Err: 3): {ex.Message}");
uploadResult.ErrorCode = 3;
}
}
uploadResults.Add(uploadResult);
Log.Info($"ZipUpload backup completed | CodInst: {CodInst} | CodApp: {CodApp} | {uploadResults.Count} files");
return new CreatedResult(resourcePath, uploadResult);
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Dataservice x accesso DB
/// </summary>
protected ApiDataService dataService { get; set; }
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Restituisce size calcolata
/// </summary>
/// <param name="origSize"></param>
/// <returns></returns>
protected string CalcSize(long origSize)
{
return MeasureUtils.SizeSuffix(origSize, 1);
}
/// <summary>
/// Calcolo correetto mimetype da nome file
/// </summary>
/// <param name="fileName"></param>
/// <returns></returns>
protected string GetMimeType(string fileName)
{
var provider = new FileExtensionContentTypeProvider();
string contentType;
if (!provider.TryGetContentType(fileName, out contentType))
{
contentType = "application/octet-stream";
}
return contentType;
}
#endregion Protected Methods
#region Private Fields
private static IConfiguration _configuration;
/// <summary>
/// Classe per logging
/// </summary>
private static Logger Log = LogManager.GetCurrentClassLogger();
private readonly IWebHostEnvironment env;
#endregion Private Fields
}
}
+2 -1
View File
@@ -56,8 +56,9 @@ namespace LiMan.APi.Controllers
/// </summary>
/// <returns></returns>
[HttpGet]
public ActionResult<string> Get()
public async Task<string> Get()
{
await Task.Delay(1);
return "OK";
}
+13 -42
View File
@@ -41,13 +41,13 @@ namespace LiMan.APi.Controllers
/// <summary>
/// Recupera dati Licenza Applicativa (id licenza + num utenze) dati cliente + programma + licenza ATTUALE
///
/// GET api/licenza/id?CodApp=xxx&Chiave=yyyy
///
/// </summary>
/// <param name="id">Codice cliente/Installazione</param>
/// <param name="CodApp">Codice Applicazione</param>
/// <param name="CodApp">Codice Applicazione</param>
/// <param name="Chiave">Chiave licenza da validare</param>
/// <returns></returns>
// GET api/licenza/id?CodApp=xxx&Chiave=yyyy
[HttpGet("{id}")]
public async Task<List<DB.DTO.ApplicativoDTO>> Get(string id, string CodApp, string Chiave)
{
@@ -99,36 +99,13 @@ namespace LiMan.APi.Controllers
string msgTopic = "LiMan: verifica Licenze in scadenza";
// invio email
string destList = _configuration["MailDest:ExpiryNotify"];
await sendEmailExpiry(destList, msgTopic, msgBody.Replace($"{Environment.NewLine}", "<br/>"));
await sendEmail(msgTopic, msgBody.Replace($"{Environment.NewLine}", "<br/>"));
// ritorno solo LOG azioni
answ = $"Scadute {numScadute} | Settimana: {numWeek} | Mese: {numMonth} | Trimestre: {numTrim}";
return answ;
}
/// <summary>
/// Effettua test invio email
/// </summary>
/// <returns></returns>
[HttpGet("test-email")]
public async Task<string> TestEmail()
{
// oggetti base
string answ = "ND";
string msgBody = "Prova invio email a destinatari <b>MailDest:ExpiryNotify</b>";
// predispongo email
string msgTopic = "LiMan: Test invio email!";
// invio email
string destList = _configuration["MailDest:ExpiryNotify"];
await sendEmailExpiry(destList, msgTopic, msgBody.Replace($"{Environment.NewLine}", "<br/>"));
// ritorno solo LOG azioni
answ = $"Test effettuato!";
return answ;
}
/// POST api/licenza
/// <summary>
/// Recupera dati Licenza Applicativa (id licenza + num utenze) dati cliente + programma +
@@ -234,36 +211,30 @@ namespace LiMan.APi.Controllers
if (elencoLicenze.Count == 0)
{
doLog($"&nbsp;- nessuna", logType.info, ref sbMain);
}
else
else {
foreach (var item in elencoLicenze)
{
foreach (var item in elencoLicenze)
{
doLog($"&nbsp;- {item.Scadenza:yyyy.MM.dd} | <b>{item.CodInst}</b> | {item.Descrizione}", logType.info, ref sbMain);
}
doLog($"&nbsp;- {item.Scadenza:yyyy.MM.dd} | <b>{item.CodInst}</b> | {item.Descrizione}", logType.info, ref sbMain);
}
}
doLog("</div>", logType.none, ref sbMain);
doLog("</div>", logType.none, ref sbMain);
return sbMain.ToString();
}
/// <summary>
/// Invio email a lista ExpiryNotify
/// </summary>
/// <param name="destList">Elenco destinatari comma separated</param>
/// <param name="subject">Oggetto Email</param>
/// <param name="message">MEssaggio</param>
/// <returns></returns>
protected async Task sendEmailExpiry(string destList, string subject, string message)
protected async Task sendEmail(string subject, string message)
{
List<string> emailDestList = destList.Split(",").ToList();
string emailRaw = _configuration["MailDest:ExpiryNotify"];
List<string> emailDestList = emailRaw.Split(",").ToList();
foreach (var dest in emailDestList)
{
try
{
await _emailSender.SendEmailAsync(dest, subject, message);
}
catch (Exception exc)
catch(Exception exc)
{
Log.Error($"Eccezione durante invio email:{Environment.NewLine}dest: {dest} | subject {subject}{Environment.NewLine}{exc}");
}
+12 -339
View File
@@ -1,17 +1,10 @@
using Core.DTO;
using Core;
using LiMan.APi.Data;
using LiMan.APi.Data;
using LiMan.DB.DTO;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using NLog;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;
using LiMan.DB.DBModels;
using Microsoft.Extensions.Configuration;
using Org.BouncyCastle.Asn1.Crmf;
using System;
namespace LiMan.APi.Controllers
{
@@ -39,293 +32,47 @@ namespace LiMan.APi.Controllers
#region Public Methods
/// <summary>
/// Recupera elenco dati Release (rilasciate) GET api/release/EgtBW
/// Recupera elenco dati licenza Applicativi (completo)
/// GET api/Release/EgtBW
/// </summary>
/// <param name="id">Codice Applicazione</param>
/// <returns></returns>
[HttpGet("{id}")]
[Obsolete("Please use POST with api/release/getall instead.", false)]
public async Task<List<ReleaseDTO>> Get(string id)
{
var result = await dataService.ReleaseDtoGetByApp(id);
await dataService.recordCall(id, id, $"GET:api/release/{id}");
var result = await dataService.ReleaseGetByApp(id);
await dataService.recordCall(id, id, $"GET:api/Release/{id}");
return result;
}
/// <summary>
/// Recupera elenco dati Release (rilasciate) data versione minima GET api/release/filt/EgtBW
/// Recupera elenco dati licenza Applicativi data versione minima
/// GET api/Release/EgtBW
/// </summary>
/// <param name="id">Codice Applicazione</param>
/// <param name="VersMin">Versione minima richiesta (attuale)</param>
/// <returns></returns>
[HttpGet("filt/{id}")]
[Obsolete("Please use POST with api/release/getfilt instead.", false)]
public async Task<List<ReleaseDTO>> GetFilt(string id, string VersMin)
{
var result = await dataService.ReleaseDtoGetByAppVers(id, VersMin);
Log.Warn($"Chiamato metodo legacy api/release/filt | id: {id} | vers: {VersMin}");
await dataService.recordCall(id, id, $"GET:api/release/filt/{id}");
var result = await dataService.ReleaseGetByAppVers(id, VersMin);
await dataService.recordCall(id, id, $"GET:api/Release/filt/{id}");
return result;
}
/// <summary>
/// Recupera elenco dati Release (rilasciate) data versione minima e massima GET api/release/filtLimit/EgtBW
/// Recupera elenco dati licenza Applicativi data versione minima + vers limite
/// GET api/Release/EgtBW
/// </summary>
/// <param name="id">Codice Applicazione</param>
/// <param name="VersMin">Versione minima richiesta (attuale)</param>
/// <param name="VersMax">Versione massima consentita</param>
/// <returns></returns>
[HttpGet("filtLimit/{id}")]
[Obsolete("Please use POST with api/release/getlimit instead.", false)]
public async Task<List<ReleaseDTO>> GetFiltLimit(string id, string VersMin, string VersMax)
{
var result = await dataService.ReleaseGetByAppVersLimit(id, VersMin, VersMax);
await dataService.recordCall(id, id, $"GET:api/release/filtLimit/{id}");
return result;
}
/// <summary>
/// Recupera elenco dati Release (rilasciate) POST api/release/getall
/// </summary>
/// <param name="CurrReq">Obj ReleaseReqDTO con chiavi (master o app)</param>
[HttpPost("getall")]
public async Task<List<ReleaseDTO>> GetReleases([FromBody] ReleaseReqDTO CurrReq)
{
List<ReleaseDTO> result = new List<ReleaseDTO>();
// verifica validità richiesta...
if (CheckReqKeys(CurrReq))
{
result = await dataService.ReleaseDtoGetByApp(CurrReq.CodApp);
// non necessario notificare UI...
#if false
// invio notifica x app...
dataService.UpdActMessPipe.sendMessage(CurrReq.CodImp);
#endif
// registro updater...
dataService.UpdaterRecordAction(CurrReq.CodImp, "GetReleases");
await dataService.recordCall(CurrReq.CodApp, CurrReq.CodApp, $"POST:api/release/getall/ | {CurrReq.MastKey} | {CurrReq.CodImp} | {CurrReq.CodApp}");
}
return result;
}
/// <summary>
/// Recupera elenco dati Release CRITICHE rilasciate (se sono ultima per singola CodApp)
/// POST api/release/get-critical
/// </summary>
/// <param name="CurrReq">Obj ReleaseReqDTO con chiavi (master o app)</param>
[HttpPost("getcritical")]
public async Task<Dictionary<string, ReleaseDTO>> GetReleasesCritical([FromBody] ReleaseReqDTO CurrReq)
{
Dictionary<string, ReleaseDTO> result = new Dictionary<string, ReleaseDTO>();
// verifica validità richiesta...
if (CheckReqKeys(CurrReq))
{
result = await dataService.ReleaseGetCritical();
// non necessario notificare UI...
#if false
// invio notifica x app...
dataService.UpdActMessPipe.sendMessage(CurrReq.CodImp);
#endif
// registro updater...
dataService.UpdaterRecordAction(CurrReq.CodImp, "GetReleasesCritical");
await dataService.recordCall(CurrReq.CodApp, CurrReq.CodApp, $"POST:api/release/getcritical/ | {CurrReq.MastKey} | {CurrReq.CodImp} | {CurrReq.CodApp}");
}
return result;
}
/// <summary>
/// Recupera elenco dati Release (rilasciate) data versione minima POST api/release/getfilt
/// </summary>
/// <param name="CurrReq">Obj ReleaseReqDTO con chiavi (master o app)</param>
[HttpPost("getfilt")]
public async Task<List<ReleaseDTO>> GetReleasesFilt([FromBody] ReleaseReqDTO CurrReq)
{
List<ReleaseDTO> result = new List<ReleaseDTO>();
// verifica validità richiesta...
if (CheckReqKeys(CurrReq))
{
result = await dataService.ReleaseDtoGetByAppVers(CurrReq.CodApp, CurrReq.VersMin);
// registro stato applicativi (da richiesta...)
InstalledReleasesModel checkRec = new InstalledReleasesModel()
{
AppKey = CurrReq.AppKey,
CodApp = CurrReq.CodApp,
CodImp = CurrReq.CodImp,
DtCheck = DateTime.Now,
MastKey = CurrReq.MastKey,
NumImp = CurrReq.NumImp,
VersNum = CurrReq.VersMin
};
bool changed = dataService.InstallRelUpsert(checkRec);
// chiamata x effettuare eventuale snapshot sulle installazioni attive SE variato
await dataService.InstallRelHistSnapshot(changed);
if (changed)
{
// invio notifica x app...
dataService.UpdActMessPipe.sendMessage(CurrReq.CodImp);
}
// registro updater...
dataService.UpdaterRecordAction(CurrReq.CodImp, "GetReleasesFilt");
// registro infine chiamata
await dataService.recordCall(CurrReq.CodApp, CurrReq.CodApp, $"POST:api/release/getfilt/ | {CurrReq.MastKey} | {CurrReq.CodImp} | {CurrReq.CodApp}");
}
return result;
}
/// <summary>
/// Recupera elenco dati Release (rilasciate) data versione minima e massima POST api/release/getlimit
/// </summary>
/// <param name="CurrReq">Obj ReleaseReqDTO con chiavi (master o app)</param>
[HttpPost("getlimit")]
public async Task<List<ReleaseDTO>> GetReleasesLimit([FromBody] ReleaseReqDTO CurrReq)
{
List<ReleaseDTO> result = new List<ReleaseDTO>();
// verifica validità richiesta...
if (CheckReqKeys(CurrReq))
{
result = await dataService.ReleaseGetByAppVersLimit(CurrReq.CodApp, CurrReq.VersMin, CurrReq.VersMax);
#if false
// invio notifica x app...
dataService.UpdActMessPipe.sendMessage(CurrReq.CodImp);
#endif
// registro updater...
dataService.UpdaterRecordAction(CurrReq.CodImp, "GetReleasesLimit");
await dataService.recordCall(CurrReq.CodApp, CurrReq.CodApp, $"POST:api/release/getlimit/ | {CurrReq.MastKey} | {CurrReq.CodImp} | {CurrReq.CodApp}");
}
return result;
}
/// <summary>
/// Salva una nuova release dell'applicativo (eventualmente sovrascrivendo) POST api/release/save
/// </summary>
/// <param name="CurrReq">Obj Richiesta</param>
[HttpPost("save")]
public async Task<ReleaseDTO> SaveRelease([FromBody] AppRelVersion CurrReq)
{
ReleaseDTO result = new ReleaseDTO()
{
CodApp = CurrReq.CodApp,
ReleaseDate = CurrReq.ReleaseDate,
VersNum = CurrReq.VersNum,
VersText = CurrReq.VersText,
RelTags = CurrReq.RelTags.ToUpper()
};
// controllo valori
if (CurrReq.IsValid)
{
// verifica preliminare licenza x upload
var licUploader = await dataService.LicenzeSearch(CurrReq.CodInst, CurrReq.UplAppID, CurrReq.MasterKey, false);
if (licUploader != null && licUploader.Count > 0)
{
// in primis cerco app...
var appList = await dataService.ApplicNextGetAll(true);
ApplicativoModel recApp = new ApplicativoModel();
if (appList != null)
{
recApp = appList.FirstOrDefault(x => x.CodApp == CurrReq.CodApp);
}
// nel caso mancasse la aggiungo
if (recApp == null || string.IsNullOrEmpty(recApp.CodApp) || recApp.CodApp != CurrReq.CodApp)
{
recApp = new ApplicativoModel()
{
CodApp = CurrReq.CodApp,
Descrizione = "Nuova APP da POST api/release/save",
TplConnString = "",
Tipo = CurrReq.Tipo
};
await dataService.ApplicNextUpdate(recApp);
}
//converto in una release...
ReleaseModel newRec = new ReleaseModel()
{
CodApp = CurrReq.CodApp,
ReleaseDate = CurrReq.ReleaseDate,
RelTags = CurrReq.RelTags.ToUpper(),
VersNum = CurrReq.VersNum,
VersText = CurrReq.VersText
};
// registro versione eventualmente gestendo nuovo applicativo
var insRes = await dataService.ReleaseUpsert(newRec);
if (insRes)
{
Log.Info($"Release recorded | {CurrReq.CodApp} | {CurrReq.VersNum} | {CurrReq.VersText} | {CurrReq.ReleaseDate} | {CurrReq.RelTags}");
}
}
else
{
Log.Error($"Errore: licenza UpdateManager non TROVATA | {CurrReq.MasterKey}");
await dataService.recordCall(CurrReq.CodInst, CurrReq.CodApp, $"ERROR POST:api/release/save:{CurrReq.CodApp} | {CurrReq.MasterKey}");
}
// recupero vers applicativo...
var rawResult = await dataService.ReleaseDtoGetByApp(CurrReq.CodApp);
if (rawResult != null && rawResult.Count > 0)
{
result = rawResult.Where(x => x.VersText == CurrReq.VersText).FirstOrDefault();
}
// fisso nostra install
await dataService.recordCall(CurrReq.CodInst, CurrReq.CodApp, $"POST:api/release/save:{CurrReq.CodApp}");
}
else
{
Log.Error($"Errore: licenza UpdateManager non VALIDA | {CurrReq.MasterKey}");
await dataService.recordCall(CurrReq.CodInst, CurrReq.CodApp, $"ERROR POST:api/release/save:{CurrReq.CodApp} | {CurrReq.MasterKey}");
}
return result;
}
/// <summary>
/// Esegue tentativo salvataggio rel history
/// </summary>
/// <param name="CurrReq">Obj ReleaseReqDTO con chiavi (master o app)</param>
[HttpPost("save-history")]
public async Task<List<ReleaseDTO>> SaveRelHistory([FromBody] ReleaseReqDTO CurrReq)
{
List<ReleaseDTO> result = new List<ReleaseDTO>();
// verifica validità richiesta...
if (CheckReqKeys(CurrReq))
{
// chiamata x effettuare eventuale snapshot sulle installazioni attive
await dataService.InstallRelHistSnapshot(true);
// registro updater...
dataService.UpdaterRecordAction(CurrReq.CodImp, "SaveRelHistory");
// registro infine chiamata
await dataService.recordCall(CurrReq.CodApp, CurrReq.CodApp, $"POST:api/release/save-history/ | {CurrReq.MastKey} | {CurrReq.CodImp} | {CurrReq.CodApp}");
}
return result;
}
/// <summary>
/// Conferma quale sia l'elenco delle app gestite POST api/release/setmanaged
/// </summary>
/// <param name="CurrReq">Obj ManDeclareDTO con chiavi + elenco app gestite (x eliminare altre)</param>
/// <returns>Numero di record eliminati</returns>
[HttpPost("setmanaged")]
public async Task<int> SetManaged([FromBody] ManDeclareDTO CurrReq)
{
int result = 0;
// verifica validità richiesta...
if (CheckReqKeys(CurrReq))
{
result = dataService.InstallRelClean(CurrReq.CodImp, CurrReq.AppKey, CurrReq.ListCodApp);
// registro updater...
dataService.UpdaterRecordAction(CurrReq.CodImp, "SetManaged");
// invio notifica x app...
dataService.UpdActMessPipe.sendMessage(CurrReq.CodImp);
}
await Task.Delay(1);
await dataService.recordCall(id, id, $"GET:api/Release/filt/{id}");
return result;
}
@@ -348,79 +95,5 @@ namespace LiMan.APi.Controllers
private static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Private Fields
#region Private Methods
/// <summary>
/// Verifica validità richiesta
/// - dati presenti in chiamata
/// - combinazioni CodApp + chiavi valide/attive
/// </summary>
/// <param name="currReq"></param>
/// <returns></returns>
private bool CheckReqKeys(ReleaseReqDTO currReq)
{
bool answ = currReq.IsValid;
if (answ)
{
// verifica validità chiavi... TBD!!!
}
return answ;
}
/// <summary>
/// Verifica validità richiesta
/// - dati presenti in chiamata
/// - combinazioni CodApp + chiavi valide/attive
/// </summary>
/// <param name="currReq"></param>
/// <returns></returns>
private bool CheckReqKeys(AuthDataDTO currReq)
{
bool answ = currReq.IsValid;
if (answ)
{
// verifica validità chiavi... TBD!!!
}
return answ;
}
/// <summary>
/// Verifica validità richiesta
/// - dati presenti in chiamata
/// - combinazioni CodApp + chiavi valide/attive
/// </summary>
/// <param name="currReq"></param>
/// <returns></returns>
private bool CheckReqKeys(ManDeclareDTO currReq)
{
bool answ = currReq.IsValid;
if (answ)
{
// verifica validità chiavi... TBD!!!
}
return answ;
}
#endregion Private Methods
#if false
/// <summary>
/// Verifica validità richiesta
/// - dati presenti in chiamata
/// - combinazioni CodApp + chiavi valide/attive
/// </summary>
/// <param name="currReq"></param>
/// <returns></returns>
private bool CheckReqKeys(TaskResultDTO currReq)
{
bool answ = currReq.IsValid;
if (answ)
{
// verifica validità chiavi... TBD!!!
}
return answ;
}
#endif
}
}
File diff suppressed because it is too large Load Diff
+4 -10
View File
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
@@ -22,24 +22,21 @@
<ItemGroup>
<None Include="Properties\PublishProfiles\IIS01.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS02.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS03.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS04.pubxml.user" />
<None Include="Properties\PublishProfiles\IIS03.pubxml.user" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.StaticFiles" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.28" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NLog.Web.AspNetCore" Version="5.3.11" />
<PackageReference Include="SharpZipLib" Version="1.4.2" />
<PackageReference Include="StackExchange.Redis" Version="2.10.1" />
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
<PackageReference Include="StackExchange.Redis.Extensions.AspNetCore" Version="7.1.1" />
<PackageReference Include="StackExchange.Redis.Extensions.Newtonsoft" Version="7.1.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.5.0" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="6.6.2" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.36.0" />
<PackageReference Include="System.Text.Encodings.Web" Version="6.0.0" />
</ItemGroup>
@@ -57,7 +54,4 @@
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</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>
</Project>
@@ -1,27 +0,0 @@
<body>
<i>License Manager</i>
<h4>Versione: {{CURRENT-REL}}</h4>
<br /> Note di rilascio:
<ul>
<li>
<b>Ultime modifiche:</b>
<ul>{{LAST-CHANGES}}</ul>
</li>
<li>
<b>v.1.* &rarr;</b>
<ul>
<li>Nuova release dotnet6</li>
<li>Prima release dotnet5</li>
<li>Integrazione EFCore</li>
</ul>
</li>
</ul>
<div>
<div style="float: left;">
<img src="logoSteamware.png" />
</div>
<div style="float: right;">
<a href="https://www.steamware.net/" target="_blank">&copy; Steamware 2006-2021</a>
</div>
</div>
</body>
-27
View File
@@ -1,27 +0,0 @@
<body>
<i>License Manager</i>
<h4>Versione: 2.1.2512.0409</h4>
<br /> Note di rilascio:
<ul>
<li>
<b>Ultime modifiche:</b>
<ul>{{LAST-CHANGES}}</ul>
</li>
<li>
<b>v.1.* &rarr;</b>
<ul>
<li>Nuova release dotnet6</li>
<li>Prima release dotnet5</li>
<li>Integrazione EFCore</li>
</ul>
</li>
</ul>
<div>
<div style="float: left;">
<img src="logoSteamware.png" />
</div>
<div style="float: right;">
<a href="https://www.steamware.net/" target="_blank">&copy; Steamware 2006-2021</a>
</div>
</div>
</body>
-1
View File
@@ -1 +0,0 @@
2.1.2512.0409
Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.3 KiB

@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>1.0.0.0</version>
<url>https://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/{{PACKNAME}}.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/{{DIRNAME}}/{{BRANCHNAME}}/ChangeLog.html</changelog>
<mandatory>false</mandatory>
</item>
-7
View File
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.1.2512.0409</version>
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.UI.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
</item>
+12 -13
View File
@@ -73,12 +73,6 @@ namespace LiMan.Serv
EnableDirectoryBrowsing = true
//EnableDirectoryBrowsing = false
});
app.UseFileServer(new FileServerOptions
{
FileProvider = new PhysicalFileProvider(@"\\stor01\TEAM DRIVES\40_FileUpload\AppBackup"),
RequestPath = new PathString("/app_backup"),
EnableDirectoryBrowsing = false
});
}
else
{
@@ -89,12 +83,6 @@ namespace LiMan.Serv
EnableDirectoryBrowsing = true
//EnableDirectoryBrowsing = false
});
app.UseFileServer(new FileServerOptions
{
FileProvider = new PhysicalFileProvider(Path.Combine(env.ContentRootPath, "app_backup")),
RequestPath = new PathString("/app_backup"),
EnableDirectoryBrowsing = false
});
}
app.UseEndpoints(endpoints =>
@@ -117,17 +105,28 @@ namespace LiMan.Serv
// abilitazione x email management con MailKit
services.AddTransient<IEmailSender, MailKitEmailSender>();
// recupero email reversed
string revPwd = Configuration["ExternalProviders:MailKit:SMTP:Password"] ?? "";
string pwd = "";
foreach (char c in revPwd)
{
pwd = c + pwd;
}
services.Configure<MailKitEmailSenderOptions>(options =>
{
options.Host_Address = Configuration["ExternalProviders:MailKit:SMTP:Address"];
options.Host_Port = Convert.ToInt32(Configuration["ExternalProviders:MailKit:SMTP:Port"]);
options.Host_Username = Configuration["ExternalProviders:MailKit:SMTP:Account"];
options.Host_Password = Configuration["ExternalProviders:MailKit:SMTP:Password"] ?? "";
options.Host_Password = pwd;
options.Sender_EMail = Configuration["ExternalProviders:MailKit:SMTP:SenderEmail"];
options.Sender_Name = Configuration["ExternalProviders:MailKit:SMTP:SenderName"];
options.Host_SecureSocketOptions = MailKit.Security.SecureSocketOptions.Auto;
});
//services.AddStackExchangeRedisCache(options =>
//{
// options.Configuration = Configuration.GetConnectionString("Redis");
//});
services.AddControllers()
.AddJsonOptions(c => c.JsonSerializerOptions.ReferenceHandler = ReferenceHandler.Preserve);
+6 -9
View File
@@ -10,16 +10,16 @@
"ConnectionStrings": {
"LiMan.GLS": "Server=W2019-SQL-STEAM;Database=SteamWare_Auth;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=LiMan.API;",
"LiMan.DB": "Server=W2019-SQL-STEAM;Database=LiMan.DB;User ID=sa;Password=keyhammer16;integrated security=False;MultipleActiveResultSets=True;App=LiMan.API;",
"Redis": "redis.ufficio:26379, serviceName=prod, DefaultDatabase=13, connectTimeout=5000, syncTimeout=5000, asyncTimeout=5000, abortConnect=false, ssl=false, password=BtN9Py1wtLfLRvmzWnOPJ7RytDM+CLiVsJ/16zduNTlV8IOPGNrtzJSXPUnImA5PqmUMhKaUqo9NdHIG"
"Redis": "localhost:6379,DefaultDatabase=13"
},
"ExternalProviders": {
"MailKit": {
"SMTP": {
"Address": "smtp.gmail.com",
"Address": "smtp-mail.outlook.com",
"Port": "587",
"Account": "services@steamware.net",
"Password": "ruejpcwgycvbmmsr",
"SenderEmail": "services@steamware.net",
"Account": "steamwarebot@outlook.it",
"Password": "!39elanoizaNaiVnIomais",
"SenderEmail": "steamwarebot@outlook.it",
"SenderName": "Steamware Email BOT"
}
}
@@ -43,10 +43,7 @@
],
"Database": 14
},
"ServerConf": {
"FileShareAppBackup": "\\\\stor01\\AppBackup",
"FileShareTickets": "\\\\stor01\\TEAM DRIVES\\40_FileUpload\\unsafe_uploads"
},
"FileShare": "\\\\stor01\\TEAM DRIVES\\40_FileUpload\\unsafe_uploads",
"ApiUrl": "https://liman.egalware.com/",
"HostOs": "Win"
}
-32
View File
@@ -1,32 +0,0 @@
param([string]$ProjectDir, [string]$ProjectPath);
$FileMajMin = "..\MajMin.vers"
$FileVers = "Resources\VersNum.txt"
$FileManIn = "Resources\manifest-original.xml"
$FileManOut = "Resources\manifest.xml"
$FileCLogIn = "Resources\ChangeLog-original.html"
$FileCLogOut = "Resources\ChangeLog.html"
$MajMin = Get-Content $FileMajMin # "6.14."
$currentDate = get-date -format yyMM;
$currentTime = get-date -format ddHH;
$find = "<Version>(.|\n)*?</Version>";
$currRelNum = $MajMin + $currentDate +"." + $currentTime
$replace = "<Version>" + $MajMin + $currentDate +"." + $currentTime + "</Version>";
$csproj = Get-Content $ProjectPath
$csprojUpdated = $csproj -replace $find, $replace
Set-Content -Path $ProjectPath -Value $csprojUpdated
Set-Content -Path $FileVers -Value $currRelNum
# replace x manifest
$manData = Get-Content $FileManIn
$manData = $manData -replace "1.0.0.0", $currRelNum
$manData = $manData -replace "{{DIRNAME}}", "LiMan"
$manData = $manData -replace "{{BRANCHNAME}}", "stable/LAST"
$manData = $manData -replace "{{PACKNAME}}", "LiMan.UI"
Set-Content -Path $FileManOut -Value $manData
# replace x ChangeLog
$clogData = Get-Content $FileCLogIn
$clogData = $clogData -replace "{{CURRENT-REL}}", $currRelNum
Set-Content -Path $FileCLogOut -Value $clogData
File diff suppressed because it is too large Load Diff
-5
View File
@@ -23,11 +23,6 @@ namespace LiMan.DB.DBModels
[MaxLength(2500)]
public string TplConnString { get; set; } = "";
/// <summary>
/// Tipo Applicazione
/// </summary>
public string Tipo { get; set; } = "";
#endregion Public Properties
}
}
-109
View File
@@ -1,109 +0,0 @@
using Newtonsoft.Json;
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 LiMan.DB.DBModels
{
[Table("EnrollRequest")]
public partial class EnrollRequestModel
{
/// <summary>
/// ID univoco
/// </summary>
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdReq { get; set; }
/// <summary>
/// Passcode usato per autorizzare (un valore random NON DUPLICATO con quelli attivi al momento della richiesta)
/// </summary>
public int Passcode { get; set; } = 0;
/// <summary>
/// Payload richiesta, ovvero la serializzazione json di un Dict[string,string] delle info ricevute
/// </summary>
public string ReqPayload { get; set; } = "";
/// <summary>
/// DataOra richiesta enroll
/// </summary>
public DateTime DtReq { get; set; } = DateTime.Now;
/// <summary>
/// DataOra approvazione
/// </summary>
public DateTime? DtAppr { get; set; } = null;
/// <summary>
/// Username approvatore
/// </summary>
public string UserAppr { get; set; } = "";
/// <summary>
/// Licenza fornita in risposta alla richiesta
/// </summary>
public int IdxLic { get; set; } = 0;
/// <summary>
/// Indica Scaduta se non approvata e richiesta da oltre 15 minuti
/// </summary>
[NotMapped]
public bool IsScaduta
{
get => DtAppr == null && DateTime.Now.Subtract(DtReq).TotalMinutes > minScad;
}
/// <summary>
/// DataOra Scadenza richiesta (periodo indicato - 10 sec)
/// </summary>
[NotMapped]
public DateTime DtScadenza
{
get => DtReq.AddSeconds(minScad * 60 - 10);
}
[NotMapped]
public Dictionary<string, string> DictAttrib
{
get
{
Dictionary<string, string> answ = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(ReqPayload))
{
try
{
answ = JsonConvert.DeserializeObject<Dictionary<string, string>>(ReqPayload);
}
catch { }
}
return answ;
}
}
public int DictNumKVP()
{
return DictAttrib.Count;
}
public Dictionary<string, string> DictAttribShort(int numMax)
{
Dictionary<string, string> answ = DictAttrib;
if (answ.Count > numMax)
{
answ = answ.Take(numMax).ToDictionary(x => x.Key, x => x.Value);
}
return answ;
}
/// <summary>
/// Scadenza massima (in minuti) per la richiesta
/// </summary>
private const int minScad = 15;
}
}
@@ -1,95 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DB.DBModels
{
[Table("InstalledReleasesHistory")]
public partial class InstalledReleasesHistoryModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxInstRelHist { get; set; }
/// <summary>
/// Data di riferimento campionamento
/// </summary>
public DateTime DtRif { get; set; } = DateTime.Today;
/// <summary>
/// CodApp Richiesta
/// </summary>
[MaxLength(50)]
public string CodApp { get; set; } = "";
/// <summary>
/// Versione applicativo formato semver numerico 4 blocchi
/// </summary>
[MaxLength(50)]
public string VersNum { get; set; } = "0.0.0.0";
/// <summary>
/// Numero Copie Installate dell'applicativo
/// </summary>
public int NumInst { get; set; } = 1;
/// <summary>
/// Numero Impieghi dell'applicativo (es per MAPO IOB-WIN il num di iOB usati con uno specifico SW)
/// </summary>
public int NumImp { get; set; } = 1;
/// <summary>
/// Numero Installazioni con score 4 (tutti valori rel correnti M.m.r.b)
/// </summary>
public int NumIS4 { get; set; } = 0;
/// <summary>
/// Numero Installazioni con score 3 (3 valori rel correnti M.m.r.x)
/// </summary>
public int NumIS3 { get; set; } = 0;
/// <summary>
/// Numero Installazioni con score 2 (2 valori rel correnti M.m.x.x)
/// </summary>
public int NumIS2 { get; set; } = 0;
/// <summary>
/// Numero Installazioni con score 1 (3 valori rel correnti M.x.x.x)
/// </summary>
public int NumIS1 { get; set; } = 0;
/// <summary>
/// Numero Installazioni con score 0 (0 valori rel correnti x.x.x.x)
/// </summary>
public int NumIS0 { get; set; } = 0;
/// <summary>
/// Versione (calcolata) a partire dal valore Num
/// </summary>
[NotMapped]
public Version VersVal
{
get
{
Version answ = new Version();
try
{
// solo se è una versione valida: SemVer = 2/3 punti
int numPunti = VersNum.Length - VersNum.Replace(".", "").Length;
if (numPunti >= 2 && numPunti <= 3)
{
answ = !string.IsNullOrEmpty(VersNum) ? new Version(VersNum) : new Version();
}
}
catch { }
return answ;
}
}
[ForeignKey("CodApp")]
public virtual ApplicativoModel ApplicativoNav { get; set; }
}
}
@@ -1,96 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DB.DBModels
{
[Table("InstalledReleases")]
public partial class InstalledReleasesModel
{
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxInstall { get; set; }
/// <summary>
/// CodApp Richiesta
/// </summary>
[MaxLength(50)]
public string CodApp { get; set; } = "";
/// <summary>
/// Master Key
/// </summary>
[MaxLength(500)]
public string MastKey { get; set; } = "";
/// <summary>
/// Codice Impiego Istanza (SubLic)
/// </summary>
[MaxLength(500)]
public string CodImp { get; set; } = "";
/// <summary>
/// Chiave SubLic
/// </summary>
[MaxLength(500)]
public string AppKey { get; set; } = "";
/// <summary>
/// Versione applicativo formato semver numerico 4 blocchi
/// </summary>
[MaxLength(50)]
public string VersNum { get; set; } = "0.0.0.0";
/// <summary>
/// Numero impieghi dell'applicativo (es per MAPO IOB-WIN il num di iOB usati con uno specifico SW)
/// </summary>
public int NumImp { get; set; } = 1;
/// <summary>
/// Data di ultima verifica versione
/// </summary>
public DateTime DtCheck { get; set; } = DateTime.Today.AddYears(-1);
/// <summary>
/// Licenza associata
/// </summary>
public int IdxLic { get; set; } = 0;
/// <summary>
/// Istanza (SubLic) associata
/// </summary>
public int IdxSubLic { get; set; } = 0;
/// <summary>
/// Versione (calcolata) a partire dal valore Num
/// </summary>
[NotMapped]
public Version VersVal
{
get
{
Version answ = new Version();
try
{
// solo se è una versione valida: SemVer = 2/3 punti
int numPunti = VersNum.Length - VersNum.Replace(".", "").Length;
if (numPunti >= 2 && numPunti <= 3)
{
answ = !string.IsNullOrEmpty(VersNum) ? new Version(VersNum) : new Version();
}
}
catch { }
return answ;
}
}
[ForeignKey("CodApp")]
public virtual ApplicativoModel ApplicativoNav { get; set; }
[ForeignKey("IdxLic")]
public virtual LicenzaModel? LicenzaNav { get; set; }
}
}
-39
View File
@@ -1,39 +0,0 @@
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;
using static Core.Enum;
namespace LiMan.DB.DBModels
{
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
//[Index(nameof(Installazione), nameof(Active), nameof(DiskStatus))]
[Table("LogCodImp")]
public partial class LogCodImp
{
#region Public Properties
[Key, DatabaseGenerated(DatabaseGeneratedOption.Identity)]
public int IdxLogCodImp { get; set; }
public int IdxLic { get; set; } = 0;
public int IdxSubLic { get; set; } = 0;
public string CodApp { get; set; } = "";
public string CodImpOld { get; set; } = "";
public string CodImpNew { get; set; } = "";
public DateTime DtMod { get; set; } = DateTime.Now;
[ForeignKey("IdxLic")]
public virtual LicenzaModel LicenzaNav { get; set; }
[ForeignKey("CodApp")]
public virtual ApplicativoModel ApplicativoNav { get; set; }
#endregion Public Properties
}
}
+1 -25
View File
@@ -29,37 +29,13 @@ namespace LiMan.DB.DBModels
/// </summary>
public string VersText { get; set; } = "0.1a2";
/// <summary>
/// Tag associati a versione, comma separated
/// </summary>
public string RelTags { get; set; } = "";
/// <summary>
/// Versione (calcolata) a partire dal valore Num
/// </summary>
[NotMapped]
public Version VersVal
{
get
{
Version answ = new Version();
try
{
// solo se è una versione valida: SemVer = 2/3 punti
int numPunti = VersNum.Length - VersNum.Replace(".", "").Length;
if (numPunti >= 2 && numPunti <= 3)
{
answ = !string.IsNullOrEmpty(VersNum) ? new Version(VersNum) : new Version();
}
}
catch { }
return answ;
}
}
[NotMapped]
public bool IsReleased
{
get => ReleaseDate <= DateTime.Now;
get =>!string.IsNullOrEmpty(VersNum) ? new Version(VersNum): new Version();
}
/// <summary>
-114
View File
@@ -1,114 +0,0 @@
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 LiMan.DB.DTO
{
/// <summary>
/// DTO relativo alle info di ogni singolo applicativo
/// </summary>
public class AppRelStatusDTO
{
/// <summary>
/// CodApp Richiesta
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// CodInstall collegato
/// </summary>
public string CodInst { get; set; } = "";
/// <summary>
/// CodImpiego collegato
/// </summary>
public string CodImp { get; set; } = "";
/// <summary>
/// Licenza Updater
/// </summary>
public int IdxLic { get; set; } = 0;
/// <summary>
/// Codice cliente
/// </summary>
public string Cliente { get; set; } = "";
/// <summary>
/// Istanza Updater (PC)
/// </summary>
public int IdxSubLic { get; set; } = 0;
/// <summary>
/// PC/Installazione specifica
/// </summary>
public string PcInst { get; set; } = "";
/// <summary>
/// Conteggio del numero totale degli impieghi attivi (es conteggio IOB)
/// </summary>
public int NumImp { get; set; } = 1;
/// <summary>
/// Versione Installata
/// </summary>
public string VersNumInstall { get; set; } = "0.0.0.0";
/// <summary>
/// Versione Release corrente
/// </summary>
public string VersNumCurrent { get; set; } = "0.0.0.0";
/// <summary>
/// Status aggiornamento:
/// 4 = corrente, 4 blocchi uguali (0.0.0.0)
/// 3 = 3 uguali, cambia 4 blocco (0.0.0.x)
/// 2 = 2 uguali, cambia 3 blocco (0.0.x.x)
/// 1 = 1 uguali, cambia 2 blocco (0.x.x.x)
/// 0 = 0 uguali, cambia 1 blocco (x.x.x.x)
/// </summary>
public int UpToDateStatus
{
get
{
int answ = 0;
if (VersNumCurrent == VersNumInstall)
{
answ = 4;
}
else
{
var tokInst = VersNumInstall.Split('.');
var tokCurr = VersNumCurrent.Split('.');
int numTok = tokCurr.Count();
// parto dal + basso ad assegnare punteggio...
for (int i = 0; i < numTok; i++)
{
// se diversi esco...
if (tokInst[i] != tokCurr[i])
{
break;
}
answ++;
}
}
return answ;
}
}
/// <summary>
/// Data Ora ultimo controllo
/// </summary>
public DateTime DtCheck { get; set; } = DateTime.Now;
}
}
-76
View File
@@ -1,76 +0,0 @@
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 LiMan.DB.DTO
{
/// <summary>
/// DTO relativo alle info RAGGRUPPATE x applicativo
/// </summary>
public class AppStatusDTO
{
/// <summary>
/// CodApp Richiesta
/// </summary>
public string CodApp { get; set; } = "";
/// <summary>
/// Conteggio del numero totale installazioni
/// </summary>
public int NumInst { get; set; } = 1;
/// <summary>
/// Conteggio del numero totale degli impieghi attivi (es conteggio IOB)
/// </summary>
public int NumImp { get; set; } = 1;
/// <summary>
/// Versione Release corrente
/// </summary>
public string VersNumCurrent { get; set; } = "0.0.0.0";
/// <summary>
/// Dizionario Versioni Installate
/// </summary>
public Dictionary<string, int> DictVersNumInst { get; set; } = new Dictionary<string, int>();
/// <summary>
/// Dizionario Stato Update, dove la chiave è UpToDateStatus come
/// 4 = corrente, 4 blocchi uguali (0.0.0.0)
/// 3 = 3 uguali, cambia 4 blocco (0.0.0.x)
/// 2 = 2 uguali, cambia 3 blocco (0.0.x.x)
/// 1 = 1 uguali, cambia 2 blocco (0.x.x.x)
/// 0 = 0 uguali, cambia 1 blocco (x.x.x.x)
/// </summary>
public Dictionary<int, int> DictUpdate { get; set; } = new Dictionary<int, int>();
/// <summary>
/// Dettaglio delle versioni installate con tutte le info
/// </summary>
public List<AppRelStatusDTO> DetailInstalled { get; set; } = new List<AppRelStatusDTO>();
/// <summary>
/// Score dello stato di aggiornamento complessivo
/// </summary>
public double UpdateScore
{
get => DictUpdate != null ? (double)(DictUpdate.Sum(x => x.Key * x.Value)) / (4 * DictUpdate.Sum(x => x.Value)) : 0;
}
/// <summary>
/// Data Ora ultimo controllo
/// </summary>
public DateTime DtCheck { get; set; } = DateTime.Now;
}
}
-22
View File
@@ -1,22 +0,0 @@
using Core;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static Core.Enum;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace LiMan.DB.DTO
{
public class DeviceDTO
{
public string CodImp { get; set; } = "";
public string CodInst { get; set; } = "";
public string DevName { get; set; } = "";
public DateTime LastUpdate { get; set; } = DateTime.Today.AddYears(-1);
}
}
-113
View File
@@ -1,113 +0,0 @@
using LiMan.DB.DBModels;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace LiMan.DB.DTO
{
/// <summary>
/// Resoconto informazioni per statistiche installazioni
/// </summary>
public class InstallStatusDTO
{
/// <summary>
/// Elenco delle licenze degli applicativi abilitati alla gestione verifica update
/// </summary>
public List<ApplicativoDTO> UpdaterList { get; set; } = new List<ApplicativoDTO>();
/// <summary>
/// Elenco chiamate con conteggio x CodApp
/// </summary>
public Dictionary<string, int> ReqCountApp { get; set; } = new Dictionary<string, int>();
/// <summary>
/// Lista delle ultime richieste registrate (TargetUrl like '%release%') come conteggio orario (tipicamente 15 gg)
/// </summary>
public Dictionary<DateTime, int> ReqCountHour { get; set; } = new Dictionary<DateTime, int>();
/// <summary>
/// Lista delle ultime richieste registrate (TargetUrl like '%release%') come conteggio giornaliero (tipicamente 1 anno)
/// </summary>
public Dictionary<DateTime, int> ReqCountDay { get; set; } = new Dictionary<DateTime, int>();
/// <summary>
/// Lista delle Releases Installate x le applicazioni gestite
/// </summary>
public List<AppRelStatusDTO> InstallRelList { get; set; } = new List<AppRelStatusDTO>();
/// <summary>
/// Statistica aggregata status applicativi
/// </summary>
public List<AppStatusDTO> InstallStatus { get; set; } = new List<AppStatusDTO>();
/// <summary>
/// Dizionario record Impiego/dati device
/// </summary>
public Dictionary<string, DeviceDTO> InstDevices { get; set; } = new Dictionary<string, DeviceDTO>();
[NotMapped]
public int LastCallHour
{
get => ReqCountHour != null && ReqCountHour.Count > 0 ? ReqCountHour.Last().Value : 0;
}
[NotMapped]
public int LastCallDay
{
get => ReqCountDay != null && ReqCountDay.Count > 0 ? ReqCountDay.Last().Value : 0;
}
[NotMapped]
public int TotalUpdaterAct
{
get
{
return UpdaterList.Sum(x => x.NumLicenzeAttive);
}
}
[NotMapped]
public double GlobalUpdateScore
{
get
{
return InstallStatus.Sum(x => x.UpdateScore * x.NumInst) / (InstallStatus.Sum(x => x.NumInst));
}
}
/// <summary>
/// Conteggio totale di tutte le applicazioni gestite, come somma CONTEGGIO degli applicativi diversi gestiti (per cliente)
/// </summary>
[NotMapped]
public int TotalManagedCount
{
get
{
return UpdaterList.Count + InstallRelList.Count;
}
}
/// <summary>
/// Conteggio totale di tutte le applicazioni gestite, come somma NumImpieghi di tutti gli applicativi + conteggio updater
/// </summary>
[NotMapped]
public int TotalManagedNum
{
get
{
return UpdaterList.Sum(x => x.NumLicenzeAttive) + InstallRelList.Sum(x => x.NumImp);
}
}
/// <summary>
/// Data Ora ultimo aggiornamento informazioni
/// </summary>
public DateTime LastUpdated { get; set; } = DateTime.Now;
}
}
-5
View File
@@ -43,11 +43,6 @@ namespace LiMan.DB.DTO
/// </summary>
public DateTime ReleaseDate { get; set; } = DateTime.Today.AddYears(100);
/// <summary>
/// Tag associati a versione, comma separated
/// </summary>
public string RelTags { get; set; } = "";
/// <summary>
/// Url pagina web di changelog (traduzione gestita sul sito target) - calcolato da CodApp + vers
/// </summary>
-64
View File
@@ -1,64 +0,0 @@
using Core;
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;
using static Core.Enum;
// <Auto-Generated>
// This is here so CodeMaid doesn't reorganize this document
// </Auto-Generated>
namespace LiMan.DB.DTO
{
public class UpdaterDTO
{
/// <summary>
/// Codice impiego (univoco x device)
/// </summary>
[Key]
public string CodImp { get; set; } = "";
/// <summary>
/// Nome App updater
/// </summary>
public string AppName { get; set; } = "Nemo";
/// <summary>
/// Versione updater
/// </summary>
public string AppVers { get; set; } = "0.0.0.0";
/// <summary>
/// Cod installazione
/// </summary>
public string CodInst { get; set; } = "";
/// <summary>
/// Cod Cliente
/// </summary>
public string Cliente { get; set; } = "";
/// <summary>
/// Data ora ultima comunicaziione
/// </summary>
public DateTime DtLastCom { get; set; } = DateTime.Today.AddYears(-1);
/// <summary>
/// Num App gestite
/// </summary>
public int NumApp { get; set; } = 0;
/// <summary>
/// Num file licenza gestite
/// </summary>
public int NumLicenze { get; set; } = 0;
/// <summary>
/// Numero Istsanze complessive (App x Istanze)
/// </summary>
public int NumIstanze { get; set; } = 0;
}
}
-4
View File
@@ -53,7 +53,6 @@ namespace LiMan.DB
public virtual DbSet<InstallazioneModel> DbSetInst { get; set; }
public virtual DbSet<LicenzaModel> DbSetLicenze { get; set; }
public virtual DbSet<LogCallModel> DbSetLogCall { get; set; }
public virtual DbSet<LogCodImp> DbSetLogCodImp { get; set; }
public virtual DbSet<LogLicenzaModel> DbSetLogLicenze { get; set; }
public virtual DbSet<SubLicenzaModel> DbSetSubLicenze { get; set; }
public virtual DbSet<TicketModel> DbSetTicket { get; set; }
@@ -62,9 +61,6 @@ namespace LiMan.DB
public virtual DbSet<AuthRoleModel> DbSetRoles { get; set; }
public virtual DbSet<AuthClaimModel> DbSetClaims { get; set; }
public virtual DbSet<ReleaseModel> DbSetReleases { get; set; }
public virtual DbSet<EnrollRequestModel> DbSetEnrollReq { get; set; }
public virtual DbSet<InstalledReleasesModel> DbSetInstallRel { get; set; }
public virtual DbSet<InstalledReleasesHistoryModel> DbSetInstallRelHist { get; set; }
#endregion Public Properties
+6 -10
View File
@@ -6,21 +6,17 @@
<ItemGroup>
<PackageReference Include="MailKit" Version="2.15.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.36" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.36" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.36" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.36" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.36" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.36">
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.28" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.36.0" />
<PackageReference Include="NLog" Version="5.3.2" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.36.0" />
</ItemGroup>
<ItemGroup>
-157
View File
@@ -1,157 +0,0 @@
using NLog;
using StackExchange.Redis;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace LiMan.DB
{
public class MessagePipe
{
#region Public Constructors
public MessagePipe(IConnectionMultiplexer redisConn, string channelName, bool enableLog = false)
{
_channel = channelName;
redis = redisConn;
redisDb = redis.GetDatabase();
this.enableLog = enableLog;
// aggiungo sottoscrittore
setupSubscriber();
}
#endregion Public Constructors
#region Public Events
public event EventHandler EA_NewMessage = delegate { };
#endregion Public Events
#region Public Methods
/// <summary>
/// Invio messaggio sul canale + salvataggio in cache REDIS
/// </summary>
/// <param name="memKey">Chiave REDIS x salvare valore</param>
/// <param name="message">Messaggio serializzato da inviare</param>
public bool saveAndSendMessage(string memKey, string message)
{
bool answ = false;
Stopwatch stopWatch = new Stopwatch();
stopWatch.Start();
// invio notifica tramite il canale richiesto
answ = sendMessage(message);
if (redisDb != null)
{
redisDb.StringSetAsync(memKey, message);
}
stopWatch.Stop();
TimeSpan ts = stopWatch.Elapsed;
if (numSent.ContainsKey(memKey))
{
numSent[memKey]++;
}
else
{
numSent.Add(memKey, 1);
}
if (enableLog || numSent[memKey] > 30)
{
Log.Info($"saveAndSendMessage| mKey {memKey} x {numSent[memKey]} | {message.Length} size | {ts.TotalMilliseconds} ms");
numSent[memKey] = 0;
}
return answ;
}
/// <summary>
/// Invio messaggio sul canale
/// </summary>
/// <param name="newMess"></param>
/// <returns></returns>
public bool sendMessage(string newMess)
{
bool answ = false;
ISubscriber sub = redis.GetSubscriber();
sub.Publish(_channel, newMess);
return answ;
}
#endregion Public Methods
#region Protected Fields
protected static Logger Log = LogManager.GetCurrentClassLogger();
#endregion Protected Fields
#region Private Fields
private bool enableLog = false;
private Dictionary<string, int> numSent = new Dictionary<string, int>();
private IConnectionMultiplexer redis;
private IDatabase redisDb;
#endregion Private Fields
#region Private Properties
/// <summary>
/// Canale associato al gestore pipeline messaggi
/// </summary>
private string _channel { get; set; } = "";
#endregion Private Properties
#region Private Methods
private void setupSubscriber()
{
ISubscriber sub = redis.GetSubscriber();
//Subscribe to the channel named messages
sub.Subscribe(_channel, (channel, message) =>
{
if (enableLog)
{
Log.Trace($"req setup ch {channel} | {message}");
}
// messaggio
PubSubEventArgs mea = new PubSubEventArgs(message);
// se qualcuno ascolta sollevo evento nuovo valore...
if (EA_NewMessage != null)
{
EA_NewMessage(this, mea);
}
});
if (enableLog)
{
Log.Info($"Subscribed {_channel}");
}
}
#endregion Private Methods
}
public class PubSubEventArgs : EventArgs
{
#region Public Constructors
public PubSubEventArgs(string messaggio)
{
this.newMessage = messaggio;
}
#endregion Public Constructors
#region Public Properties
public string newMessage { get; set; } = "";
#endregion Public Properties
}
}
@@ -1,552 +0,0 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20240917090404_UpdRelModelAndApp01")]
partial class UpdRelModelAndApp01
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Tipo")
.HasColumnType("nvarchar(max)");
b.Property<string>("TplConnString")
.HasMaxLength(2500)
.HasColumnType("nvarchar(2500)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Cognome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Nome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.Property<int>("IdxRel")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxRel"), 1L, 1);
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("RelTags")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ReleaseDate")
.HasColumnType("datetime2");
b.Property<string>("VersNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("VersText")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxRel");
b.HasIndex("CodApp");
b.ToTable("Releases");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,35 +0,0 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class UpdRelModelAndApp01 : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "RelTags",
table: "Releases",
type: "nvarchar(max)",
nullable: true);
migrationBuilder.AddColumn<string>(
name: "Tipo",
table: "Applicativi",
type: "nvarchar(max)",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "RelTags",
table: "Releases");
migrationBuilder.DropColumn(
name: "Tipo",
table: "Applicativi");
}
}
}
@@ -1,583 +0,0 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20241231105435_AddEnrollRequest")]
partial class AddEnrollRequest
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Tipo")
.HasColumnType("nvarchar(max)");
b.Property<string>("TplConnString")
.HasMaxLength(2500)
.HasColumnType("nvarchar(2500)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Cognome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Nome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.EnrollRequestModel", b =>
{
b.Property<int>("IdReq")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdReq"), 1L, 1);
b.Property<DateTime?>("DtAppr")
.HasColumnType("datetime2");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Passcode")
.HasColumnType("int");
b.Property<string>("ReqPayload")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserAppr")
.HasColumnType("nvarchar(max)");
b.HasKey("IdReq");
b.ToTable("EnrollRequest");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.Property<int>("IdxRel")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxRel"), 1L, 1);
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("RelTags")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ReleaseDate")
.HasColumnType("datetime2");
b.Property<string>("VersNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("VersText")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxRel");
b.HasIndex("CodApp");
b.ToTable("Releases");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,37 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class AddEnrollRequest : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "EnrollRequest",
columns: table => new
{
IdReq = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
Passcode = table.Column<int>(type: "int", nullable: false),
ReqPayload = table.Column<string>(type: "nvarchar(max)", nullable: true),
DtReq = table.Column<DateTime>(type: "datetime2", nullable: false),
DtAppr = table.Column<DateTime>(type: "datetime2", nullable: true),
UserAppr = table.Column<string>(type: "nvarchar(max)", nullable: true),
IdxLic = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_EnrollRequest", x => x.IdReq);
});
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "EnrollRequest");
}
}
}
@@ -1,639 +0,0 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20250111112800_AddInstalledRelTrack")]
partial class AddInstalledRelTrack
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Tipo")
.HasColumnType("nvarchar(max)");
b.Property<string>("TplConnString")
.HasMaxLength(2500)
.HasColumnType("nvarchar(2500)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Cognome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Nome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.EnrollRequestModel", b =>
{
b.Property<int>("IdReq")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdReq"), 1L, 1);
b.Property<DateTime?>("DtAppr")
.HasColumnType("datetime2");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Passcode")
.HasColumnType("int");
b.Property<string>("ReqPayload")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserAppr")
.HasColumnType("nvarchar(max)");
b.HasKey("IdReq");
b.ToTable("EnrollRequest");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesModel", b =>
{
b.Property<int>("IdxInstall")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxInstall"), 1L, 1);
b.Property<string>("AppKey")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("CodImp")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<DateTime>("DtCheck")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("MastKey")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<int>("NumImp")
.HasColumnType("int");
b.Property<string>("VersNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("IdxInstall");
b.HasIndex("CodApp");
b.ToTable("InstalledReleases");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.Property<int>("IdxRel")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxRel"), 1L, 1);
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("RelTags")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ReleaseDate")
.HasColumnType("datetime2");
b.Property<string>("VersNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("VersText")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxRel");
b.HasIndex("CodApp");
b.ToTable("Releases");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,50 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class AddInstalledRelTrack : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "InstalledReleases",
columns: table => new
{
IdxInstall = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
CodApp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
MastKey = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
CodImp = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
AppKey = table.Column<string>(type: "nvarchar(500)", maxLength: 500, nullable: true),
VersNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
NumImp = table.Column<int>(type: "int", nullable: false),
DtCheck = table.Column<DateTime>(type: "datetime2", nullable: false),
IdxLic = table.Column<int>(type: "int", nullable: false),
IdxSubLic = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstalledReleases", x => x.IdxInstall);
table.ForeignKey(
name: "FK_InstalledReleases_Applicativi_CodApp",
column: x => x.CodApp,
principalTable: "Applicativi",
principalColumn: "CodApp");
});
migrationBuilder.CreateIndex(
name: "IX_InstalledReleases_CodApp",
table: "InstalledReleases",
column: "CodApp");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "InstalledReleases");
}
}
}
@@ -1,705 +0,0 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20250115112104_AddInstRelHistTrack")]
partial class AddInstRelHistTrack
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Tipo")
.HasColumnType("nvarchar(max)");
b.Property<string>("TplConnString")
.HasMaxLength(2500)
.HasColumnType("nvarchar(2500)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Cognome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Nome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.EnrollRequestModel", b =>
{
b.Property<int>("IdReq")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdReq"), 1L, 1);
b.Property<DateTime?>("DtAppr")
.HasColumnType("datetime2");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Passcode")
.HasColumnType("int");
b.Property<string>("ReqPayload")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserAppr")
.HasColumnType("nvarchar(max)");
b.HasKey("IdReq");
b.ToTable("EnrollRequest");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesHistoryModel", b =>
{
b.Property<int>("IdxInstRelHist")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxInstRelHist"), 1L, 1);
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DtRif")
.HasColumnType("datetime2");
b.Property<int>("NumIS0")
.HasColumnType("int");
b.Property<int>("NumIS1")
.HasColumnType("int");
b.Property<int>("NumIS2")
.HasColumnType("int");
b.Property<int>("NumIS3")
.HasColumnType("int");
b.Property<int>("NumIS4")
.HasColumnType("int");
b.Property<int>("NumImp")
.HasColumnType("int");
b.Property<int>("NumInst")
.HasColumnType("int");
b.Property<string>("VersNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("IdxInstRelHist");
b.HasIndex("CodApp");
b.ToTable("InstalledReleasesHistory");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesModel", b =>
{
b.Property<int>("IdxInstall")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxInstall"), 1L, 1);
b.Property<string>("AppKey")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("CodImp")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<DateTime>("DtCheck")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("MastKey")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<int>("NumImp")
.HasColumnType("int");
b.Property<string>("VersNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("IdxInstall");
b.HasIndex("CodApp");
b.HasIndex("IdxLic");
b.ToTable("InstalledReleases");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.Property<int>("IdxRel")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxRel"), 1L, 1);
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("RelTags")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ReleaseDate")
.HasColumnType("datetime2");
b.Property<string>("VersNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("VersText")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxRel");
b.HasIndex("CodApp");
b.ToTable("Releases");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesHistoryModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,72 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class AddInstRelHistTrack : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "InstalledReleasesHistory",
columns: table => new
{
IdxInstRelHist = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
DtRif = table.Column<DateTime>(type: "datetime2", nullable: false),
CodApp = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
VersNum = table.Column<string>(type: "nvarchar(50)", maxLength: 50, nullable: true),
NumInst = table.Column<int>(type: "int", nullable: false),
NumImp = table.Column<int>(type: "int", nullable: false),
NumIS4 = table.Column<int>(type: "int", nullable: false),
NumIS3 = table.Column<int>(type: "int", nullable: false),
NumIS2 = table.Column<int>(type: "int", nullable: false),
NumIS1 = table.Column<int>(type: "int", nullable: false),
NumIS0 = table.Column<int>(type: "int", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_InstalledReleasesHistory", x => x.IdxInstRelHist);
table.ForeignKey(
name: "FK_InstalledReleasesHistory_Applicativi_CodApp",
column: x => x.CodApp,
principalTable: "Applicativi",
principalColumn: "CodApp");
});
migrationBuilder.CreateIndex(
name: "IX_InstalledReleases_IdxLic",
table: "InstalledReleases",
column: "IdxLic");
migrationBuilder.CreateIndex(
name: "IX_InstalledReleasesHistory_CodApp",
table: "InstalledReleasesHistory",
column: "CodApp");
migrationBuilder.AddForeignKey(
name: "FK_InstalledReleases_Licenze_IdxLic",
table: "InstalledReleases",
column: "IdxLic",
principalTable: "Licenze",
principalColumn: "IdxLic",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_InstalledReleases_Licenze_IdxLic",
table: "InstalledReleases");
migrationBuilder.DropTable(
name: "InstalledReleasesHistory");
migrationBuilder.DropIndex(
name: "IX_InstalledReleases_IdxLic",
table: "InstalledReleases");
}
}
}
@@ -1,757 +0,0 @@
// <auto-generated />
using System;
using LiMan.DB;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace LiMan.DB.Migrations
{
[DbContext(typeof(LMDbContext))]
[Migration("20251203155123_AddLogCodImp")]
partial class AddLogCodImp
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.36")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
modelBuilder.Entity("LiMan.DB.DBModels.ApplicativoModel", b =>
{
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Tipo")
.HasColumnType("nvarchar(max)");
b.Property<string>("TplConnString")
.HasMaxLength(2500)
.HasColumnType("nvarchar(2500)");
b.HasKey("CodApp");
b.ToTable("Applicativi");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.Property<int>("ClaimID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("ClaimID"), 1L, 1);
b.Property<DateTime>("DtIns")
.HasColumnType("datetime2");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("RoleID")
.HasColumnType("int");
b.Property<int>("UserID")
.HasColumnType("int");
b.HasKey("ClaimID");
b.HasIndex("RoleID");
b.HasIndex("UserID");
b.ToTable("AuthClaims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Property<int>("RoleID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("RoleID"), 1L, 1);
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Ruolo")
.HasColumnType("nvarchar(max)");
b.HasKey("RoleID");
b.ToTable("AuthRoles");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Property<int>("UserID")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("UserID"), 1L, 1);
b.Property<string>("AD_Domain")
.HasColumnType("nvarchar(max)");
b.Property<string>("AD_User")
.HasColumnType("nvarchar(max)");
b.Property<string>("Cognome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Nome")
.HasColumnType("nvarchar(max)");
b.Property<string>("Username")
.HasColumnType("nvarchar(max)");
b.HasKey("UserID");
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.EnrollRequestModel", b =>
{
b.Property<int>("IdReq")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdReq"), 1L, 1);
b.Property<DateTime?>("DtAppr")
.HasColumnType("datetime2");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Passcode")
.HasColumnType("int");
b.Property<string>("ReqPayload")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserAppr")
.HasColumnType("nvarchar(max)");
b.HasKey("IdReq");
b.ToTable("EnrollRequest");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxFileAttach"), 1L, 1);
b.Property<DateTime>("DtEvent")
.HasColumnType("datetime2");
b.Property<string>("FullStoragePath")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxTicket")
.HasColumnType("int");
b.Property<string>("OriginalName")
.HasColumnType("nvarchar(max)");
b.Property<string>("StorageName")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxFileAttach");
b.HasIndex("IdxTicket");
b.ToTable("FileAttach");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstallazioneModel", b =>
{
b.Property<string>("CodInst")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("Cliente")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Contatto")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Descrizione")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Email")
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.HasKey("CodInst");
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesHistoryModel", b =>
{
b.Property<int>("IdxInstRelHist")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxInstRelHist"), 1L, 1);
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DtRif")
.HasColumnType("datetime2");
b.Property<int>("NumIS0")
.HasColumnType("int");
b.Property<int>("NumIS1")
.HasColumnType("int");
b.Property<int>("NumIS2")
.HasColumnType("int");
b.Property<int>("NumIS3")
.HasColumnType("int");
b.Property<int>("NumIS4")
.HasColumnType("int");
b.Property<int>("NumImp")
.HasColumnType("int");
b.Property<int>("NumInst")
.HasColumnType("int");
b.Property<string>("VersNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("IdxInstRelHist");
b.HasIndex("CodApp");
b.ToTable("InstalledReleasesHistory");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesModel", b =>
{
b.Property<int>("IdxInstall")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxInstall"), 1L, 1);
b.Property<string>("AppKey")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("CodImp")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<DateTime>("DtCheck")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("MastKey")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<int>("NumImp")
.HasColumnType("int");
b.Property<string>("VersNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("IdxInstall");
b.HasIndex("CodApp");
b.HasIndex("IdxLic");
b.ToTable("InstalledReleases");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DataEnigma")
.HasColumnType("datetime2");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<string>("Enigma")
.HasColumnType("nvarchar(max)");
b.Property<bool>("Locked")
.HasColumnType("bit");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<string>("Payload")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.ToTable("Licenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCallModel", b =>
{
b.Property<DateTime>("DataRif")
.HasColumnType("datetime2");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<string>("TargetUrl")
.HasColumnType("nvarchar(450)");
b.Property<int>("NumCall")
.HasColumnType("int");
b.HasKey("DataRif", "CodInst", "CodApp", "TargetUrl");
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCodImp", b =>
{
b.Property<int>("IdxLogCodImp")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogCodImp"), 1L, 1);
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodImpNew")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpOld")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.HasKey("IdxLogCodImp");
b.HasIndex("CodApp");
b.HasIndex("IdxLic");
b.ToTable("LogCodImp");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(50)");
b.Property<string>("Descrizione")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("NumLicenze")
.HasColumnType("int");
b.Property<DateTime>("Scadenza")
.HasColumnType("datetime2");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxLogLic");
b.HasIndex("CodApp");
b.HasIndex("CodInst");
b.HasIndex("IdxLic");
b.ToTable("LogLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.Property<int>("IdxRel")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxRel"), 1L, 1);
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("RelTags")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ReleaseDate")
.HasColumnType("datetime2");
b.Property<string>("VersNum")
.HasColumnType("nvarchar(max)");
b.Property<string>("VersText")
.HasColumnType("nvarchar(max)");
b.HasKey("IdxRel");
b.HasIndex("CodApp");
b.ToTable("Releases");
});
modelBuilder.Entity("LiMan.DB.DBModels.StatsCallModel", b =>
{
b.Property<int>("YearRef")
.HasColumnType("int");
b.Property<string>("CodInst")
.HasColumnType("nvarchar(450)");
b.Property<string>("CodApp")
.HasColumnType("nvarchar(450)");
b.Property<int>("TotCall")
.HasColumnType("int");
b.HasKey("YearRef", "CodInst", "CodApp");
b.ToView("v_StatsCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.Property<int>("IdxSubLic")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxSubLic"), 1L, 1);
b.Property<string>("Chiave")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.Property<DateTime>("VetoUnlock")
.HasColumnType("datetime2");
b.HasKey("IdxSubLic");
b.HasIndex("IdxLic");
b.ToTable("SubLicenze");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.Property<int>("IdxTicket")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxTicket"), 1L, 1);
b.Property<string>("CodImpiego")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactName")
.HasColumnType("nvarchar(max)");
b.Property<string>("ContactPhone")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("ReqBody")
.HasColumnType("nvarchar(max)");
b.Property<int>("Status")
.HasColumnType("int");
b.Property<string>("SupplAnsw")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplEmail")
.HasColumnType("nvarchar(max)");
b.Property<string>("SupplUserCode")
.HasColumnType("nvarchar(max)");
b.Property<int>("TType")
.HasColumnType("int");
b.Property<int>("Tipo")
.HasColumnType("int");
b.HasKey("IdxTicket");
b.HasIndex("IdxLic");
b.ToTable("TicketLog");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthClaimModel", b =>
{
b.HasOne("LiMan.DB.DBModels.AuthRoleModel", "RoleNav")
.WithMany("Claims")
.HasForeignKey("RoleID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("LiMan.DB.DBModels.AuthUserModel", "UserNav")
.WithMany("Claims")
.HasForeignKey("UserID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("RoleNav");
b.Navigation("UserNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.HasOne("LiMan.DB.DBModels.TicketModel", "TicketNav")
.WithMany()
.HasForeignKey("IdxTicket")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesHistoryModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCodImp", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.InstallazioneModel", "InstallazioneNav")
.WithMany()
.HasForeignKey("CodInst");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("InstallazioneNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.ReleaseModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.SubLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Attivazioni")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.TicketModel", b =>
{
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany("Tickets")
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthRoleModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.AuthUserModel", b =>
{
b.Navigation("Claims");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Navigation("Attivazioni");
b.Navigation("Tickets");
});
#pragma warning restore 612, 618
}
}
}
@@ -1,58 +0,0 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace LiMan.DB.Migrations
{
public partial class AddLogCodImp : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "LogCodImp",
columns: table => new
{
IdxLogCodImp = table.Column<int>(type: "int", nullable: false)
.Annotation("SqlServer:Identity", "1, 1"),
IdxLic = table.Column<int>(type: "int", nullable: false),
IdxSubLic = table.Column<int>(type: "int", nullable: false),
CodApp = table.Column<string>(type: "nvarchar(50)", nullable: true),
CodImpOld = table.Column<string>(type: "nvarchar(max)", nullable: true),
CodImpNew = table.Column<string>(type: "nvarchar(max)", nullable: true),
DtMod = table.Column<DateTime>(type: "datetime2", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_LogCodImp", x => x.IdxLogCodImp);
table.ForeignKey(
name: "FK_LogCodImp_Applicativi_CodApp",
column: x => x.CodApp,
principalTable: "Applicativi",
principalColumn: "CodApp");
table.ForeignKey(
name: "FK_LogCodImp_Licenze_IdxLic",
column: x => x.IdxLic,
principalTable: "Licenze",
principalColumn: "IdxLic",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_LogCodImp_CodApp",
table: "LogCodImp",
column: "CodApp");
migrationBuilder.CreateIndex(
name: "IX_LogCodImp_IdxLic",
table: "LogCodImp",
column: "IdxLic");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "LogCodImp");
}
}
}
+1 -212
View File
@@ -18,7 +18,7 @@ namespace LiMan.DB.Migrations
#pragma warning disable 612, 618
modelBuilder
.UseCollation("SQL_Latin1_General_CP1_CI_AS")
.HasAnnotation("ProductVersion", "6.0.36")
.HasAnnotation("ProductVersion", "6.0.28")
.HasAnnotation("Relational:MaxIdentifierLength", 128);
SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder, 1L, 1);
@@ -33,9 +33,6 @@ namespace LiMan.DB.Migrations
.HasMaxLength(250)
.HasColumnType("nvarchar(250)");
b.Property<string>("Tipo")
.HasColumnType("nvarchar(max)");
b.Property<string>("TplConnString")
.HasMaxLength(2500)
.HasColumnType("nvarchar(2500)");
@@ -121,37 +118,6 @@ namespace LiMan.DB.Migrations
b.ToTable("AuthUsers");
});
modelBuilder.Entity("LiMan.DB.DBModels.EnrollRequestModel", b =>
{
b.Property<int>("IdReq")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdReq"), 1L, 1);
b.Property<DateTime?>("DtAppr")
.HasColumnType("datetime2");
b.Property<DateTime>("DtReq")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("Passcode")
.HasColumnType("int");
b.Property<string>("ReqPayload")
.HasColumnType("nvarchar(max)");
b.Property<string>("UserAppr")
.HasColumnType("nvarchar(max)");
b.HasKey("IdReq");
b.ToTable("EnrollRequest");
});
modelBuilder.Entity("LiMan.DB.DBModels.FileAttachModel", b =>
{
b.Property<int>("IdxFileAttach")
@@ -209,102 +175,6 @@ namespace LiMan.DB.Migrations
b.ToTable("Installazioni");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesHistoryModel", b =>
{
b.Property<int>("IdxInstRelHist")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxInstRelHist"), 1L, 1);
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<DateTime>("DtRif")
.HasColumnType("datetime2");
b.Property<int>("NumIS0")
.HasColumnType("int");
b.Property<int>("NumIS1")
.HasColumnType("int");
b.Property<int>("NumIS2")
.HasColumnType("int");
b.Property<int>("NumIS3")
.HasColumnType("int");
b.Property<int>("NumIS4")
.HasColumnType("int");
b.Property<int>("NumImp")
.HasColumnType("int");
b.Property<int>("NumInst")
.HasColumnType("int");
b.Property<string>("VersNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("IdxInstRelHist");
b.HasIndex("CodApp");
b.ToTable("InstalledReleasesHistory");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesModel", b =>
{
b.Property<int>("IdxInstall")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxInstall"), 1L, 1);
b.Property<string>("AppKey")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<string>("CodApp")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.Property<string>("CodImp")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<DateTime>("DtCheck")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.Property<string>("MastKey")
.HasMaxLength(500)
.HasColumnType("nvarchar(500)");
b.Property<int>("NumImp")
.HasColumnType("int");
b.Property<string>("VersNum")
.HasMaxLength(50)
.HasColumnType("nvarchar(50)");
b.HasKey("IdxInstall");
b.HasIndex("CodApp");
b.HasIndex("IdxLic");
b.ToTable("InstalledReleases");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.Property<int>("IdxLic")
@@ -377,41 +247,6 @@ namespace LiMan.DB.Migrations
b.ToTable("LogCall");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCodImp", b =>
{
b.Property<int>("IdxLogCodImp")
.ValueGeneratedOnAdd()
.HasColumnType("int");
SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property<int>("IdxLogCodImp"), 1L, 1);
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("CodImpNew")
.HasColumnType("nvarchar(max)");
b.Property<string>("CodImpOld")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("DtMod")
.HasColumnType("datetime2");
b.Property<int>("IdxLic")
.HasColumnType("int");
b.Property<int>("IdxSubLic")
.HasColumnType("int");
b.HasKey("IdxLogCodImp");
b.HasIndex("CodApp");
b.HasIndex("IdxLic");
b.ToTable("LogCodImp");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.Property<int>("IdxLogLic")
@@ -466,9 +301,6 @@ namespace LiMan.DB.Migrations
b.Property<string>("CodApp")
.HasColumnType("nvarchar(50)");
b.Property<string>("RelTags")
.HasColumnType("nvarchar(max)");
b.Property<DateTime>("ReleaseDate")
.HasColumnType("datetime2");
@@ -621,32 +453,6 @@ namespace LiMan.DB.Migrations
b.Navigation("TicketNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesHistoryModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.Navigation("ApplicativoNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.InstalledReleasesModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
@@ -662,23 +468,6 @@ namespace LiMan.DB.Migrations
b.Navigation("InstallazioneNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogCodImp", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
.WithMany()
.HasForeignKey("CodApp");
b.HasOne("LiMan.DB.DBModels.LicenzaModel", "LicenzaNav")
.WithMany()
.HasForeignKey("IdxLic")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("ApplicativoNav");
b.Navigation("LicenzaNav");
});
modelBuilder.Entity("LiMan.DB.DBModels.LogLicenzaModel", b =>
{
b.HasOne("LiMan.DB.DBModels.ApplicativoModel", "ApplicativoNav")
File diff suppressed because it is too large Load Diff
+5 -9
View File
@@ -11,19 +11,15 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.36" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.36">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.36" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.36" />
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.3" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.36.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.28" />
<PackageReference Include="NLog" Version="5.3.2" />
<PackageReference Include="StackExchange.Redis" Version="2.10.1" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.36.0" />
<PackageReference Include="StackExchange.Redis" Version="2.2.88" />
</ItemGroup>
<ItemGroup>
+4 -36
View File
@@ -105,44 +105,13 @@ namespace LiMan.DbSync.Services
#region Protected Methods
/// <summary>
/// Esegue flush memoria redis dato pat2Flush
/// Esegue flush memoria redis dato pattern
/// </summary>
/// <param name="pat2Flush"></param>
/// <param name="pattern"></param>
/// <returns></returns>
protected async Task<bool> ExecFlushRedisPattern(RedisValue pat2Flush)
protected async Task<bool> ExecFlushRedisPattern(RedisValue pattern)
{
bool answ = false;
var masterEndpoint = redisConn.GetEndPoints()
.Where(ep => redisConn.GetServer(ep).IsConnected && !redisConn.GetServer(ep).IsReplica)
.FirstOrDefault();
// sepattern è "*" elimino intero DB...
if (masterEndpoint != null && (pat2Flush.Equals(new RedisValue("*")) || pat2Flush == RedisValue.Null))
{
redisConn.GetServer(masterEndpoint).FlushDatabase(database: redisDb.Database);
}
else
{
var server = redisConn.GetServer(masterEndpoint);
var keys = server.Keys(database: redisDb.Database, pattern: pat2Flush, pageSize: 1000);
var deleteTasks = new List<Task>();
foreach (var key in keys)
{
deleteTasks.Add(redisDb.KeyDeleteAsync(key));
if (deleteTasks.Count >= 1000)
{
await Task.WhenAll(deleteTasks);
deleteTasks.Clear();
}
}
if (deleteTasks.Count > 0)
{
await Task.WhenAll(deleteTasks);
}
}
answ = true;
#if false
var listEndpoints = redisConn.GetEndPoints();
foreach (var endPoint in listEndpoints)
{
@@ -157,8 +126,7 @@ namespace LiMan.DbSync.Services
}
answ = true;
}
}
#endif
}
return answ;
}
+5 -11
View File
@@ -5,25 +5,19 @@
</PropertyGroup>
<ItemGroup>
<Compile Remove="DTO\**" />
<EmbeddedResource Remove="DTO\**" />
<None Remove="DTO\**" />
<Folder Include="DTO\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.36" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.36" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.36" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.36">
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Relational" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="6.0.28" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="6.0.28">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.Extensions.Caching.Memory" Version="6.0.3" />
<PackageReference Include="Microsoft.Extensions.Caching.StackExchangeRedis" Version="6.0.28" />
<PackageReference Include="Microsoft.IdentityModel.JsonWebTokens" Version="6.36.0" />
<PackageReference Include="NLog" Version="5.3.2" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="6.36.0" />
</ItemGroup>
<ItemGroup>
+1 -1
View File
@@ -1,6 +1,6 @@
<body>
<i>License Manager</i>
<h4>Versione: 2.1.2512.0409</h4>
<h4>Versione: 1.1.2408.0817</h4>
<br />
Note di rilascio:
<ul>
+1 -1
View File
@@ -1 +1 @@
2.1.2512.0409
1.1.2408.0817
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<item>
<version>2.1.2512.0409</version>
<version>1.1.2408.0817</version>
<url>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/LiMan.Transfer.zip</url>
<changelog>https://nexus.steamware.net/repository/SWS/LiMan/stable/LAST/ChangeLog.html</changelog>
<mandatory>false</mandatory>
+34 -41
View File
@@ -1,46 +1,39 @@
@if (showKeyGen)
{
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
<div class="modal-dialog modal-xl">
<div class="modal-content">
<div class="modal-header d-flex justify-content-between">
<div class="px-2">
<h4 class="modal-title">Machine Key Generator</h4>
</div>
<div class="px-2">
<button type="button" class="btn btn-close" data-dismiss="modal" @onclick="@ToggleKeyGen"></button>
</div>
</div>
<div class="modal-body">
<MachineKeyGen></MachineKeyGen>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal" @onclick="@ToggleKeyGen">Close</button>
</div>
</div>
</div>
</div>
}
<div class="card">
<div class="card">
<div class="card-header bg-info py-1 text-light">
<div class="d-flex justify-content-between">
<div class="px-2">
<h3>Istanze/Attivazioni</h3>
<div class="row">
<div class="col-4">
<h3>Attivazioni</h3>
</div>
<div class="px-2">
@if (CanEdit)
{
<button type="button" class="btn btn-primary" @onclick="@ToggleKeyGen">Show Machine KeyGen <i class="fas fa-key"></i></button>
}
else
{
<button type="button" class="btn btn-secondary" disabled>Show Machine KeyGen <i class="fas fa-key"></i></button>
}
<div class="col-4">
</div>
<div class="col-4">
<button type="button" class="btn btn-primary" data-toggle="modal" data-target="#machKeyGen">
Show Machine KeyGen <i class="fas fa-key"></i>
</button>
</div>
</div>
</div>
<div class="card-body bg-light p-1">
<div class="modal" id="machKeyGen">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Machine Key Generator</h4>
<button type="button" class="close" data-dismiss="modal">&times;</button>
</div>
<div class="modal-body">
<MachineKeyGen></MachineKeyGen>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-danger" data-dismiss="modal">Close</button>
</div>
</div>
</div>
</div>
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
@@ -61,8 +54,8 @@
}
</th>
<th>Scadenza Veto</th>
<th class="text-end"><i class="fas fa-user-lock"></i></th>
<th class="text-end"><i class="fas fa-exclamation-triangle"></i></th>
<th class="text-right"><i class="fas fa-user-lock"></i></th>
<th class="text-right"><i class="fas fa-exclamation-triangle"></i></th>
</tr>
</thead>
<tbody>
@@ -93,7 +86,7 @@
<td>
<span class="@cssScadenza(record.VetoUnlock)">@($"{record.VetoUnlock:yyyy.MM.dd}")</span>
</td>
<td class="text-end">
<td class="text-right">
@if (record.Locked)
{
<span aria-hidden="true" title="Licenza Bloccata"><i class="fas fa-lock text-danger"></i></span>
@@ -103,8 +96,8 @@
<span aria-hidden="true" title="Licenza Libera"><i class="fas fa-unlock-alt text-success"></i></span>
}
</td>
<td class="text-end">
@if (!record.Locked && CanEdit)
<td class="text-right">
@if (!record.Locked)
{
<button title="Elimina Licenza" class="btn btn-sm btn-danger" @onclick="() => Remove(record)"><i class="fas fa-trash"></i></button>
}
+97 -101
View File
@@ -12,10 +12,51 @@ namespace LiMan.UI.Components
{
public partial class Activations
{
#region Public Properties
#region Private Fields
[Parameter]
public bool CanEdit { get; set; } = false;
private List<SubLicenzaModel> ListRecords;
#endregion Private Fields
#region Protected Fields
protected SubLicenzaModel _currRecord = new SubLicenzaModel();
protected LicenzaModel _masterLic = new LicenzaModel();
protected bool showKey = false;
#endregion Protected Fields
#region Private Properties
private SubLicenzaModel currRecord
{
get
{
return _currRecord;
}
set
{
_currRecord = value;
}
}
private bool isLoading { get; set; } = false;
[Inject]
private IJSRuntime JSRuntime { get; set; }
#endregion Private Properties
#region Protected Properties
[Inject]
protected LiManDataService DataService { get; set; }
#endregion Protected Properties
#region Public Properties
[Parameter]
public EventCallback<int> DataReset { get; set; }
@@ -40,52 +81,26 @@ namespace LiMan.UI.Components
#endregion Public Properties
#region Public Methods
#region Private Methods
public string checkSelect(int IdxSubLic)
private async Task fullReload()
{
string answ = "";
if (currRecord != null)
{
try
{
answ = (currRecord.IdxSubLic == IdxSubLic) ? "table-info" : "";
}
catch
{ }
}
return answ;
await DataService.InvalidateAllCache();
await ReloadAllData();
}
public string decryptAuthKey(string authKey)
private async Task ReloadAllData()
{
string answ = authKey;
try
{
string passphrase = (MasterLicence.CodApp == "GPW") ? "AuthGPW" : MasterLicence.CodApp;
answ = SteamCrypto.DecryptString(authKey, passphrase);
}
catch
{ }
return answ;
isLoading = true;
ListRecords = null;
await Task.Delay(1);
ListRecords = MasterLicence.Attivazioni.ToList();
//AllRecords = await DataService.AttivazioniGetByLic(MasterLicence.IdxLic);
await Task.Delay(1);
isLoading = false;
}
#endregion Public Methods
#region Protected Fields
protected SubLicenzaModel _currRecord = new SubLicenzaModel();
protected LicenzaModel _masterLic = new LicenzaModel();
protected bool showKey = false;
#endregion Protected Fields
#region Protected Properties
[Inject]
protected LiManDataService DataService { get; set; }
#endregion Protected Properties
#endregion Private Methods
#region Protected Methods
@@ -94,8 +109,13 @@ namespace LiMan.UI.Components
await DataReset.InvokeAsync(0);
}
/// <summary> formatta testo secondo scadenza: scadenza < oggi --> verde scadenza > oggi -->
/// rosso </summary> <param name="scadenza"></param> <returns></returns>
/// <summary>
/// formatta testo secondo scadenza:
/// scadenza < oggi --> verde
/// scadenza > oggi --> rosso
/// </summary>
/// <param name="scadenza"></param>
/// <returns></returns>
protected string cssScadenza(DateTime scadenza)
{
string answ = "text-dark";
@@ -112,17 +132,6 @@ namespace LiMan.UI.Components
return answ;
}
protected async Task Remove(SubLicenzaModel selRecord)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare in modo forzato la licenza? Operazione irreversibile."))
return;
// chiamo procedura sblocco...
await DataService.AttivazioneDelete(selRecord.IdxSubLic);
//await ResetData();
await DataUpdated.InvokeAsync(0);
}
protected async Task ResetData()
{
await fullReload();
@@ -144,61 +153,48 @@ namespace LiMan.UI.Components
await DataUpdated.InvokeAsync(0);
}
protected async Task Remove(SubLicenzaModel selRecord)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare in modo forzato la licenza? Operazione irreversibile."))
return;
// chiamo procedura sblocco...
await DataService.AttivazioneDelete(selRecord.IdxSubLic);
//await ResetData();
await DataUpdated.InvokeAsync(0);
}
#endregion Protected Methods
#region Private Fields
#region Public Methods
private List<SubLicenzaModel> ListRecords;
#endregion Private Fields
#region Private Properties
private SubLicenzaModel currRecord
public string checkSelect(int IdxSubLic)
{
get
string answ = "";
if (currRecord != null)
{
return _currRecord;
try
{
answ = (currRecord.IdxSubLic == IdxSubLic) ? "table-info" : "";
}
catch
{ }
}
set
return answ;
}
public string decryptAuthKey(string authKey)
{
string answ = authKey;
try
{
_currRecord = value;
answ = SteamCrypto.DecryptString(authKey, "AuthGPW");
}
catch
{ }
return answ;
}
private bool isLoading { get; set; } = false;
[Inject]
private IJSRuntime JSRuntime { get; set; }
private bool showKeyGen { get; set; } = false;
#endregion Private Properties
#region Private Methods
private async Task fullReload()
{
await DataService.FlushRedisCache();
await ReloadAllData();
}
private async Task ReloadAllData()
{
isLoading = true;
ListRecords = null;
await Task.Delay(1);
ListRecords = MasterLicence.Attivazioni.ToList();
//SearchRecords = await LMDService.AttivazioniGetByLic(MasterLicence.IdxLic);
await Task.Delay(1);
isLoading = false;
}
private void ToggleKeyGen()
{
showKeyGen = !showKeyGen;
}
#endregion Private Methods
#endregion Public Methods
}
}
-96
View File
@@ -1,96 +0,0 @@
<div class="row">
<div class="col-12 col-md-6 col-lg-4 col-xl-3">
<div class="card shadow text-center rounded-3">
<div class="card-header fs-2">
Clienti
</div>
<div class="card-body body-height">
<div class="fs-1 mb-3">
<b>@InfoStats.UpdaterList.Count</b>
</div>
<div class="input-group">
<select @bind="@CodInstSel" class="form-select form-select-lg2">
<option value="">--- Tutti ---</option>
@if (ListInstall != null)
{
foreach (var item in ListInstall)
{
<option value="@item.CodInst">@item.CodInst</option>
}
}
</select>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4 col-xl-3">
<div class="card shadow text-center rounded-3">
<div class="card-header fs-2">
AppControlCenter
</div>
<div class="card-body body-height">
<div class="fs-1">
<b>@InfoStats.TotalUpdaterAct</b>
</div>
<div class="btn-group w-100" role="group">
<button title="Richiesta update info Applicazioni" class="btn btn-primary" @onclick="() => DoMassiveRequest(Core.Enum.EgwAccTask.ForceCheck)">Apps Info</button>
<button title="Richiesta update info Devices" class="btn btn-info" @onclick="() => DoMassiveRequest(Core.Enum.EgwAccTask.DeviceInfoGet)">Dev. info</button>
<button disabled title="Richiesta Riavvio + Update AppControlCenter" class="btn btn-danger">Reboot</button>
</div>
</div>
<div class="card-footer">
<div class="d-flex justify-content-evenly rounded">
<button class="btn btn-sm w-100 text-center @BtnState(TaskReq.Count,"text-danger")" @onclick="() => ShowDetail(Core.Enum.UpdStatus.Pending)">Pending <b>@TaskReq.Count</b></button>
<button class="btn btn-sm w-100 text-center @BtnState(TaskRun.Count)" @onclick="() => ShowDetail(Core.Enum.UpdStatus.Running)">Run <b>@TaskRun.Count</b></button>
<button class="btn btn-sm w-100 text-center @BtnState(TaskDone.Count)" @onclick="() => ShowDetail(Core.Enum.UpdStatus.Done)">Done <b>@TaskDone.Count</b></button>
</div>
</div>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4 col-xl-3">
<div class="card shadow text-center rounded-3">
<div class="card-header fs-2">
Update Score
</div>
<div class="card-body body-height">
<div class="fs-1">
<b>@($"{InfoStats.GlobalUpdateScore:P1}")</b>
</div>
<i>global update commands</i>
</div>
</div>
</div>
<div class="col-12 col-md-6 col-lg-4 col-xl-3">
<div class="card shadow text-center rounded-3">
<div class="card-header fs-2">
Request Received
</div>
<div class="card-body p-1 body-height">
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between align-items-start">
<div>
Call / Hour <sub>(last)</sub>
</div>
<span class="badge text-bg-primary rounded-pill">@InfoStats.LastCallHour</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div>
Call / Day <sub>(last)</sub>
</div>
<span class="badge text-bg-primary rounded-pill">@InfoStats.LastCallDay</span>
</li>
<li class="list-group-item d-flex justify-content-between align-items-start">
<div>
App Requested <sub>(all)</sub>
</div>
<span class="badge text-bg-primary rounded-pill">@InfoStats.ReqCountApp.Count()</span>
</li>
</ul>
</div>
</div>
</div>
@if (UpdStatusReq != Core.Enum.UpdStatus.None)
{
<ListDevicesDTO Title="@($"{UpdStatusReq}")" EC_StatusReq="ShowDetail" SearchRecord="ListDev2Show"></ListDevicesDTO>
}
</div>
-356
View File
@@ -1,356 +0,0 @@
using LiMan.DB;
using LiMan.DB.DBModels;
using LiMan.DB.DTO;
using LiMan.UI.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.JSInterop;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
namespace LiMan.UI.Components
{
public partial class AggregateStats : IDisposable
{
#region Public Methods
public void Dispose()
{
LMDService.EnrollMessPipe.EA_NewMessage -= async (sender, e) => await EnrollMessPipe_EA_NewMessage(sender, e);
LMDService.UpdActMessPipe.EA_NewMessage -= async (sender, e) => await UpdActMessPipe_EA_NewMessage(sender, e);
MServ.EA_SelCodImp -= async () => await MServ_EA_SelCodImp();
MServ.EA_SelCodInst -= async () => await MServ_EA_SelCodInst();
}
#endregion Public Methods
#region Protected Properties
/// <summary>
/// Codice installazione selezionata
/// </summary>
protected string CodInstSel
{
get => codInstSel;
set
{
if (codInstSel != value)
{
codInstSel = value;
isLoading = true;
var pUpd = Task.Run(async () =>
{
await ReloadData();
MServ.UsrParamSet("CodInst", value);
MServ.ReportSelCodInst();
});
pUpd.Wait();
isLoading = false;
}
}
}
/// <summary>
/// Tipo app selezionato
/// </summary>
protected string CodTipoApp
{
get => codTipoApp;
set
{
if (codTipoApp != value)
{
codTipoApp = value;
isLoading = true;
var pUpd = Task.Run(async () =>
{
await ReloadData();
// resetto eventuale App
MServ.UsrParamSet("CodApp", "");
MServ.ReportSelCodApp();
});
pUpd.Wait();
isLoading = false;
}
}
}
[Inject]
protected LiManDataService LMDService { get; set; } = null!;
[Inject]
protected MessageService MServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
{
LMDService.EnrollMessPipe.EA_NewMessage += async (sender, e) => await EnrollMessPipe_EA_NewMessage(sender, e);
LMDService.UpdActMessPipe.EA_NewMessage += async (sender, e) => await UpdActMessPipe_EA_NewMessage(sender, e);
MServ.EA_SelCodImp += async () => await MServ_EA_SelCodImp();
MServ.EA_SelCodInst += async () => await MServ_EA_SelCodInst();
await ReloadLicData();
await ReloadData();
}
#endregion Protected Methods
#region Private Fields
private string CodDeviceSel = "";
private string codInstSel = "";
private Dictionary<string, string> DetailFilt = new Dictionary<string, string>();
private bool HasFiltClienti = false;
private bool HasFiltImpiego = false;
private List<InstallazioneModel> ListInstall;
/// <summary>
/// Lista Task in stato DONE
/// </summary>
private Dictionary<string, string> TaskDone = new Dictionary<string, string>();
/// <summary>
/// Lista Task in stato REQUESTED
/// </summary>
private Dictionary<string, string> TaskReq = new Dictionary<string, string>();
/// <summary>
/// Lista Task in stato RUNNING
/// </summary>
private Dictionary<string, string> TaskRun = new Dictionary<string, string>();
/// <summary>
/// Status degli udpater da mostrare
/// </summary>
private Core.Enum.UpdStatus UpdStatusReq = Core.Enum.UpdStatus.None;
#endregion Private Fields
#region Private Properties
/// <summary>
/// Impianto selezionato
/// </summary>
private string CodImpSel { get; set; } = "";
private string codTipoApp { get; set; } = "";
private string DevName { get; set; } = "";
private DateTime DtFine { get; set; } = DateTime.Today.AddHours(DateTime.Now.Hour + 1);
private DateTime DtInizio { get; set; } = DateTime.Today.AddMonths(-1);
private InstallStatusDTO InfoStats { get; set; } = new InstallStatusDTO();
private bool isLoading { get; set; } = false;
[Inject]
private IJSRuntime JSRuntime { get; set; }
private List<DeviceDTO> ListDev2Show { get; set; } = new List<DeviceDTO>();
private Dictionary<string, DeviceDTO> ListDevices { get; set; } = new Dictionary<string, DeviceDTO>();
#endregion Private Properties
#region Private Methods
private string BtnState(int numRec, string cssAct = "text-success")
{
return numRec > 0 ? cssAct : "text-secondary";
}
/// <summary>
/// lancio richiesta udpate app info x ogni IMP gestito...
/// </summary>
private async Task DoMassiveRequest(Core.Enum.EgwAccTask reqType)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler inviare un comando di {reqType} a tutti i devices?"))
return;
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler proseguire? Verranno interesati {InfoStats.TotalUpdaterAct} devices."))
return;
var listCodImp = InfoStats.InstDevices.Select(x => x.Value.CodImp).ToList();
LMDService.TaskReqAdd(listCodImp, reqType, $"{DateTime.Now:yyyy-MM-dd HH:mm:ss}");
}
/// <summary>
/// Evento refresh legato a ricezione evento da MessagePipe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async Task EnrollMessPipe_EA_NewMessage(object sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// qualsiasi messaggio fa scattare reload data
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
isLoading = true;
await InvokeAsync(StateHasChanged);
await ReloadLicData();
await ReloadData();
isLoading = false;
await InvokeAsync(StateHasChanged);
}
}
/// <summary>
/// Selezionato CodImp (PC)
/// </summary>
/// <exception cref="NotImplementedException"></exception>
private async Task MServ_EA_SelCodImp()
{
isLoading = true;
// se trovo salvate in preferenze utente le info necessarie...
CodImpSel = MServ.UsrParamGet("CodImp");
HasFiltImpiego = !string.IsNullOrEmpty(CodImpSel);
DetailFilt.Clear();
DetailFilt.Add("Cliente", MServ.UsrParamGet("Cliente"));
DevName = MServ.UsrParamGet("PcInst");
DetailFilt.Add("PC", DevName);
DetailFilt.Add("SW ver.", MServ.UsrParamGet("Version"));
DetailFilt.Add("IP", MServ.UsrParamGet("PcIP"));
DetailFilt.Add("Started", MServ.UsrParamGet("PcRestart"));
ReloadTaskStatus();
isLoading = false;
await InvokeAsync(StateHasChanged);
}
/// <summary>
/// Selezionato CodInstall (Cliente)
/// </summary>
/// <exception cref="NotImplementedException"></exception>
private async Task MServ_EA_SelCodInst()
{
isLoading = true;
CodInstSel = MServ.UsrParamGet("CodInst");
HasFiltClienti = !string.IsNullOrEmpty(CodInstSel);
ReloadDevices();
isLoading = false;
await InvokeAsync(StateHasChanged);
}
private async Task ReloadData()
{
isLoading = true;
InfoStats = await LMDService.InstallStatusGetInfo(DtInizio, DtFine, CodInstSel, CodTipoApp);
ReloadDevices();
ReloadTaskStatus();
isLoading = false;
}
private void ReloadDevices()
{
ListDevices = new Dictionary<string, DeviceDTO>();
if (InfoStats != null)
{
// se necessario filtro...
if (HasFiltClienti)
{
ListDevices = InfoStats
.InstDevices
.Where(x => x.Value.CodInst == CodInstSel)
.OrderBy(x => x.Value.DevName)
.ToDictionary(x => x.Key, x => x.Value);
}
else
{
ListDevices = InfoStats
.InstDevices
.OrderBy(x => x.Value.DevName)
.ToDictionary(x => x.Key, x => x.Value);
}
}
}
private async Task ReloadLicData()
{
ListInstall = await LMDService.InstallazioniNextGetAll();
}
/// <summary>
/// Esegue update stato task
/// </summary>
private void ReloadTaskStatus()
{
TaskReq = LMDService.TaskListReqGet();
TaskRun = LMDService.TaskListRunGet();
TaskDone = LMDService.TaskListDoneGet();
}
/// <summary>
/// Imposta status visualizzazione dettaglio
/// </summary>
/// <param name="newStatus"></param>
private async void ShowDetail(Core.Enum.UpdStatus newStatus)
{
UpdStatusReq = newStatus;
ListDev2Show = new List<DeviceDTO>();
Dictionary<string, string> dictCurr = new Dictionary<string, string>();
switch (UpdStatusReq)
{
case Core.Enum.UpdStatus.Pending:
dictCurr = TaskReq;
break;
case Core.Enum.UpdStatus.Running:
dictCurr = TaskRun;
break;
case Core.Enum.UpdStatus.Done:
dictCurr = TaskDone;
break;
case Core.Enum.UpdStatus.None:
default:
break;
}
// filtro x stato richiesto...
List<DeviceDTO> list2show = new List<DeviceDTO>();
foreach (var item in ListDevices)
{
if (dictCurr.ContainsKey(item.Key))
{
// sistemo dataora in obj...
string rawDate = dictCurr[item.Key];
if (DateTime.TryParse(rawDate, out var date))
{
item.Value.LastUpdate = date;
}
list2show.Add(item.Value);
}
}
ListDev2Show = list2show;
await InvokeAsync(StateHasChanged);
}
/// <summary>
/// Evento refresh legato a ricezione evento da MessagePipe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async Task UpdActMessPipe_EA_NewMessage(object sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// qualsiasi messaggio fa scattare reload data
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
isLoading = true;
ReloadTaskStatus();
isLoading = false;
await InvokeAsync(StateHasChanged);
}
}
#endregion Private Methods
}
}
@@ -1,3 +0,0 @@
.body-height {
min-height: 10rem;
}
+27 -27
View File
@@ -13,16 +13,13 @@ namespace LiMan.UI.Components
#region Public Properties
[Parameter]
public EventCallback<string> EC_LockIdSel { get; set; }
public string searchVal { get; set; } = "";
[Parameter]
public string LockId { get; set; } = "";
[Parameter]
public int ProdId { get; set; } = 0;
[Parameter]
public string searchVal { get; set; } = "";
public string LockId { get; set; } = "";
#endregion Public Properties
@@ -33,6 +30,21 @@ namespace LiMan.UI.Components
#endregion Protected Properties
#region Private Properties
private List<LicenceModel> AllRecords { get; set; } = new List<LicenceModel>();
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
private List<LicenceModel> ListRecords { get; set; } = new List<LicenceModel>();
private int numRecord { get; set; } = 10;
private List<LicenceModel> SearchRecords { get; set; } = new List<LicenceModel>();
private int totalCount { get; set; } = 0;
#endregion Private Properties
#region Protected Methods
protected override async Task OnInitializedAsync()
@@ -46,11 +58,6 @@ namespace LiMan.UI.Components
// aggiorno
}
protected async Task ReportLockId(string lockId)
{
await EC_LockIdSel.InvokeAsync(lockId);
}
protected void setNumPage(int newNum)
{
currPage = newNum;
@@ -67,23 +74,16 @@ namespace LiMan.UI.Components
#endregion Protected Methods
#region Private Properties
private List<LicenceModel> AllRecords { get; set; } = new List<LicenceModel>();
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
private List<LicenceModel> ListRecords { get; set; } = new List<LicenceModel>();
private int numRecord { get; set; } = 10;
private List<LicenceModel> SearchRecords { get; set; } = new List<LicenceModel>();
private int totalCount { get; set; } = 0;
#endregion Private Properties
#region Private Methods
protected async Task ReportLockId(string lockId)
{
await EC_LockIdSel.InvokeAsync(lockId);
}
[Parameter]
public EventCallback<string> EC_LockIdSel { get; set; }
private void ReloadAllData()
{
// rileggo i dati
@@ -91,8 +91,8 @@ namespace LiMan.UI.Components
if (!string.IsNullOrEmpty(searchVal) || !string.IsNullOrEmpty(LockId))
{
SearchRecords = AllRecords
.Where(x => (ProdId == 0 || x.ProductID == ProdId) && (string.IsNullOrEmpty(LockId) || x.LockID.Contains(LockId, StringComparison.CurrentCultureIgnoreCase))
&& (string.IsNullOrEmpty(searchVal) || (
.Where(x => (ProdId == 0 || x.ProductID == ProdId) && (string.IsNullOrEmpty(LockId) || x.LockID.Contains(LockId, StringComparison.CurrentCultureIgnoreCase))
&& (string.IsNullOrEmpty(searchVal) || (
(!string.IsNullOrEmpty(x.Note) && x.Note.Contains(searchVal, StringComparison.CurrentCultureIgnoreCase))
|| x.ProductVersion.ToString().Contains(searchVal, StringComparison.CurrentCultureIgnoreCase)
|| (!string.IsNullOrEmpty(x.Note) && x.Note.Contains(searchVal, StringComparison.CurrentCultureIgnoreCase))
+1 -1
View File
@@ -14,7 +14,7 @@
<div class="col-12 col-lg-4 col-xl-6 d-none d-lg-block text-center h4 text-truncate">
<CmpPageTitle CurrIcon="@PageIcon" CurrName="@PageName"></CmpPageTitle>
</div>
<div class="col-5 col-md-6 col-lg-4 col-xl-3 text-end">
<div class="col-5 col-md-6 col-lg-4 col-xl-3 text-right">
@if (ShowSearch)
{
<SearchMod></SearchMod>
+7 -7
View File
@@ -18,13 +18,13 @@ namespace LiMan.UI.Components
public void Dispose()
{
MServ.EA_PageUpdated -= OnPageUpdate;
AppMessages.EA_PageUpdated -= OnPageUpdate;
}
public void OnPageUpdate()
{
PageName = MServ.PageName;
PageIcon = MServ.PageIcon;
PageName = AppMessages.PageName;
PageIcon = AppMessages.PageIcon;
InvokeAsync(() =>
{
StateHasChanged();
@@ -36,7 +36,7 @@ namespace LiMan.UI.Components
#region Protected Properties
[Inject]
protected MessageService MServ { get; set; } = null!;
protected MessageService AppMessages { get; set; } = null!;
[Inject]
protected LiManDataService DataService { get; set; } = null!;
@@ -51,7 +51,7 @@ namespace LiMan.UI.Components
protected override void OnInitialized()
{
MServ.EA_PageUpdated += OnPageUpdate;
AppMessages.EA_PageUpdated += OnPageUpdate;
}
protected override async Task OnInitializedAsync()
@@ -75,8 +75,8 @@ namespace LiMan.UI.Components
private string userName
{
get => MServ.UserName;
set => MServ.UserName = value;
get => AppMessages.UserName;
set => AppMessages.UserName = value;
}
#endregion Private Properties
+8 -47
View File
@@ -13,61 +13,22 @@
<div class="row">
<div class="col-12 col-lg-10">
<div class="row">
<div class="col-6 col-lg-3">
<div class="col-12 col-lg-3">
<div class="input-group">
<span class="input-group-text">
Codice
</span>
<span class="input-group-text">
Codice
</span>
<InputText @bind-Value="@_currItem.CodApp" class="form-control"></InputText>
</div>
</div>
<div class="col-6 col-lg-3">
<div class="col-12 col-lg-9">
<div class="input-group">
<span class="input-group-text">
Tipo
</span>
<InputSelect @bind-Value="_currItem!.Tipo" class="form-select">
<option value="">
--Selezionare--
</option>
<option checked="@(_currItem!.Tipo == "WebApp")" value="WebApp">
WebApp
</option>
<option checked="@(_currItem!.Tipo == "WinApp")" value="WinApp">
WinApp
</option>
<option checked="@(_currItem!.Tipo == "Machine")" value="Machine">
Machine
</option>
<option checked="@(_currItem!.Tipo == "Cli")" value="Cli">
Cli
</option>
</InputSelect>
</div>
</div>
<div class="col-12 col-lg-6">
<div class="input-group">
<span class="input-group-text">
Descrizione
</span>
<span class="input-group-text">
Descrizione
</span>
<InputText @bind-Value="@_currItem.Descrizione" class="form-control"></InputText>
</div>
</div>
<div class="col-12">
<div class="input-group">
<span class="input-group-text">
Db ConnString (opz.)
</span>
@if (UserHasClaim("Admin"))
{
<InputText @bind-Value="@_currItem.TplConnString" class="form-control"></InputText>
}
else
{
<input class="form-control" disabled type="password" value="********************************************" />
}
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2">
+55 -63
View File
@@ -11,38 +11,22 @@ namespace LiMan.UI.Components
{
public partial class EditApplicazioni
{
#region Public Properties
[Parameter]
public ApplicativoModel currItem
{
get
{
return _currItem;
}
set
{
_currItem = value;
}
}
[Parameter]
public EventCallback<int> DataReset { get; set; }
[Parameter]
public EventCallback<int> DataUpdated { get; set; }
[Parameter]
public string UserName { get; set; } = "";
#endregion Public Properties
#region Protected Fields
protected ApplicativoModel _currItem = new ApplicativoModel();
#endregion Protected Fields
#region Private Properties
[Inject]
private IJSRuntime JSRuntime { get; set; }
[Inject]
private NavigationManager NavManager { get; set; }
#endregion Private Properties
#region Protected Properties
[Inject]
@@ -67,6 +51,51 @@ namespace LiMan.UI.Components
#endregion Protected Properties
#region Public Properties
[Parameter]
public ApplicativoModel currItem
{
get
{
return _currItem;
}
set
{
_currItem = value;
}
}
[Parameter]
public EventCallback<int> DataReset { get; set; }
[Parameter]
public EventCallback<int> DataUpdated { get; set; }
#endregion Public Properties
#region Private Methods
private async Task cancelUpdate()
{
await DataReset.InvokeAsync(0);
}
private async Task saveUpdate()
{
if (_currItem != null)
{
await DataService.ApplicazioniNextUpdate(_currItem);
await DataUpdated.InvokeAsync(0);
}
else
{
Console.WriteLine("Record null!");
}
}
#endregion Private Methods
#region Protected Methods
/// <summary>
@@ -81,43 +110,6 @@ namespace LiMan.UI.Components
return q[parmName] ?? "";
}
protected bool UserHasClaim(string ruolo)
{
return DataService.UserHasClaim(UserName, ruolo);
}
#endregion Protected Methods
#region Private Properties
[Inject]
private IJSRuntime JSRuntime { get; set; }
[Inject]
private NavigationManager NavManager { get; set; }
#endregion Private Properties
#region Private Methods
private async Task cancelUpdate()
{
await DataReset.InvokeAsync(0);
}
private async Task saveUpdate()
{
if (_currItem != null)
{
await DataService.ApplicNextUpdate(_currItem);
await DataUpdated.InvokeAsync(0);
}
else
{
Console.WriteLine("Record null!");
}
}
#endregion Private Methods
}
}
+1 -1
View File
@@ -72,7 +72,7 @@ namespace LiMan.UI.Components
_currItem = value;
var pUpd = Task.Run(async () =>
{
ListApp = await DataService.ApplicNextGetAll(false);
ListApp = await DataService.ApplicazioniNextGetAll();
ListInstall = await DataService.InstallazioniNextGetAll();
});
pUpd.Wait();
+8 -16
View File
@@ -8,6 +8,14 @@
<div class="row">
<div class="col-12 col-lg-10">
<div class="row">
<div class="col-12">
<div class="input-group">
<span class="input-group-text">
Rilascio
</span>
<InputDate @bind-Value="@_currItem.ReleaseDate" class="form-control text-end"></InputDate>
</div>
</div>
<div class="col-6">
<div class="input-group">
<span class="input-group-text">
@@ -24,22 +32,6 @@
<InputText @bind-Value="@_currItem.VersText" class="form-control text-end"></InputText>
</div>
</div>
<div class="col-4">
<div class="input-group">
<span class="input-group-text">
Rilascio
</span>
<InputDate @bind-Value="@_currItem.ReleaseDate" class="form-control text-end"></InputDate>
</div>
</div>
<div class="col-8">
<div class="input-group">
<span class="input-group-text">
Tags
</span>
<InputText @bind-Value="@_currItem.RelTags" class="form-control text-end"></InputText>
</div>
</div>
</div>
</div>
<div class="col-12 col-lg-2">
-284
View File
@@ -1,284 +0,0 @@
@if (isLoading)
{
<LoadingData></LoadingData>
}
else if (SelRecord != null)
{
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
<div class="modal-dialog modal-xl shadow">
<div class="modal-content">
<div class="modal-header d-flex justify-content-between py-2">
<div class="px-2">
<h4>Gestione / Assegnazione Licenza</h4>
</div>
<div class="px-2">
<button class="btn my-2 btn-outline-dark w-100" @onclick="ResetSel" title="Torna ad elenco">Chiudi <i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="modal-body p-0">
<div class="row mx-0">
<div class="col-8">
<div class="card shadow shadow-lg my-1 mx-0">
<div class="card-header text-center p-1">
<h4 class="mb-0 fw-bold">@($"{SelRecord.Passcode:00 00 00 00}")</h4>
</div>
<div class="card-body p-1">
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between active">
<div class="px-0">
Richiesta:
</div>
<div class="px-0">
@($"{SelRecord.DtReq:ddd yyyy-MM-dd, HH:MM:ss}")
</div>
</li>
@foreach (var kvp in SelRecord.DictAttrib)
{
<li class="list-group-item d-flex justify-content-between">
<div class="px-0 small">@kvp.Key:</div>
<div class="px-0"><b>@kvp.Value</b></div>
</li>
}
</ul>
</div>
</div>
</div>
<div class="col-4">
<div class="card shadow shadow-lg my-1 mx-0">
<div class="card-header text-center p-1">
<h4 class="mb-0">Azioni Ammesse</h4>
</div>
<div class="card-body">
@if (ShowAddLic)
{
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header d-flex justify-content-between">
<div class="px-0">
<b>Nuova Licenza Updater</b>
</div>
<div class="px-0">
<button type="button" class="btn btn-dark" data-dismiss="modal" @onclick="ToggleAddNew">Chiudi <i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="modal-body">
<div class="form-floating">
<select id="floatingSelect" @bind="@SelCodInst" class="form-select">
<option value="">--- Nessuna selezione ---</option>
@if (ListInstall != null)
{
foreach (var item in ListInstall)
{
<option value="@item.CodInst">@item.Cliente | @item.CodInst</option>
}
}
</select>
<label for="floatingSelect">Selezione Cliente/Installazione</label>
</div>
</div>
<div class="modal-footer">
<button class="btn btn-success btn-lg w-100" @onclick="() => AddLicense()"><i class="fa-solid fa-circle-plus"></i> Crea Nuova Licenza</button>
</div>
</div>
</div>
</div>
}
else if (ShowEditLic)
{
<div class="modal fade show" tabindex="-1" style="display:block; background-color: rgba(10,10,10,.6);" aria-modal="true" role="dialog" data-keyboard="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header d-flex justify-content-between">
<div class="px-0">
<b>Edit Licenza Updater</b>
</div>
<div class="px-0">
<button type="button" class="btn btn-dark" data-dismiss="modal" @onclick="ToggleEditLic">Chiudi <i class="fa-solid fa-xmark"></i></button>
</div>
</div>
<div class="modal-body">
<div class="form-floating">
<select id="floatingSelect" @bind="@SelIdxLic" class="form-select">
<option value="0">--- Nessuna selezione ---</option>
@if (ListLicenze != null)
{
foreach (var item in ListLicenze)
{
if (item.Attivazioni.Count < item.NumLicenze)
{
<option value="@item.IdxLic">@item.CodApp | @item.CodInst | @item.Attivazioni.Count / @item.NumLicenze</option>
}
else
{
<option value="@item.IdxLic" disabled>@item.CodApp | @item.CodInst | @item.Attivazioni.Count / @item.NumLicenze | Esaurito</option>
}
}
}
</select>
<label for="floatingSelect">Selezione Licenza Esistente</label>
</div>
</div>
<div class="modal-footer">
@if (SelIdxLic > 0)
{
<button class="btn btn-success btn-lg w-100" @onclick="() => AddActivations()" title="Aggiunta attivazioni a licenza selezionata"><i class="fa-solid fa-circle-plus"></i> 10 Attivazioni Licenza</button>
}
else
{
<button class="btn btn-secondary btn-lg w-100" disabled><i class="fa-solid fa-circle-plus"></i> 10 Attivazioni Licenza</button>
}
</div>
</div>
</div>
</div>
}
@if (SelRecord.IdxLic == 0)
{
<button class="btn btn-sm my-2 btn-success w-100" @onclick="ToggleAddNew" title="Aggiunta nuova licenza Cliente (Installazione)">Add New Inst <i class="fa-solid fa-plus"></i></button>
}
<button class="btn btn-sm btn-primary w-100" @onclick="ToggleEditLic" title="incrementa numero Attivazioni permesse per Licenza Cliente (Installazione) già attiva">Incrementa # Attivazioni permesse <i class="fa-solid fa-edit"></i></button>
<div class="row my-3">
<div class="col-12">
@if (SelRecord.IdxLic == 0)
{
<div>
<b>Assegnazione a Cliente/Installazione</b>
</div>
<div class="form-floating">
<select id="floatingSelect" @bind="@SelIdxLic" class="form-select">
<option value="0">--- Nessuna selezione ---</option>
@if (ListLicenze != null)
{
foreach (var item in ListLicenze)
{
if (item.Attivazioni.Count < item.NumLicenze)
{
<option value="@item.IdxLic">@item.CodApp | @item.CodInst | @item.Attivazioni.Count / @item.NumLicenze</option>
}
else
{
<option value="@item.IdxLic" disabled>@item.CodApp | @item.CodInst | @item.Attivazioni.Count / @item.NumLicenze | Esaurito</option>
}
}
}
</select>
<label for="floatingSelect">Selezione Licenza Esistente</label>
</div>
@if (string.IsNullOrEmpty(SelRecord.UserAppr) && SelIdxLic > 0)
{
<button class="btn btn-success btn-lg w-100 my-2" @onclick="() => DoApprove()"><i class="fa-regular fa-thumbs-up"></i> Approva + Assegna Licenza</button>
}
}
else
{
<ul class="list-group my-3">
<li class="list-group-item d-flex justify-content-between">
<div class="px-1">Licenza assegnata: </div>
<div class="px-1"><b>@SelRecord.IdxLic</b></div>
</li>
<li class="list-group-item d-flex justify-content-between">
<div class="px-1">Approvatore: </div>
<div class="px-1"><b>@SelRecord.UserAppr</b></div>
</li>
</ul>
}
</div>
</div>
@if (!string.IsNullOrEmpty(SelRecord.UserAppr))
{
<button class="btn btn-sm btn-danger w-100" @onclick="DoDelete" title="Elimina Enroll ed attivazione dalla Licenza collegata">Elimina Enroll + Attivazione <i class="fa-solid fa-trash"></i></button>
}
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
}
else if (SearchRecords == null || SearchRecords.Count == 0)
{
<div class="alert alert-warning p-2 m-2 text-center">No record Found</div>
}
else
{
<div class="row">
@foreach (var item in ListRecords)
{
<div class="col-3 px-1">
<div class="card shadow shadow-lg m-2">
<div class="card-header text-center">
<h3>@($"{item.Passcode:00 00 00 00}")</h3>
</div>
<div class="card-body p-1">
<ul class="list-group">
<li class="list-group-item d-flex justify-content-between active">
<div class="px-0">
Richiesta:
</div>
<div class="px-0">
@($"{item.DtReq:ddd yyyy-MM-dd, HH:MM:ss}")
</div>
</li>
@if (item.DictNumKVP() > nShort)
{
@foreach (var kvp in item.DictAttribShort(nShort))
{
<li class="list-group-item d-flex justify-content-between">
<div class="px-0 small">@kvp.Key:</div>
<div class="px-0"><b>@kvp.Value</b></div>
</li>
}
<li class="list-group-item d-flex justify-content-between">
<div class="px-0">
@if (string.IsNullOrEmpty(item.UserAppr))
{
<button class="btn btn-success btn-sm" @onclick="() => DoSelect(item)">Select</button>
}
else
{
<button class="btn btn-secondary btn-sm" @onclick="() => DoSelect(item)">ShowDetail</button>
}
</div>
<div class="px-0"><i>...@(item.DictNumKVP() - nShort) more</i></div>
</li>
}
else
{
@foreach (var kvp in item.DictAttrib)
{
<li class="list-group-item d-flex justify-content-between">
<div class="px-0">@kvp.Key:</div>
<div class="px-0"> <b>@kvp.Value</b> </div>
</li>
}
}
</ul>
</div>
<div class="card-footer">
<div class="d-flex justify-content-between small">
<div class="px-1">UpdateManager</div>
<div class="px-1 fw-bold">@(DescrLic(item.IdxLic))</div>
</div>
</div>
</div>
</div>
}
</div>
<div class="row">
<div class="col-12">
<div class="card-footer">
@if (totalCount > numRecord)
{
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="setNumRec" numPageChanged="setNumPage" totalCount="totalCount" showLoading="isLoading" PageSizeList="PageList" />
}
</div>
</div>
</div>
}
-359
View File
@@ -1,359 +0,0 @@
using Liman.CadCam.Services;
using LiMan.DB;
using LiMan.DB.DBModels;
using LiMan.UI.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.AspNetCore.Components.Authorization;
using Microsoft.JSInterop;
using Newtonsoft.Json;
using NLog.LayoutRenderers;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static Core.Enum;
namespace LiMan.UI.Components
{
public partial class EnrollList : IDisposable
{
#region Public Properties
[Parameter]
public DateTime DtEnd { get; set; } = DateTime.Today.AddDays(1);
[Parameter]
public DateTime DtStart { get; set; } = DateTime.Today.AddMonths(-1);
[Parameter]
public int IdxLicSel { get; set; } = 0;
[Parameter]
public bool OnlyActive { get; set; } = true;
[Parameter]
public string SearchVal { get; set; } = "";
#endregion Public Properties
#region Public Methods
/// <summary>
/// Metodo dispose
/// </summary>
public virtual void Dispose()
{
LMDService.EnrollMessPipe.EA_NewMessage -= async (sender, e) => await EnrollMessPipe_EA_NewMessage(sender, e);
}
#endregion Public Methods
#region Protected Properties
[Inject]
protected AuthenticationStateProvider AuthStateProvider { get; set; } = null!;
[Inject]
protected LiManDataService LMDService { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
/// <summary>
/// Aggiunge all licenza selezionata altri 10 slot...
/// </summary>
/// <returns></returns>
protected async Task AddActivations()
{
// chiedo conferma...
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler aggiungere 10 ulteriori slot alla licenza {SelCodInst}? L'operazione non è reversibile"))
return;
var currLic = LMDService.LicenzaNextGetByIdx(SelIdxLic);
currLic.NumLicenze += 10;
// aggiorno chiave calcolata
currLic.Chiave = currLic.ChiaveCalc;
await LMDService.LicenzeNextUpdate(currLic);
LMDService.EnrollMessPipe.sendMessage("LicUpdated");
ShowAddLic = false;
ShowEditLic = false;
await ReloadLicData();
}
/// <summary>
/// Aggiunge la licenza selezionata x 10 slot...
/// </summary>
/// <returns></returns>
protected async Task AddLicense()
{
// chiedo conferma...
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler aggiungere la richiesta per l'installazione {SelCodInst}? L'operazione non è reversibile"))
return;
LicenzaModel newLic = new LicenzaModel()
{
CodApp = "UpdateManager",
CodInst = SelCodInst,
NumLicenze = 10,
Tipo = TipoLicenza.MasterKey,
Scadenza = new DateTime(2099, 12, 31),
Descrizione = "Licenza per Richieste Enroll Applicativi",
Enigma = "",
Payload = "",
};
// aggiungo chiave calcolata
newLic.Chiave = newLic.ChiaveCalc;
await LMDService.LicenzeNextUpdate(newLic);
LMDService.EnrollMessPipe.sendMessage("LicAdded");
ShowAddLic = false;
ShowEditLic = false;
await ReloadLicData();
}
/// <summary>
/// Recupera info licenza dato Idx x indicare licenza di assegnazione dell'enroll
/// </summary>
/// <param name="idxLic"></param>
/// <returns></returns>
protected string DescrLic(int idxLic)
{
string answ = "NA";
if (idxLic > 0 && ListLicenze != null && ListLicenze.Count > 0)
{
var sRec = ListLicenze.FirstOrDefault(x => x.IdxLic == idxLic);
if (sRec != null)
{
answ = $"{sRec.CodInst}";
}
}
return answ;
}
protected async Task DoApprove()
{
// chiedo conferma...
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler confermare la richiesta?"))
return;
var authState = await AuthStateProvider.GetAuthenticationStateAsync();
var user = authState.User;
if (user.Identity.IsAuthenticated && !string.IsNullOrEmpty(user.Identity.Name))
{
// registra approvazione
SelRecord.DtAppr = DateTime.Now;
SelRecord.UserAppr = user.Identity.Name;
SelRecord.IdxLic = SelIdxLic;
await LMDService.EnrollReqUpsert(SelRecord);
LMDService.EnrollMessPipe.sendMessage("AppApproved");
SelRecord = null;
await ReloadData();
}
}
protected async Task DoDelete()
{
if (SelRecord != null)
{
// chiedo conferma...
if (!await JSRuntime.InvokeAsync<bool>("confirm", "Sicuro di voler eliminare il record?"))
return;
// cerca l'attivazione collegata x DeviceID (contenuto nel payload) e se lo trova la elimina
List<SubLicenzaModel> listAtt = await LMDService.AttivazioniGetByLic(SelRecord.IdxLic);
// se ne ho trovate cerco...
if (listAtt.Count > 0)
{
var dictPayload = JsonConvert.DeserializeObject<Dictionary<string, string>>(SelRecord.ReqPayload);
if (dictPayload != null && dictPayload.Count > 0)
{
string DeviceID = "";
if (dictPayload.ContainsKey("DeviceID"))
{
DeviceID = dictPayload["DeviceID"];
}
// cerco attivazioni correlate (tutte)
var rec2del = listAtt.Where(x => x.CodImpiego == DeviceID).ToList();
if (rec2del != null)
{
foreach (var rec in rec2del)
{
// elimino InstRel data
int numDel = LMDService.InstallRelDelBySubLic(rec.IdxSubLic);
// elimino attivazioni
await LMDService.AttivazioneDelete(rec.IdxSubLic);
}
}
}
}
await LMDService.EnrollReqDelete(SelRecord.IdReq);
await Task.Delay(10);
SelRecord = null;
await ReloadData();
}
}
protected async Task DoSelect(EnrollRequestModel curRec)
{
SelRecord = curRec;
await ReloadLicData();
}
/// <summary>
/// init sottoscrizione messaggi + refresh dati
/// </summary>
/// <returns></returns>
protected override async Task OnInitializedAsync()
{
LMDService.EnrollMessPipe.EA_NewMessage += async (sender, e) => await EnrollMessPipe_EA_NewMessage(sender, e);
await ReloadData();
}
protected override async Task OnParametersSetAsync()
{
await ReloadLicData();
await ReloadData();
}
protected async Task ResetSel()
{
SelRecord = null;
await ReloadData();
}
protected async Task setNumPage(int newNum)
{
currPage = newNum;
await ReloadData();
isLoading = false;
}
protected async Task setNumRec(int newNum)
{
currPage = 1;
numRecord = newNum;
await ReloadData();
isLoading = false;
}
protected void ToggleAddNew()
{
ShowAddLic = !ShowAddLic;
}
protected void ToggleEditLic()
{
ShowEditLic = !ShowEditLic;
}
#endregion Protected Methods
#region Private Fields
private List<InstallazioneModel> ListInstall;
private List<LicenzaModel> ListLicenze;
/// <summary>
/// num max di dettagli KVP da mostrare
/// </summary>
private int nShort = 3;
private List<int> PageList = new List<int>() { 4, 8, 12, 16, 24, 48 };
/// <summary>
/// Codice installazione selezionata
/// </summary>
private string SelCodInst = "";
/// <summary>
/// Idx licenza selezionata
/// </summary>
private int SelIdxLic = 0;
private bool ShowAddLic = false;
private bool ShowEditLic = false;
#endregion Private Fields
#region Private Properties
private int currPage { get; set; } = 1;
private bool isLoading { get; set; } = false;
[Inject]
private IJSRuntime JSRuntime { get; set; }
private List<EnrollRequestModel> ListRecords { get; set; } = new List<EnrollRequestModel>();
private int numRecord { get; set; } = 8;
private List<EnrollRequestModel> SearchRecords { get; set; } = new List<EnrollRequestModel>();
private EnrollRequestModel? SelRecord { get; set; } = null;
private int totalCount { get; set; } = 0;
#endregion Private Properties
#region Private Methods
/// <summary>
/// Evento refresh legato a ricezione evento da MessagePipe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async Task EnrollMessPipe_EA_NewMessage(object sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// qualsiasi messaggio fa scattare reload data
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
isLoading = true;
//await InvokeAsync(StateHasChanged);
await LMDService.FlushEnrollCache();
//await Task.Delay(50);
await ReloadData();
await InvokeAsync(StateHasChanged);
}
}
private async Task ReloadData()
{
isLoading = true;
SearchRecords = await LMDService.EnrollReqGetFilt(OnlyActive, DtStart, DtEnd);
if (IdxLicSel > 0)
{
SearchRecords = SearchRecords.Where(x => x.IdxLic == IdxLicSel).ToList();
}
if (!string.IsNullOrEmpty(SearchVal))
{
SearchRecords = SearchRecords.Where(x => $"{x.Passcode}".Contains(SearchVal)).ToList();
}
totalCount = SearchRecords.Count;
ListRecords = SearchRecords
.Skip((currPage - 1) * numRecord)
.Take(numRecord)
.ToList();
isLoading = false;
}
private async Task ReloadLicData()
{
SelectNext currFilt = new SelectNext()
{
ApplicazioneSel = "UpdateManager"
};
var rawList = await LMDService.LicenzeNextGetFilt(currFilt);
ListLicenze = rawList
.OrderBy(x => x.CodApp)
.ThenBy(x => x.CodInst)
.ToList();
ListInstall = await LMDService.InstallazioniNextGetAll();
}
#endregion Private Methods
}
}
-95
View File
@@ -1,95 +0,0 @@
<div class="row p-0">
<div class="@CssDivMain px-1">
<div class="card shadow">
<div class="card-header">
<div class="text-end">Vers. Corrente: <b>@CurrRecord.VersNumCurrent</b></div>
</div>
<div class="card-body p-1">
<table class="table table-sm table-striped table-responsive-lg small">
<thead>
<tr>
<th>
<button class="btn btn-sm btn-dark @CssResetCli" title="Rimuovi Filtro Cliente" @onclick="ResetCliente"><i class="fa-solid fa-rotate-right"></i> Cliente</button>
<Sorter ParamName="CodInst" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th>
<button class="btn btn-sm btn-primary @CssResetImp" title="Rimuovi Filtro Dispositivo" @onclick="ResetCodImp"><i class="fa-solid fa-rotate-right"></i> Dispositivo</button>
<Sorter ParamName="PcInst" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
@if (!HasFiltImp)
{
<th>
# Lic.
<Sorter ParamName="NumImp" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th class="text-end">
Versione
<Sorter ParamName="VersNumInstall" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
}
</tr>
</thead>
<tbody>
@foreach (var record in ListRecord)
{
<tr>
<td>
<button class="btn btn-sm @CssBtnInst(record.CodInst) py-1 text-truncate" title="Fissa Cliente" @onclick="() => SetCliente(record)"><i class="fa-solid fa-location-crosshairs"></i> @record.Cliente</button>
</td>
<td>
<button class="btn btn-sm @CssBtnImp(record.CodImp) py-1 text-truncate" title="Fissa Dispositivo" @onclick="() => SetCodImp(record)"><i class="fa-solid fa-location-crosshairs"></i> @record.PcInst</button>
</td>
@if (!HasFiltImp)
{
<td>@record.NumImp</td>
<td class="text-end @cssVers(record)">@record.VersNumInstall</td>
}
</tr>
}
</tbody>
</table>
</div>
<div class="card-footer">
@if (totalCount > numRecord)
{
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="setNumRec" numPageChanged="setNumPage" totalCount="totalCount" showLoading="isLoading" />
}
</div>
</div>
</div>
<div class="@CssDivDetail px-2">
@if (HasFiltImp)
{
<div class="row">
<div class="col-5 px-1">
<div class="mb-1">
<ListAppShort AppList="AppInstList" EC_ReqUpdateApp="ProcReqUpdate"></ListAppShort>
</div>
<div class="mb-1">
<ListInfoShort Title="License Data" DetailInfo="LicInfo" EnabAbbrev="true" MaxKeyChar="30"></ListInfoShort>
</div>
</div>
<div class="col-7 px-1">
<div class="mb-1">
<ListInfoShort Title="Device Info" DetailInfo="DevInfo"></ListInfoShort>
</div>
<div class="mb-1">
<ListInfoShort Title="Updater Stats" DetailInfo="RunStats"></ListInfoShort>
</div>
</div>
</div>
}
else
{
<div class="card shadow">
<div class="card-header">
<b>Distribuzione</b>
</div>
<div class="card-body px-1 py-3">
<Doughnut Id="RelVers" Type="@Doughnut.ChartType.Doughnut" Data="@ChartData" Labels="ChartLabels" BackgroundColor="@ChartColor" BordWidth="1"></Doughnut>
</div>
</div>
}
</div>
</div>
-582
View File
@@ -1,582 +0,0 @@
using EgwCoreLib.Razor.Data;
using LiMan.DB;
using LiMan.DB.DTO;
using LiMan.UI.Data;
using Microsoft.AspNetCore.Components;
using Microsoft.IdentityModel.Tokens;
using Microsoft.JSInterop;
using Newtonsoft.Json;
using Org.BouncyCastle.Ocsp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using static Core.Enum;
using static EgwCoreLib.Razor.Sorter;
namespace LiMan.UI.Components
{
public partial class InstAppPareto : IDisposable
{
#region Public Properties
[Parameter]
public List<AppRelStatusDTO> AppDetList { get; set; } = new List<AppRelStatusDTO>();
[Parameter]
public AppStatusDTO CurrRecord { get; set; } = null!;
#endregion Public Properties
#region Public Methods
public void Dispose()
{
LMDService.TaskMessPipe.EA_NewMessage -= async (sender, e) => await TaskMessPipe_EA_NewMessage(sender, e);
}
#endregion Public Methods
#region Protected Properties
[Inject]
protected IJSRuntime JSRuntime { get; set; } = null!;
protected List<AppRelStatusDTO> ListRecord { get; set; } = new List<AppRelStatusDTO>();
[Inject]
protected LiManDataService LMDService { get; set; } = null!;
[Inject]
protected MessageService MServ { get; set; } = null!;
protected List<AppRelStatusDTO> SearchRecord { get; set; } = new List<AppRelStatusDTO>();
#endregion Protected Properties
#region Protected Methods
protected override void OnInitialized()
{
LMDService.TaskMessPipe.EA_NewMessage += async (sender, e) => await TaskMessPipe_EA_NewMessage(sender, e);
}
protected override void OnParametersSet()
{
ReloadData();
ReloadTaskStatus();
ReloadTaskResults();
ReloadCharts();
}
/// <summary>
/// Reset filtro cliente...
/// </summary>
/// <param name="currRec"></param>
protected void ResetCliente()
{
HasFlitCli = false;
CodInstSel = "";
// salvo nelle preferenze i valori CodImp e PcInst
MServ.UsrParamSet("Cliente", "");
MServ.UsrParamSet("CodInst", "");
MServ.UsrParamSet("CodImp", "");
MServ.UsrParamSet("PcInst", "");
MServ.UsrParamSet("PcRestart", "");
MServ.UsrParamSet("PcIP", "");
MServ.UsrParamSet("Version", "");
// Richiedo azione x gestione dettaglio info
MServ.ReportSelCodInst();
}
/// <summary>
/// Reset filtro PC/Impiego...
/// </summary>
/// <param name="currRec"></param>
protected void ResetCodImp()
{
HasFiltImp = false;
CodImpSel = "";
// salvo nelle preferenze i valori CodImp e PcInst
MServ.UsrParamSet("CodImp", "");
MServ.UsrParamSet("PcInst", "");
MServ.UsrParamSet("PcRestart", "");
MServ.UsrParamSet("PcIP", "");
MServ.UsrParamSet("Version", "");
// Richiedo azione x gestione dettaglio info
MServ.ReportSelCodImp();
}
/// <summary>
/// Set filtro cliente...
/// </summary>
/// <param name="currRec"></param>
protected void SetCliente(AppRelStatusDTO currRec)
{
HasFlitCli = true;
CodInstSel = currRec.CodInst;
// salvo nelle preferenze i valori CodImp e PcInst
MServ.UsrParamSet("Cliente", currRec.Cliente);
MServ.UsrParamSet("CodInst", currRec.CodInst);
MServ.UsrParamSet("CodImp", "");
MServ.UsrParamSet("PcInst", "");
MServ.UsrParamSet("PcRestart", "");
MServ.UsrParamSet("PcIP", "");
MServ.UsrParamSet("Version", "");
// Richiedo azione x gestione dettaglio info
MServ.ReportSelCodInst();
// se era selezionato impianto lo deseleziona...
if (HasFiltImp)
{
CodImpSel = "";
HasFiltImp = false;
MServ.ReportSelCodImp();
}
}
/// <summary>
/// Set filtro PC/Impiego...
/// </summary>
/// <param name="currRec"></param>
protected void SetCodImp(AppRelStatusDTO currRec)
{
HasFiltImp = true;
CodImpSel = currRec.CodImp;
AppInstList = AppDetList
.Where(x => x.CodImp == currRec.CodImp && x.IdxSubLic == currRec.IdxSubLic)
.ToList();
// se era selezionato cliente lo riseleziono...
if (HasFlitCli)
{
CodInstSel = currRec.CodInst;
MServ.ReportSelCodInst();
}
// salvo nelle preferenze i valori CodImp e PcInst
MServ.UsrParamSet("Cliente", currRec.Cliente);
MServ.UsrParamSet("CodInst", currRec.CodInst);
MServ.UsrParamSet("CodImp", currRec.CodImp);
MServ.UsrParamSet("PcInst", currRec.PcInst);
MServ.UsrParamSet("PcRestart", "");
MServ.UsrParamSet("PcIP", "");
MServ.UsrParamSet("Version", "");
ReloadTaskStatus();
ReloadTaskResults();
// cerco in stats info
if (RunStats != null && RunStats.Count > 0)
{
if (RunStats.ContainsKey("Startup"))
{
MServ.UsrParamSet("PcRestart", RunStats["Startup"]);
}
if (RunStats.ContainsKey("Version"))
{
MServ.UsrParamSet("Version", RunStats["Version"]);
}
}
// cerco nei device info
if (DevInfo != null && DevInfo.Count > 0)
{
string ipKey = "Int.0.Ipv4";
var recFound = DevInfo.Where(x => x.Key.StartsWith(ipKey)).ToList();
if (recFound.Count > 0)
{
var recIp = recFound.FirstOrDefault();
if (recIp.Key.StartsWith(ipKey))
{
MServ.UsrParamSet("PcIP", recIp.Value);
}
}
}
// Richiedo azione x gestione dettaglio info
MServ.ReportSelCodImp();
}
protected void setNumPage(int newNum)
{
currPage = newNum;
ReloadData();
isLoading = false;
}
protected void setNumRec(int newNum)
{
currPage = 1;
numRecord = newNum;
ReloadData();
isLoading = false;
}
protected void SortRequested(SortCallBack e)
{
isLoading = true;
if (sortField == e.ParamName)
{
sortAsc = e.IsAscending;
}
sortField = e.ParamName;
ReloadData();
isLoading = false;
}
#endregion Protected Methods
#region Private Fields
private List<AppRelStatusDTO> AppInstList = new List<AppRelStatusDTO>();
private List<DoughnutStyling> ChartColor = new List<DoughnutStyling>();
private double[] ChartData = new double[1];
private string[] ChartLabels = new string[1];
private string CodImpSel = "";
private string CodInstSel = "";
private int currPage = 1;
private Dictionary<string, string> DevInfo = new Dictionary<string, string>();
private bool HasFiltImp = false;
private bool HasFlitCli = false;
private bool isLoading = false;
private Dictionary<string, string> LicInfo = new Dictionary<string, string>();
private int numRecord = 10;
private Dictionary<string, string> RunStats = new Dictionary<string, string>();
private bool showDetail = false;
private string sKey = "InstAppPareto";
/// <summary>
/// Elenco task eseguiti
/// </summary>
private Dictionary<string, string> TaskDone = new Dictionary<string, string>();
private int totalCount = 0;
#endregion Private Fields
#region Private Properties
private string CssDivDetail
{
get => HasFiltImp ? "col-9" : "col-5";
}
private string CssDivMain
{
get => HasFiltImp ? "col-3" : "col-7";
}
private string CssResetCli
{
get => HasFlitCli ? "" : "disabled";
}
private string CssResetImp
{
get => HasFiltImp ? "" : "disabled";
}
private bool sortAsc
{
get
{
bool answ = false;
var sVal = MServ.UsrParamGet($"{sKey}_sort");
if (!string.IsNullOrEmpty(sVal))
{
bool.TryParse(sVal, out answ);
}
return answ;
}
set => MServ.UsrParamSet($"{sKey}_sort", $"{value}");
}
private string sortField
{
get => MServ.UsrParamGet($"{sKey}_field");
set => MServ.UsrParamSet($"{sKey}_field", $"{value}");
}
#endregion Private Properties
#region Private Methods
private string CssBtnImp(string CodImp)
{
return HasFiltImp && CodImpSel == CodImp ? "btn-primary" : "btn-outline-primary";
}
private string CssBtnInst(string CodInst)
{
return HasFlitCli && CodInstSel == CodInst ? "btn-dark" : "btn-outline-dark";
}
private string cssVers(AppRelStatusDTO rec)
{
string answ = "";
switch (rec.UpToDateStatus)
{
case 4:
answ = "text-success fw-bold";
break;
case 3:
answ = "text-success";
break;
case 2:
answ = "text-warning";
break;
case 1:
answ = "text-danger";
break;
case 0:
answ = "text-danger fw-bold";
break;
default:
break;
}
return answ;
}
private void MServ_EA_TaskUpdate()
{
ReloadTaskStatus();
ReloadTaskResults();
}
/// <summary>
/// Registrazione richiesta update app remota
/// </summary>
/// <param name="selRec"></param>
/// <returns></returns>
private async Task ProcReqUpdate(AppRelStatusDTO selRec)
{
if (!await JSRuntime.InvokeAsync<bool>("confirm", $"Sicuro di voler forzare update applicativo {selRec.CodApp} sul Device? Eventuali configurazioni presenti saranno ripristinate, altrimenti andrà verificato manualmente l'esito dell'operazione."))
return;
// invio task update applicazione
LMDService.TaskReqAdd(CodImpSel, EgwAccTask.TargetAppUpdate, selRec.CodApp);
ReloadTaskStatus();
ReloadTaskResults();
// invio notifica update...
LMDService.UpdActMessPipe.sendMessage(selRec.CodApp);
}
private void ReloadCharts()
{
// sistemo info x grafico... se ho impieghi uso quello, altrimenti istanze...
if (CurrRecord.NumImp > 0)
{
ChartData = SearchRecord
.GroupBy(x => x.VersNumInstall)
.Select(g => (double)g.Sum(x => x.NumImp))
.ToArray();
}
else
{
ChartData = SearchRecord
.GroupBy(x => x.VersNumInstall)
.Select(g => (double)g.Count())
.ToArray();
}
ChartLabels = SearchRecord
.GroupBy(x => x.VersNumInstall)
.Select(g => g.Key)
.ToArray();
ChartColor.Clear();
var listStatus = SearchRecord
.GroupBy(x => x.VersNumInstall)
.Select(g => g.First().UpToDateStatus)
.ToList();
foreach (var item in listStatus)
{
switch (item)
{
case 4:
ChartColor.Add(new DoughnutStyling("#12FF06", "#006900"));
break;
case 3:
ChartColor.Add(new DoughnutStyling("#ABFF69", "#11AA11"));
break;
case 2:
ChartColor.Add(new DoughnutStyling("#FFE493", "#AAFF00"));
break;
case 1:
ChartColor.Add(new DoughnutStyling("#FF6900", "#953500"));
break;
case 0:
ChartColor.Add(new DoughnutStyling("#AA3600", "#AA0000"));
break;
default:
break;
}
}
}
private void ReloadData()
{
SearchRecord = CurrRecord.DetailInstalled;
totalCount = SearchRecord.Count;
switch (sortField)
{
case "NumImp":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.NumImp).ThenByDescending(x => x.VersNumInstall).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.NumImp).ThenByDescending(x => x.VersNumInstall).ToList();
}
break;
case "VersNumInstall":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.VersNumInstall).ThenBy(x => x.PcInst).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.VersNumInstall).ThenBy(x => x.PcInst).ToList();
}
break;
case "PcInst":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.PcInst).ThenByDescending(x => x.VersNumInstall).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.PcInst).ThenByDescending(x => x.VersNumInstall).ToList();
}
break;
case "CodInst":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.CodInst).ThenByDescending(x => x.VersNumInstall).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.CodInst).ThenByDescending(x => x.VersNumInstall).ToList();
}
break;
default:
SearchRecord = SearchRecord
.OrderByDescending(x => x.VersNumInstall)
.ThenBy(x => x.CodInst)
.ThenBy(x => x.PcInst)
.ToList();
break;
}
// paginazione
ListRecord = SearchRecord
.Skip((currPage - 1) * numRecord)
.Take(numRecord)
.ToList();
}
/// <summary>
/// Rilegge risultato task come obj specifici in area DONE...
/// </summary>
/// <returns></returns>
private void ReloadTaskResults()
{
DevInfo = new Dictionary<string, string>();
RunStats = new Dictionary<string, string>();
LicInfo = new Dictionary<string, string>();
if (TaskDone != null && TaskDone.Count > 0)
{
// cerco Device Info specifiche
string devInfoKey = $"{EgwAccTask.DeviceInfoGet}";
if (TaskDone.ContainsKey(devInfoKey))
{
string rawData = TaskDone[devInfoKey];
if (!string.IsNullOrEmpty(rawData) && rawData.Count() > 2)
{
DevInfo = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
}
}
// cerco Info Stats
if (TaskDone.ContainsKey("RunStats"))
{
string rawData = TaskDone["RunStats"];
if (!string.IsNullOrEmpty(rawData) && rawData.Count() > 2)
{
RunStats = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
}
}
// cerco Info License
if (TaskDone.ContainsKey("LicInfo"))
{
string rawData = TaskDone["LicInfo"];
if (!string.IsNullOrEmpty(rawData) && rawData.Count() > 2)
{
LicInfo = JsonConvert.DeserializeObject<Dictionary<string, string>>(rawData);
}
}
}
}
/// <summary>
/// Esegue update stato task
/// </summary>
private void ReloadTaskStatus()
{
TaskDone = new Dictionary<string, string>();
if (!string.IsNullOrEmpty(CodImpSel))
{
TaskDone = LMDService.TaskDoneGet(CodImpSel);
}
}
/// <summary>
/// Evento refresh legato a ricezione evento da MessagePipe
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private async Task TaskMessPipe_EA_NewMessage(object sender, EventArgs e)
{
PubSubEventArgs currArgs = (PubSubEventArgs)e;
// qualsiasi messaggio fa scattare reload data
if (!string.IsNullOrEmpty(currArgs.newMessage))
{
// verifico se sia il cod impianto selezionato, nel faso forzo refreesh...
if (!string.IsNullOrEmpty(CodImpSel) && CodImpSel.Equals(currArgs.newMessage))
{
isLoading = true;
ReloadTaskStatus();
ReloadTaskResults();
isLoading = false;
await InvokeAsync(StateHasChanged);
}
}
}
#endregion Private Methods
}
}
-100
View File
@@ -1,100 +0,0 @@
<div class="card shadow">
<div class="card-header">
@if (CurrRecord == null)
{
<b>Applicazioni</b>
}
else
{
<span>Detail Info: <b>@CurrRecord.CodApp</b> | <span class="small">v.@CurrRecord.VersNumCurrent</span></span>
}
</div>
<div class="card-body">
@if (isLoading)
{
<LoadingData DisplayMode="LoadingData.SpinMode.BounceLine"></LoadingData>
}
else
{
@if (AppStats == null || AppStats.Count == 0)
{
<div class="alert alert-warning">
Nessun record trovato
</div>
}
else
{
<div class="row">
@if (!HasCodImp)
{
<div class="@tblColMain">
<table class="table table-sm table-striped table-responsive-lg">
<thead>
<tr>
<th><button class="btn btn-primary btn-sm" @onclick="() => DoSelect(null)"><i class="fa-solid fa-rotate"></i></button></th>
<th>
Applicazione
<Sorter ParamName="CodApp" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
@if (CurrRecord == null)
{
<th class="text-end">
# Copie
<Sorter ParamName="NumInst" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th class="text-end">
# Licenze
<Sorter ParamName="NumImp" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th class="text-end">
Versione
<Sorter ParamName="VersNumCurrent" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
<th class="text-end ms-1">
Stato
<Sorter ParamName="UpdateScore" IsAsc="@sortAsc" CurrParam="@sortField" sortReq="SortRequested"></Sorter>
</th>
}
</tr>
</thead>
<tbody>
@foreach (var record in ListRecord)
{
<tr class="@checkSelect(record.CodApp)">
<td>
<button class="btn btn-info btn-sm" @onclick="() => DoSelect(record)"><i class="fa-solid fa-magnifying-glass"></i></button>
</td>
<td>@record.CodApp</td>
@if (CurrRecord == null)
{
<td class="text-end">@record.NumInst</td>
<td class="text-end">@record.NumImp</td>
<td class="text-end">@record.VersNumCurrent</td>
<td class="ms-1">
<InstUp2DateDispl CurrRecord="record"></InstUp2DateDispl>
</td>
}
</tr>
}
</tbody>
</table>
</div>
}
@if (CurrRecord != null)
{
<div class="@tblColDet">
<InstAppPareto CurrRecord="CurrRecord" AppDetList="AppRelList"></InstAppPareto>
</div>
}
</div>
}
}
</div>
<div class="card-footer">
@if (totalCount > numRecord)
{
<DataPager PageSize="numRecord" currPage="currPage" numRecordChanged="setNumRec" numPageChanged="setNumPage" totalCount="totalCount" showLoading="isLoading" />
}
</div>
</div>
@@ -1,276 +0,0 @@
using LiMan.DB.DTO;
using LiMan.UI.Data;
using Microsoft.AspNetCore.Components;
using System;
using System.Collections.Generic;
using System.Linq;
using static EgwCoreLib.Razor.Sorter;
namespace LiMan.UI.Components
{
public partial class InstAppRelStatus : IDisposable
{
public void Dispose()
{
MServ.EA_SelCodApp -= MServ_EA_SelCodApp;
MServ.EA_SelCodImp -= MServ_EA_SelCodImp;
MServ.EA_SelCodInst -= MServ_EA_SelCodInst;
}
#region Public Properties
[Parameter]
public List<AppStatusDTO> AppStats { get; set; } = new List<AppStatusDTO>();
[Parameter]
public List<AppRelStatusDTO> AppRelList { get; set; } = new List<AppRelStatusDTO>();
#endregion Public Properties
#region Protected Properties
[Inject]
protected MessageService MServ { get; set; } = null!;
#endregion Protected Properties
#region Protected Methods
protected override void OnInitialized()
{
if (string.IsNullOrEmpty(sortField))
{
sortField = "NumInst";
sortAsc = false;
}
MServ.EA_SelCodApp += MServ_EA_SelCodApp;
MServ.EA_SelCodImp += MServ_EA_SelCodImp;
MServ.EA_SelCodInst += MServ_EA_SelCodInst;
}
private void MServ_EA_SelCodApp()
{
// cerco codApp sel...
string newCodApp = MServ.UsrParamGet("CodApp");
if (!CodAppSel.Equals(newCodApp))
{
var recSel = AppStats.FirstOrDefault(x => x.CodApp == newCodApp);
DoSelect(recSel);
}
CodAppSel = newCodApp;
}
private void MServ_EA_SelCodInst()
{
string newCodInst = MServ.UsrParamGet("CodInst");
if (!CodInstSel.Equals(newCodInst) && !string.IsNullOrEmpty(CodInstSel))
{
DoSelect(null);
}
CodInstSel = newCodInst;
}
/// <summary>
/// Selezionato CodImp (PC)
/// </summary>
private void MServ_EA_SelCodImp()
{
CodImpSel = MServ.UsrParamGet("CodImp");
HasCodImp = !string.IsNullOrEmpty(CodImpSel);
}
private string CodAppSel = "";
private string CodImpSel = "";
private string CodInstSel = "";
private bool HasCodImp = false;
protected override void OnParametersSet()
{
isLoading = true;
UpdateTable();
isLoading = false;
}
protected void setNumPage(int newNum)
{
currPage = newNum;
UpdateTable();
isLoading = false;
}
protected void setNumRec(int newNum)
{
numRecord = newNum;
currPage = 1;
UpdateTable();
isLoading = false;
}
protected void SortRequested(SortCallBack e)
{
isLoading = true;
if (sortField == e.ParamName)
{
sortAsc = e.IsAscending;
}
sortField = e.ParamName;
UpdateTable();
isLoading = false;
}
#endregion Protected Methods
#region Private Fields
private int currPage = 1;
private bool isLoading = false;
private int numRecord = 10;
private string sKey = "InstAppRelStatus";
private int totalCount = 0;
#endregion Private Fields
#region Private Properties
private AppStatusDTO? CurrRecord { get; set; } = null;
private List<AppStatusDTO> ListRecord { get; set; } = new List<AppStatusDTO>();
private List<AppStatusDTO> SearchRecord { get; set; } = new List<AppStatusDTO>();
private bool sortAsc
{
get
{
bool answ = false;
var sVal = MServ.UsrParamGet($"{sKey}_sort");
if (!string.IsNullOrEmpty(sVal))
{
bool.TryParse(sVal, out answ);
}
return answ;
}
set => MServ.UsrParamSet($"{sKey}_sort", $"{value}");
}
private string sortField
{
get => MServ.UsrParamGet($"{sKey}_field");
set => MServ.UsrParamSet($"{sKey}_field", $"{value}");
}
private string tblColMain
{
get => CurrRecord == null ? "col-12" : HasCodImp ? "col-1" : "col-3";
}
private string tblColDet
{
get => CurrRecord == null ? "col-1" : HasCodImp ? "col-12" : "col-9";
}
#endregion Private Properties
#region Private Methods
private string checkSelect(string codApp)
{
string answ = (CurrRecord != null && codApp == CurrRecord.CodApp) ? "table-info" : "";
return answ;
}
/// <summary>
/// Selezoine record corrente
/// </summary>
/// <param name="selRec"></param>
private void DoSelect(AppStatusDTO selRec)
{
CurrRecord = selRec;
CodAppSel = selRec != null ? selRec.CodApp : "";
MServ.UsrParamSet("CodApp", CodAppSel);
string numApp = selRec != null ? $"{selRec.NumInst}" : "";
MServ.UsrParamSet("NumApp", numApp);
string numLic = selRec != null ? $"{selRec.NumImp}" : "";
MServ.UsrParamSet("NumLic", numLic);
string lastVers = selRec != null ? selRec.VersNumCurrent : "";
MServ.UsrParamSet("LastVers", lastVers);
string score = selRec != null ? $"{selRec.UpdateScore:P1}" : "";
MServ.UsrParamSet("Score", score);
MServ.ReportSelCodApp();
}
private void UpdateTable()
{
SearchRecord = AppStats;
totalCount = SearchRecord.Count;
switch (sortField)
{
case "CodApp":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.CodApp).ThenByDescending(x => x.NumImp).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.CodApp).ThenByDescending(x => x.NumImp).ToList();
}
break;
case "NumInst":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.NumInst).ThenByDescending(x => x.NumImp).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.NumInst).ThenByDescending(x => x.NumImp).ToList();
}
break;
case "NumImp":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.NumImp).ThenByDescending(x => x.NumInst).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.NumImp).ThenByDescending(x => x.NumInst).ToList();
}
break;
case "VersNumCurrent":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.VersNumCurrent).ThenByDescending(x => x.NumImp).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.VersNumCurrent).ThenByDescending(x => x.NumImp).ToList();
}
break;
case "UpdateScore":
if (sortAsc)
{
SearchRecord = SearchRecord.OrderBy(x => x.UpdateScore).ThenByDescending(x => x.NumImp).ToList();
}
else
{
SearchRecord = SearchRecord.OrderByDescending(x => x.UpdateScore).ThenByDescending(x => x.NumImp).ToList();
}
break;
default:
SearchRecord = SearchRecord
.OrderByDescending(x => x.NumImp)
.ThenByDescending(x => x.NumInst)
.ToList();
break;
}
ListRecord = SearchRecord
.Skip((currPage - 1) * numRecord)
.Take(numRecord)
.ToList();
}
#endregion Private Methods
}
}

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