Fix syncro con dtReq x risorse (track)
This commit is contained in:
@@ -279,6 +279,59 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
commLib = null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Forza sincronizzazione invii non completati SOLO di consumi...
|
||||
/// </summary>
|
||||
/// <returns>Restituisce esito resync, ALL OK solo se ha fatto tutti gli invii necessari</returns>
|
||||
public SyncResult ForceSyncroSend()
|
||||
{
|
||||
SyncResult answ = SyncResult.ERR_ND;
|
||||
ProjResState projType = ProjResState.Consumed;
|
||||
// recupero da DB eventuale elenco dati da sincronizzare
|
||||
using (MagmanSyncController msContr = new MagmanSyncController())
|
||||
{
|
||||
var list2resend = msContr.GetUnsentFilt("", DateTime.Now.AddDays(1), 1000);
|
||||
if (list2resend == null || list2resend.Count == 0)
|
||||
{
|
||||
answ = SyncResult.ALL_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
// verifico server ok
|
||||
bool servOk = commLib.CheckRemote();
|
||||
if (!servOk)
|
||||
{
|
||||
answ = SyncResult.ERR_ServerKo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// eseguo re-invio 1:1...
|
||||
List<ResourceDTO> list2send = new List<ResourceDTO>();
|
||||
foreach (var record in list2resend)
|
||||
{
|
||||
list2send = JsonConvert.DeserializeObject<List<ResourceDTO>>(record.Payload);
|
||||
if (Enum.TryParse(record.SyncType, out projType))
|
||||
{
|
||||
// effettuo invio...
|
||||
bool resOk = commLib.ResourceSend(record.CloudId, projType, record.DtReq, list2send);
|
||||
if (!resOk)
|
||||
{
|
||||
answ = SyncResult.ERR_CloudResNotSent;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = SyncResult.ALL_OK;
|
||||
// registro su DB dataora conclusione invio
|
||||
msContr.SetCompleted(record.SyncId, DateTime.Now);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Esegue sync Materiale:
|
||||
/// - upload + sync (cloud)
|
||||
@@ -1141,59 +1194,6 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Forza sincronizzazione invii non completati SOLO di consumi...
|
||||
/// </summary>
|
||||
/// <returns>Restituisce esito resync, ALL OK solo se ha fatto tutti gli invii necessari</returns>
|
||||
private SyncResult ForceSyncroSend()
|
||||
{
|
||||
SyncResult answ = SyncResult.ERR_ND;
|
||||
ProjResState projType = ProjResState.Consumed;
|
||||
// recupero da DB eventuale elenco dati da sincronizzare
|
||||
using (MagmanSyncController msContr = new MagmanSyncController())
|
||||
{
|
||||
var list2resend = msContr.GetUnsentFilt("", DateTime.Now.AddDays(1), 1000);
|
||||
if (list2resend == null || list2resend.Count == 0)
|
||||
{
|
||||
answ = SyncResult.ALL_OK;
|
||||
}
|
||||
else
|
||||
{
|
||||
// verifico server ok
|
||||
bool servOk = commLib.CheckRemote();
|
||||
if (!servOk)
|
||||
{
|
||||
answ = SyncResult.ERR_ServerKo;
|
||||
}
|
||||
else
|
||||
{
|
||||
// eseguo re-invio 1:1...
|
||||
List<ResourceDTO> list2send = new List<ResourceDTO>();
|
||||
foreach (var record in list2resend)
|
||||
{
|
||||
list2send = JsonConvert.DeserializeObject<List<ResourceDTO>>(record.Payload);
|
||||
if (Enum.TryParse(record.SyncType, out projType))
|
||||
{
|
||||
// effettuo invio...
|
||||
bool resOk = commLib.ResourceSend(record.CloudId, projType, list2send);
|
||||
if (!resOk)
|
||||
{
|
||||
answ = SyncResult.ERR_CloudResNotSent;
|
||||
}
|
||||
else
|
||||
{
|
||||
answ = SyncResult.ALL_OK;
|
||||
// registro su DB dataora conclusione invio
|
||||
msContr.SetCompleted(record.SyncId, DateTime.Now);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return answ;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua invio track risorse
|
||||
/// </summary>
|
||||
@@ -1225,12 +1225,13 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
int syncId = 0;
|
||||
string payload = JsonConvert.SerializeObject(list2send);
|
||||
DateTime adesso = DateTime.Now;
|
||||
// registro su DB invio..
|
||||
MagmanSyncModel newRec = new MagmanSyncModel()
|
||||
{
|
||||
CloudId = ProjCloudId,
|
||||
SyncType = $"{trackType}",
|
||||
DtReq = DateTime.Now,
|
||||
DtReq = adesso,
|
||||
Payload = payload
|
||||
};
|
||||
// salvo sul DB
|
||||
@@ -1247,7 +1248,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
else
|
||||
{
|
||||
// effettuo invio...
|
||||
bool resOk = commLib.ResourceSend(ProjCloudId, trackType, list2send);
|
||||
bool resOk = commLib.ResourceSend(ProjCloudId, trackType, adesso, list2send);
|
||||
if (!resOk)
|
||||
{
|
||||
answ = SyncResult.ERR_CloudResNotSent;
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2403.1917\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2403.2611\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
|
||||
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2403.1917" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2403.2611" targetFramework="net472" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
||||
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
|
||||
<package id="K4os.Compression.LZ4" version="1.3.6" targetFramework="net472" />
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
<HintPath>..\ExtLibs\EgtWPFLib5.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.MagMan, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2402.619\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
<HintPath>..\packages\EgwProxy.MagMan.1.0.2403.2611\lib\EgwProxy.MagMan.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EntityFramework, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EntityFramework.6.4.4\lib\net45\EntityFramework.dll</HintPath>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="BouncyCastle" version="1.8.5" targetFramework="net472" />
|
||||
<package id="DotNetZip" version="1.16.0" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2402.619" targetFramework="net472" />
|
||||
<package id="EgwProxy.MagMan" version="1.0.2403.2611" targetFramework="net472" />
|
||||
<package id="EntityFramework" version="6.4.4" targetFramework="net452" />
|
||||
<package id="Google.Protobuf" version="3.21.9" targetFramework="net472" />
|
||||
<package id="K4os.Compression.LZ4" version="1.3.5" targetFramework="net472" />
|
||||
|
||||
Reference in New Issue
Block a user