diff --git a/EgwProxy.MagMan/DataSyncro.cs b/EgwProxy.MagMan/DataSyncro.cs
index ad898a1..35abc2f 100644
--- a/EgwProxy.MagMan/DataSyncro.cs
+++ b/EgwProxy.MagMan/DataSyncro.cs
@@ -474,7 +474,7 @@ namespace EgwProxy.MagMan
///
/// Elenco progetti associati a chiave
///
- /// Se 0 = tutto
+ /// Se 0 = tutto
///
public List ProjectGet(int NumKey)
{
@@ -521,6 +521,56 @@ namespace EgwProxy.MagMan
return await Task.FromResult(answ);
}
+ ///
+ /// Record progetto da Key/ID
+ ///
+ /// Se 0 = tutto
+ ///
+ public ProjectDTO ProjectGetSingle(int ProjCloudId)
+ {
+ ProjectDTO answ = new ProjectDTO();
+ // cerco online
+ using (RestClient client = new RestClient(rcOptions))
+ {
+ string MKeyEnc = HttpUtility.UrlEncode(RestToken);
+ var request = new RestRequest($"Projects/single/{MKeyEnc}?ProjCloudId={ProjCloudId}", Method.Get);
+ var response = client.Get(request);
+ // controllo risposta
+ if (response.StatusCode == HttpStatusCode.OK)
+ {
+ // contenuto serializzato
+ string rawData = $"{response.Content}";
+ answ = JsonConvert.DeserializeObject(rawData);
+ }
+ }
+ return answ;
+ }
+
+ ///
+ /// Record progetto da Key/ID
+ ///
+ /// Se 0 = tutto
+ ///
+ public async Task ProjectGetSingleAsync(int ProjCloudId)
+ {
+ ProjectDTO answ = new ProjectDTO();
+ // cerco online
+ using (RestClient client = new RestClient(rcOptions))
+ {
+ string MKeyEnc = HttpUtility.UrlEncode(RestToken);
+ var request = new RestRequest($"Projects/single/{MKeyEnc}?ProjCloudId={ProjCloudId}", Method.Get);
+ var response = await client.GetAsync(request);
+ // controllo risposta
+ if (response.StatusCode == HttpStatusCode.OK)
+ {
+ // contenuto serializzato
+ string rawData = $"{response.Content}";
+ answ = JsonConvert.DeserializeObject(rawData);
+ }
+ }
+ return await Task.FromResult(answ);
+ }
+
///
/// Invio elenco di RawItems associati ad un singolo materiale, il server farà il merge
/// record da inviare
diff --git a/TestConsoleApp/Program.cs b/TestConsoleApp/Program.cs
index 5729db4..cbe1ed7 100644
--- a/TestConsoleApp/Program.cs
+++ b/TestConsoleApp/Program.cs
@@ -108,24 +108,47 @@ namespace DemoApp
var projList = commLib.ProjectGet(470);
if (projList != null)
{
- foreach (var itemMat in projList)
+ foreach (var itemProj in projList)
{
Console.WriteLine(sep);
- Console.WriteLine($"MachineId: {itemMat.MachineCloudId}");
- Console.WriteLine($"Key: {itemMat.KeyNum}");
- Console.WriteLine($"ProjLocalId: {itemMat.ProjLocalId}");
- Console.WriteLine($"ProjExtId: {itemMat.ProjExtId}");
- Console.WriteLine($"BTL filename: {itemMat.BTLFileName}");
- Console.WriteLine($"PType: {itemMat.PType}");
- Console.WriteLine($"Machine: {itemMat.Machine}");
- Console.WriteLine($"Descript: {itemMat.ProjDescription}");
- Console.WriteLine($"Proc time est/real: {itemMat.ProcTimeEst:N1} / {itemMat.ProcTimeReal:N1}");
+ Console.WriteLine($"MachineId: {itemProj.MachineCloudId}");
+ Console.WriteLine($"Key: {itemProj.KeyNum}");
+ Console.WriteLine($"ProjLocalId: {itemProj.ProjLocalId}");
+ Console.WriteLine($"ProjExtId: {itemProj.ProjExtId}");
+ Console.WriteLine($"BTL filename: {itemProj.BTLFileName}");
+ Console.WriteLine($"PType: {itemProj.PType}");
+ Console.WriteLine($"Machine: {itemProj.Machine}");
+ Console.WriteLine($"Descript: {itemProj.ProjDescription}");
+ Console.WriteLine($"Proc time est/real: {itemProj.ProcTimeEst:N1} / {itemProj.ProcTimeReal:N1}");
Console.WriteLine(sep);
Console.WriteLine();
}
}
- answ = Console.ReadLine();
+ Console.WriteLine("Enter to next step: numb of proj to read");
+ answ = Console.ReadLine();
+ int projId = 1;
+ int.TryParse(answ, out projId);
+ var singleProj = commLib.ProjectGetSingle(projId);
+ if (singleProj != null)
+ {
+ Console.WriteLine(sep);
+ Console.WriteLine($"Proj {projId} data:");
+ Console.WriteLine($"MachineId: {singleProj.MachineCloudId}");
+ Console.WriteLine($"Key: {singleProj.KeyNum}");
+ Console.WriteLine($"ProjLocalId: {singleProj.ProjLocalId}");
+ Console.WriteLine($"ProjExtId: {singleProj.ProjExtId}");
+ Console.WriteLine($"BTL filename: {singleProj.BTLFileName}");
+ Console.WriteLine($"PType: {singleProj.PType}");
+ Console.WriteLine($"Machine: {singleProj.Machine}");
+ Console.WriteLine($"Descript: {singleProj.ProjDescription}");
+ Console.WriteLine($"Proc time est/real: {singleProj.ProcTimeEst:N1} / {singleProj.ProcTimeReal:N1}");
+ Console.WriteLine(sep);
+ Console.WriteLine();
+ }
+
+
+ answ = Console.ReadLine();
Console.WriteLine("Inserire Qty materiale syncronizzare (Demo, WxHxL: 100x100x0):");
var sQty = Console.ReadLine();