Public Sub importData(Database As List, newItems As List, option As Int) As ResumableSub
Log("Importando datos... Productos a importar: " & newItems.Size)
Dim DB As List = Database
Dim a As Int = 0
For Each item As Map In newItems
a=a+1
Log("Verificando dato: " & a)
If option = 0 Then
If DB.IndexOf(item.Get("CODIGO")) = -1 Then
For i = 0 To DB.Size - 1
'Log("Verificando ML " & (i+1) & " de " & MasterList.Size)
Dim tempRecord As Map = DB.Get(i)
If item.Get("CODIGO") == tempRecord.Get("CODIGO") Then
Wait For (ShowDialog(item)) Complete (Result As Int)
If Result = -1 Then
'MasterList.Set(i, record)
Log("Producto : " & item.Get("CODIGO") & " fue reemplazado correctamente")
End If
End If
Next
Else
Log("Nuevo Producto : " & item.Get("CODIGO") & " fue agregado correctamente")
End If
End If
Next
Return DB
End Sub
Private Sub ShowDialog(old As Map) As ResumableSub
Return Msg.show2("¿El producto " & old.Get("CODIGO") & " - " & old.Get("PRODUCTO") & " ya existe desea reemplazar sus datos?,","Aviso","Si","No","")
End Sub