Aggiunta metodi x syncro progresso progetto
This commit is contained in:
@@ -9,7 +9,7 @@ namespace EgwProxy.MagMan.DTO
|
||||
// <Auto-Generated>
|
||||
// This is here so CodeMaid doesn't reorganize this document
|
||||
// </Auto-Generated>
|
||||
public class ProjectProgDTO
|
||||
public class ProjectProgrDTO
|
||||
{
|
||||
|
||||
/// <summary>
|
||||
@@ -716,8 +716,9 @@ namespace EgwProxy.MagMan
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invio record Proj x upsert <param name="rec2send">record da inviare</param>
|
||||
/// Invio record Proj x upsert
|
||||
/// </summary>
|
||||
/// <param name="rec2send">record da inviare</param>
|
||||
/// <returns>ProjCloudId (essitente o nuovo)</returns>
|
||||
public int ProjectSend(ProjectDTO rec2send)
|
||||
{
|
||||
@@ -748,9 +749,9 @@ namespace EgwProxy.MagMan
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Versione async Invio elenco di RawItems associati ad un singolo materiale, il server
|
||||
/// farà il merge <param name="rec2send">record da inviare</param>
|
||||
/// Versione async Invio Proj x upsert
|
||||
/// </summary>
|
||||
/// <param name="rec2send">record da inviare</param>
|
||||
public async Task<int> ProjectSendAsync(ProjectDTO rec2send)
|
||||
{
|
||||
int answ = 0;
|
||||
@@ -779,6 +780,72 @@ namespace EgwProxy.MagMan
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Invio record ProjProg x aggiornamento stato
|
||||
/// </summary>
|
||||
/// <param name="rec2send">record da inviare</param>
|
||||
/// <returns>ProjCloudId (essitente o nuovo)</returns>
|
||||
public bool ProjectProgrSend(ProjectProgrDTO rec2send)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco online
|
||||
using (RestClient client = new RestClient(rcOptions))
|
||||
{
|
||||
string MKeyEnc = HttpUtility.UrlEncode(RestToken);
|
||||
// impacchetto dati x invio...
|
||||
RestPayload.ProdInfoData newPayload = new RestPayload.ProdInfoData()
|
||||
{
|
||||
ProjectProgress = rec2send
|
||||
};
|
||||
var jsonBody = JsonConvert.SerializeObject(newPayload);
|
||||
var request = new RestRequest($"Projects/prod-update/{MKeyEnc}", Method.Post).AddJsonBody(jsonBody);
|
||||
var response = client.Post(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
bool.TryParse(response.Content, out answ);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"ProjectProgrSend | Response StatusCode: {response.StatusCode} | content: {response.Content}");
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Versione async Invio record ProjProg x aggiornamento stato
|
||||
/// </summary>
|
||||
/// <param name="rec2send">record da inviare</param>
|
||||
public async Task<bool> ProjectProgrSendAsync(ProjectProgrDTO rec2send)
|
||||
{
|
||||
bool answ = false;
|
||||
// cerco online
|
||||
using (RestClient client = new RestClient(rcOptions))
|
||||
{
|
||||
string MKeyEnc = HttpUtility.UrlEncode(RestToken);
|
||||
// impacchetto dati x invio...
|
||||
RestPayload.ProdInfoData newPayload = new RestPayload.ProdInfoData()
|
||||
{
|
||||
ProjectProgress = rec2send
|
||||
};
|
||||
var jsonBody = JsonConvert.SerializeObject(newPayload);
|
||||
var request = new RestRequest($"Projects/prod-update/{MKeyEnc}", Method.Post).AddJsonBody(jsonBody);
|
||||
var response = await client.PostAsync(request);
|
||||
// controllo risposta
|
||||
if (response.StatusCode == HttpStatusCode.OK)
|
||||
{
|
||||
bool.TryParse(response.Content, out answ);
|
||||
}
|
||||
else
|
||||
{
|
||||
Log.Error($"ProjectProgrSendAsync | Response StatusCode: {response.StatusCode} | content: {response.Content}");
|
||||
}
|
||||
}
|
||||
return await Task.FromResult(answ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica elenco di risorse associate ad un progetto
|
||||
/// </summary>
|
||||
|
||||
@@ -87,6 +87,7 @@
|
||||
<Compile Include="DTO\MaterialDTO.cs" />
|
||||
<Compile Include="DTO\ProjectDTO.cs" />
|
||||
<Compile Include="DTO\LogMachineDTO.cs" />
|
||||
<Compile Include="DTO\ProjectProgrDTO.cs" />
|
||||
<Compile Include="DTO\ResourceDTO.cs" />
|
||||
<Compile Include="DTO\ResourceExpDTO.cs" />
|
||||
<Compile Include="Enums.cs" />
|
||||
|
||||
@@ -77,6 +77,14 @@ namespace EgwProxy.MagMan
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
public class ProdInfoData
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
public ProjectProgrDTO ProjectProgress { get; set; }
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
|
||||
public class Resources
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user