Modifica metodo sync risorse (da provare)
This commit is contained in:
@@ -257,8 +257,9 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// - upload + sync (cloud)
|
||||
/// - download + sync (locale)
|
||||
/// </summary>
|
||||
/// <param name="itemList">
|
||||
/// Elenco item, saranno inviati x sync (con quantità sovrascritta) SOLO SE RawItemCloudId==0
|
||||
/// <param name="MatIdList">
|
||||
/// Elenco Id dei materiali (DB LOCALE):
|
||||
/// saranno inviati x sync (con quantità sovrascritta) SOLO SE RawItemCloudId == 0
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public bool ResourcesSync(List<int> MatIdList)
|
||||
@@ -270,15 +271,23 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
using (RawItemsController rawItemDbContr = new RawItemsController())
|
||||
{
|
||||
List<RawItemModel> rawItemList = new List<RawItemModel>();
|
||||
// ciclo per ogni materiale indicato
|
||||
foreach (var item in MatIdList)
|
||||
{
|
||||
// recupero elenco rawItem
|
||||
var currList = rawItemDbContr.GetFiltModel(item);
|
||||
// effettuo sync...
|
||||
bool callOk = ResourcesSync(currList);
|
||||
fatto = fatto && callOk;
|
||||
List<RawItemModel> currList = rawItemDbContr.GetFiltModel(item);
|
||||
// verifico se e cosa aggiungere...
|
||||
foreach (var rawItem in currList)
|
||||
{
|
||||
if (!rawItemList.Contains(rawItem))
|
||||
{
|
||||
rawItemList.Add(rawItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
// effettuo sync alla fine...
|
||||
fatto = ResourcesSync(rawItemList);
|
||||
}
|
||||
}
|
||||
return fatto;
|
||||
@@ -306,8 +315,7 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
{
|
||||
// per prima cosa invio dati
|
||||
Dictionary<int, MaterialDTO> dictMat = new Dictionary<int, MaterialDTO>();
|
||||
// costruisco elenco materiali da inviare in magazzino (se RawItemCloudId==
|
||||
// 0) ...
|
||||
// costruisco elenco materiali da inviare in magazzino (RawItemCloudId==0)
|
||||
var rec2sync = itemList.Where(x => x.RawItemCloudId == 0).ToList();
|
||||
foreach (var item in rec2sync)
|
||||
{
|
||||
@@ -362,14 +370,14 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// - upload + sync (cloud)
|
||||
/// - download + sync (locale)
|
||||
/// </summary>
|
||||
/// <param name="itemList">
|
||||
/// Elenco item, saranno inviati x sync (con quantità sovrascritta) SOLO SE RawItemCloudId
|
||||
/// == 0
|
||||
/// <param name="MatIdList">
|
||||
/// Elenco Id dei materiali (DB LOCALE):
|
||||
/// saranno inviati x sync (con quantità sovrascritta) SOLO SE RawItemCloudId == 0
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ResourcesSyncAsync(List<int> MatIdList)
|
||||
{
|
||||
bool fatto = false;
|
||||
bool fatto = true;
|
||||
// verifico server ok
|
||||
bool servOk = commLib.CheckRemote();
|
||||
if (servOk)
|
||||
@@ -396,8 +404,8 @@ namespace EgtBEAMWALL.DataLayer.Controllers
|
||||
/// - download + sync (locale)
|
||||
/// </summary>
|
||||
/// <param name="itemList">
|
||||
/// Elenco item, saranno inviati x sync (con quantità sovrascritta) SOLO SE RawItemCloudId
|
||||
/// == 0
|
||||
/// Elenco item dal DB locale
|
||||
/// saranno inviati x sync (con quantità sovrascritta) SOLO SE RawItemCloudId == 0
|
||||
/// </param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> ResourcesSyncAsync(List<RawItemModel> itemList)
|
||||
|
||||
Reference in New Issue
Block a user