Merge branch 'release/AddAppRelMgmt04'
This commit is contained in:
+111
-56
@@ -35,62 +35,6 @@ namespace EgwProxy.LiMan
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <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>
|
||||
/// 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>
|
||||
/// Test ping x indirizzo indicato
|
||||
/// </summary>
|
||||
@@ -165,6 +109,64 @@ namespace EgwProxy.LiMan
|
||||
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>
|
||||
@@ -241,6 +243,59 @@ namespace EgwProxy.LiMan
|
||||
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
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -72,7 +72,7 @@ namespace LiMan.APi.Controllers
|
||||
public async Task<List<ReleaseDTO>> GetFiltLimit(string id, string VersMin, string VersMax)
|
||||
{
|
||||
var result = await dataService.ReleaseGetByAppVersLimit(id, VersMin, VersMax);
|
||||
await dataService.recordCall(id, id, $"GET:api/Release/filt/{id}");
|
||||
await dataService.recordCall(id, id, $"GET:api/Release/filtLimit/{id}");
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
Generated
+36
-1
@@ -30,6 +30,9 @@ Partial Class Form1
|
||||
Me.txtCodApp = New System.Windows.Forms.TextBox()
|
||||
Me.Label1 = New System.Windows.Forms.Label()
|
||||
Me.Label2 = New System.Windows.Forms.Label()
|
||||
Me.Label3 = New System.Windows.Forms.Label()
|
||||
Me.txtMaxVers = New System.Windows.Forms.TextBox()
|
||||
Me.Button4 = New System.Windows.Forms.Button()
|
||||
Me.SuspendLayout()
|
||||
'
|
||||
'Button1
|
||||
@@ -71,7 +74,7 @@ Partial Class Form1
|
||||
'
|
||||
Me.txtMinVers.Location = New System.Drawing.Point(449, 14)
|
||||
Me.txtMinVers.Name = "txtMinVers"
|
||||
Me.txtMinVers.Size = New System.Drawing.Size(133, 20)
|
||||
Me.txtMinVers.Size = New System.Drawing.Size(70, 20)
|
||||
Me.txtMinVers.TabIndex = 4
|
||||
Me.txtMinVers.Text = "2.5.5.0"
|
||||
'
|
||||
@@ -101,11 +104,40 @@ Partial Class Form1
|
||||
Me.Label2.TabIndex = 7
|
||||
Me.Label2.Text = "Min Vers:"
|
||||
'
|
||||
'Label3
|
||||
'
|
||||
Me.Label3.AutoSize = True
|
||||
Me.Label3.Location = New System.Drawing.Point(547, 17)
|
||||
Me.Label3.Name = "Label3"
|
||||
Me.Label3.Size = New System.Drawing.Size(54, 13)
|
||||
Me.Label3.TabIndex = 9
|
||||
Me.Label3.Text = "Max Vers:"
|
||||
'
|
||||
'txtMaxVers
|
||||
'
|
||||
Me.txtMaxVers.Location = New System.Drawing.Point(598, 14)
|
||||
Me.txtMaxVers.Name = "txtMaxVers"
|
||||
Me.txtMaxVers.Size = New System.Drawing.Size(70, 20)
|
||||
Me.txtMaxVers.TabIndex = 8
|
||||
Me.txtMaxVers.Text = "2.5.8.999"
|
||||
'
|
||||
'Button4
|
||||
'
|
||||
Me.Button4.Location = New System.Drawing.Point(12, 139)
|
||||
Me.Button4.Name = "Button4"
|
||||
Me.Button4.Size = New System.Drawing.Size(133, 23)
|
||||
Me.Button4.TabIndex = 10
|
||||
Me.Button4.Text = "Get Vers From Limit"
|
||||
Me.Button4.UseVisualStyleBackColor = True
|
||||
'
|
||||
'Form1
|
||||
'
|
||||
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
|
||||
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
|
||||
Me.ClientSize = New System.Drawing.Size(800, 450)
|
||||
Me.Controls.Add(Me.Button4)
|
||||
Me.Controls.Add(Me.Label3)
|
||||
Me.Controls.Add(Me.txtMaxVers)
|
||||
Me.Controls.Add(Me.Label2)
|
||||
Me.Controls.Add(Me.Label1)
|
||||
Me.Controls.Add(Me.txtCodApp)
|
||||
@@ -129,4 +161,7 @@ Partial Class Form1
|
||||
Friend WithEvents txtCodApp As TextBox
|
||||
Friend WithEvents Label1 As Label
|
||||
Friend WithEvents Label2 As Label
|
||||
Friend WithEvents Label3 As Label
|
||||
Friend WithEvents txtMaxVers As TextBox
|
||||
Friend WithEvents Button4 As Button
|
||||
End Class
|
||||
|
||||
+19
-2
@@ -43,7 +43,7 @@ Public Class Form1
|
||||
If matList IsNot Nothing Then
|
||||
|
||||
For Each item In matList
|
||||
result += $"{item.CodApp} | {item.VersNum} | {item.VersText} | {item.ReleaseDate:yyyy-MM-dd}{Environment.NewLine}"
|
||||
result += $"{item.CodApp} | {item.VersNum} | {item.VersText} | {item.ReleaseDate:yyyy-MM-dd} | upd: {item.IsPermitted}{Environment.NewLine}"
|
||||
Next
|
||||
End If
|
||||
|
||||
@@ -60,7 +60,24 @@ Public Class Form1
|
||||
If matList IsNot Nothing Then
|
||||
|
||||
For Each item In matList
|
||||
result += $"{item.CodApp} | {item.VersNum} | {item.VersText} | {item.ReleaseDate:yyyy-MM-dd}{Environment.NewLine}"
|
||||
result += $"{item.CodApp} | {item.VersNum} | {item.VersText} | {item.ReleaseDate:yyyy-MM-dd} | upd: {item.IsPermitted}{Environment.NewLine}"
|
||||
Next
|
||||
End If
|
||||
|
||||
txtOut.Text = result
|
||||
End Sub
|
||||
|
||||
Private Async Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
|
||||
' recupera e mostra dati elenco materiali
|
||||
commLib = New DataSyncro(servAddr)
|
||||
|
||||
Dim result As String = ""
|
||||
|
||||
Dim matList = Await commLib.ReleaseGetFiltLimitAsync(txtCodApp.Text, txtMinVers.Text, txtMaxVers.Text)
|
||||
If matList IsNot Nothing Then
|
||||
|
||||
For Each item In matList
|
||||
result += $"{item.CodApp} | {item.VersNum} | {item.VersText} | {item.ReleaseDate:yyyy-MM-dd} | upd: {item.IsPermitted}{Environment.NewLine}"
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="EgwProxy.LiMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.LiMan.1.0.2408.718\lib\EgwProxy.LiMan.dll</HintPath>
|
||||
<HintPath>..\packages\EgwProxy.LiMan.1.0.2408.817\lib\EgwProxy.LiMan.dll</HintPath>
|
||||
</Reference>
|
||||
<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>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="EgwProxy.LiMan" version="1.0.2408.718" targetFramework="net472" />
|
||||
<package id="EgwProxy.LiMan" version="1.0.2408.817" targetFramework="net472" />
|
||||
<package id="Microsoft.Bcl.AsyncInterfaces" version="8.0.0" targetFramework="net462" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net462" />
|
||||
<package id="NLog" version="5.3.2" targetFramework="net462" />
|
||||
|
||||
Reference in New Issue
Block a user