This commit is contained in:
@@ -73,6 +73,7 @@ namespace AyaNovaQBI
|
||||
if (gridAya.SelectedRows.Count == 0 && gridQB.SelectedRows.Count == 0) return;
|
||||
|
||||
IsAyaGrid = gridAya.SelectedRows.Count > 0;
|
||||
bool SaveIntegration = false;
|
||||
|
||||
if (IsAyaGrid)
|
||||
{
|
||||
@@ -119,8 +120,6 @@ namespace AyaNovaQBI
|
||||
IntegrationItem m = util.QBIntegration.Items.FirstOrDefault(z => z.Id == AyaId && z.AType == _Type);
|
||||
if (m != null)
|
||||
{
|
||||
|
||||
|
||||
//Is it already linked to the selected qb object?
|
||||
|
||||
//Yes so do nothing and continue on to the next object
|
||||
@@ -139,22 +138,38 @@ namespace AyaNovaQBI
|
||||
|
||||
//If we're here it's because the object is already mapped
|
||||
//but the users has signified they want to change the map to another object so...
|
||||
m.IntegrationItemId = QBItemId;
|
||||
m.IntegrationItemName = QBItemName;
|
||||
m.LastSync = System.DateTime.Now;
|
||||
if (!string.IsNullOrEmpty(QBItemId))//confirm not a removal
|
||||
{
|
||||
m.IntegrationItemId = QBItemId;
|
||||
m.IntegrationItemName = QBItemName;
|
||||
m.LastSync = System.DateTime.Now;
|
||||
SaveIntegration = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
//user is removing mapping so remove the integrationitem entirely from the collection
|
||||
util.QBIntegration.Items.Remove(m);
|
||||
SaveIntegration = true;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
//not already present, so add it, easy peasy...
|
||||
m = new IntegrationItem { AType = _Type, IntegrationItemName = QBItemName, IntegrationItemId = QBItemId, LastSync = System.DateTime.Now, ObjectId = AyaId };
|
||||
util.QBIntegration.Items.Add(m);
|
||||
if (!string.IsNullOrEmpty(QBItemId))//confirm not a removal
|
||||
{
|
||||
//not already present, so add it, easy peasy...
|
||||
m = new IntegrationItem { AType = _Type, IntegrationItemName = QBItemName, IntegrationItemId = QBItemId, LastSync = System.DateTime.Now, ObjectId = AyaId };
|
||||
util.QBIntegration.Items.Add(m);
|
||||
SaveIntegration = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
await util.SaveIntegrationObject();
|
||||
Initialize();
|
||||
if (SaveIntegration)
|
||||
{
|
||||
await util.SaveIntegrationObject();
|
||||
Initialize();
|
||||
}
|
||||
|
||||
//#################################
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user