This commit is contained in:
@@ -9,6 +9,11 @@ using System.Windows.Forms;
|
||||
|
||||
namespace AyaNovaQBI
|
||||
{
|
||||
/*
|
||||
TODO:
|
||||
test updating all object types both ways, have tested vendors and customers only, in particular parts and part price only test
|
||||
|
||||
*/
|
||||
public partial class Map : Form
|
||||
{
|
||||
private AyaType _Type = AyaType.Customer;
|
||||
@@ -63,55 +68,86 @@ namespace AyaNovaQBI
|
||||
if (gridAya.SelectedRows.Count == 0 && gridQB.SelectedRows.Count == 0) return;
|
||||
|
||||
IsAyaGrid = gridAya.SelectedRows.Count > 0;
|
||||
|
||||
if (IsAyaGrid)
|
||||
Waiting w = null;
|
||||
try
|
||||
{
|
||||
if (MessageBox.Show(
|
||||
"Import and link the selected AyaNova objects into QuickBooks.\r\n\r\n" +
|
||||
"Are you sure?", "Import AyaNova objects", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
== DialogResult.No) return;
|
||||
await ImportToQuickBooks();
|
||||
switch (_Type)
|
||||
if (IsAyaGrid)
|
||||
{
|
||||
case AyaType.Customer:
|
||||
await util.PopulateQBClientCacheAsync();
|
||||
break;
|
||||
case AyaType.Vendor:
|
||||
await util.PopulateQBVendorCacheAsync();
|
||||
break;
|
||||
case AyaType.ServiceRate:
|
||||
case AyaType.TravelRate:
|
||||
case AyaType.Part:
|
||||
await util.PopulateQBItemCacheAsync();
|
||||
break;
|
||||
if (MessageBox.Show(
|
||||
"Import and link the selected AyaNova objects into QuickBooks.\r\n\r\n" +
|
||||
"Are you sure?", "Import AyaNova objects", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
== DialogResult.No) return;
|
||||
await ImportToQuickBooks();
|
||||
|
||||
w = new Waiting();
|
||||
w.Show();
|
||||
w.Ops = $"Import completed";
|
||||
switch (_Type)
|
||||
{
|
||||
case AyaType.Customer:
|
||||
w.Step = "Refreshing QB Customers cache";
|
||||
await util.PopulateQBClientCacheAsync();
|
||||
break;
|
||||
case AyaType.Vendor:
|
||||
w.Step = "Refreshing QB Vendors cache";
|
||||
await util.PopulateQBVendorCacheAsync();
|
||||
break;
|
||||
case AyaType.ServiceRate:
|
||||
case AyaType.TravelRate:
|
||||
case AyaType.Part:
|
||||
w.Step = "Refreshing QB Items cache";
|
||||
await util.PopulateQBItemCacheAsync();
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (MessageBox.Show(
|
||||
"Import and link the selected QuickBooks objects into AyaNova.\r\n\r\n" +
|
||||
"Are you sure?", "Import QuickBooks objects", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
== DialogResult.No) return;
|
||||
await ImportToAyaNova();
|
||||
w = new Waiting();
|
||||
w.Show();
|
||||
w.Ops = $"Import completed";
|
||||
switch (_Type)
|
||||
{
|
||||
|
||||
case AyaType.Customer:
|
||||
w.Step = "Refreshing AyaNova Customers cache";
|
||||
await util.PopulateAyaClientList();
|
||||
break;
|
||||
case AyaType.Vendor:
|
||||
w.Step = "Refreshing AyaNova Vendors cache";
|
||||
await util.PopulateAyaVendorList();
|
||||
break;
|
||||
case AyaType.ServiceRate:
|
||||
w.Step = "Refreshing AyaNova Service rates cache";
|
||||
await util.PopulateAyaServiceRateList();
|
||||
break;
|
||||
case AyaType.TravelRate:
|
||||
w.Step = "Refreshing AyaNova Travel rates cache";
|
||||
await util.PopulateAyaTravelRateList();
|
||||
break;
|
||||
case AyaType.Part:
|
||||
w.Step = "Refreshing AyaNova Parts cache";
|
||||
await util.PopulateAyaPartList();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
catch (Exception ex)
|
||||
{
|
||||
if (MessageBox.Show(
|
||||
"Import and link the selected QuickBooks objects into AyaNova.\r\n\r\n" +
|
||||
"Are you sure?", "Import QuickBooks objects", MessageBoxButtons.YesNo, MessageBoxIcon.Question)
|
||||
== DialogResult.No) return;
|
||||
await ImportToAyaNova();
|
||||
switch (_Type)
|
||||
{
|
||||
|
||||
case AyaType.Customer:
|
||||
await util.PopulateAyaClientList();
|
||||
break;
|
||||
case AyaType.Vendor:
|
||||
await util.PopulateAyaVendorList();
|
||||
break;
|
||||
case AyaType.ServiceRate:
|
||||
await util.PopulateAyaServiceRateList();
|
||||
break;
|
||||
case AyaType.TravelRate:
|
||||
await util.PopulateAyaTravelRateList();
|
||||
break;
|
||||
case AyaType.Part:
|
||||
await util.PopulateAyaPartList();
|
||||
break;
|
||||
}
|
||||
if (w != null)
|
||||
w.Visible = false;
|
||||
await util.CrackDisplayAndIntegrationLogException(ex, "QBI:Map:ImportSelectedItems");
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (w != null)
|
||||
w.Close();
|
||||
menuStrip1.Enabled = gridQB.Enabled = gridAya.Enabled = true;
|
||||
}
|
||||
Initialize();
|
||||
}
|
||||
@@ -128,6 +164,7 @@ namespace AyaNovaQBI
|
||||
w.Ops = "Importing from QuickBooks...";
|
||||
try
|
||||
{
|
||||
menuStrip1.Enabled = gridQB.Enabled = gridAya.Enabled = false;
|
||||
foreach (DataGridViewRow r in gridQB.SelectedRows)
|
||||
{
|
||||
var QBItemName = r.Cells[0].Value.ToString();
|
||||
@@ -184,8 +221,8 @@ namespace AyaNovaQBI
|
||||
}
|
||||
finally
|
||||
{
|
||||
|
||||
w.Close();
|
||||
menuStrip1.Enabled = gridQB.Enabled = gridAya.Enabled = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user