This commit is contained in:
@@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@@ -28,7 +26,7 @@ namespace AyaNovaQBI
|
|||||||
public Map()
|
public Map()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
this.Icon = AyaNovaQBI.Properties.Resources.logo;
|
Icon = AyaNovaQBI.Properties.Resources.logo;
|
||||||
|
|
||||||
_aya = new DataTable("AyaNova");
|
_aya = new DataTable("AyaNova");
|
||||||
_aya.Columns.Add("name", typeof(string));
|
_aya.Columns.Add("name", typeof(string));
|
||||||
@@ -183,7 +181,7 @@ namespace AyaNovaQBI
|
|||||||
|
|
||||||
private async Task ImportToQuickBooks()
|
private async Task ImportToQuickBooks()
|
||||||
{
|
{
|
||||||
this.Refresh();
|
Refresh();
|
||||||
Cursor.Current = Cursors.WaitCursor;
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
ArrayList alErrors = new ArrayList();
|
ArrayList alErrors = new ArrayList();
|
||||||
Waiting w = new Waiting();
|
Waiting w = new Waiting();
|
||||||
@@ -258,6 +256,8 @@ namespace AyaNovaQBI
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await util.SaveIntegrationObject();
|
||||||
|
|
||||||
//display errors if any
|
//display errors if any
|
||||||
if (alErrors.Count != 0)
|
if (alErrors.Count != 0)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
TODO:
|
TODO:
|
||||||
|
Screenshots before expires!!!!
|
||||||
REFRESH / UPDATE was previously done in v7 plugin in clients, parts grids etc, now needs to be added into qbi itself, maybe in the link form and then also need to rename the link form in the UI
|
REFRESH / UPDATE was previously done in v7 plugin in clients, parts grids etc, now needs to be added into qbi itself, maybe in the link form and then also need to rename the link form in the UI
|
||||||
as it's doing a *lot* of stuff, maybe just "Linking and updating", "Linked objects"?
|
as it's doing a *lot* of stuff, maybe just "Linking and updating", "Linked objects"?
|
||||||
Test persisted form settings for server url (ONCE POSTED NEW BUILD OF AYANOVA TO TEST SERVER)
|
Test persisted form settings for server url (ONCE POSTED NEW BUILD OF AYANOVA TO TEST SERVER)
|
||||||
@@ -8,4 +9,3 @@ TEST auto-linking not tested due to import not coded yet so would be fuckery to
|
|||||||
Integration object is saved too often as copied the code from v7, oncce working change that to save when ops are done only as it's a much more potentially expensive operation now
|
Integration object is saved too often as copied the code from v7, oncce working change that to save when ops are done only as it's a much more potentially expensive operation now
|
||||||
e.g.Util.ImportAyaCustomer at bottom
|
e.g.Util.ImportAyaCustomer at bottom
|
||||||
unselect first item in map for both grids as they currently open with the first tiem highlighted
|
unselect first item in map for both grids as they currently open with the first tiem highlighted
|
||||||
link -> import from qb should re-initialize grids, also other direction too so that imported items appear in grid showing it worked
|
|
||||||
@@ -3542,22 +3542,22 @@ namespace AyaNovaQBI
|
|||||||
|
|
||||||
#region Import / refresh to AyaNova
|
#region Import / refresh to AyaNova
|
||||||
|
|
||||||
public static async Task RefreshAyaNovaClientFromQB(List<long> objectIDList)
|
//public static async Task RefreshAyaNovaClientFromQB(List<long> objectIDList)
|
||||||
{
|
//{
|
||||||
await PopulateQBClientCacheAsync();
|
// await PopulateQBClientCacheAsync();
|
||||||
foreach (long id in objectIDList)
|
// foreach (long id in objectIDList)
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
var r = await GetAsync($"customer/{id}");
|
// var r = await GetAsync($"customer/{id}");
|
||||||
var c = r.ObjectResponse["data"].ToObject<Customer>();
|
// var c = r.ObjectResponse["data"].ToObject<Customer>();
|
||||||
RefreshAyaNovaClientFromQB(c);
|
// RefreshAyaNovaClientFromQB(c);
|
||||||
r = await PutAsync($"customer", Newtonsoft.Json.JsonConvert.SerializeObject(c));
|
// r = await PutAsync($"customer", Newtonsoft.Json.JsonConvert.SerializeObject(c));
|
||||||
}
|
// }
|
||||||
catch { };
|
// catch { };
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
public static async void RefreshAyaNovaClientFromQB(Customer c)
|
public static async void RefreshAyaNovaClientFromQB(Customer c)
|
||||||
{
|
{
|
||||||
@@ -4472,39 +4472,39 @@ namespace AyaNovaQBI
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
public static async Task ImportAyaCustomer(List<long> objectIDList)
|
//public static async Task ImportAyaCustomer(List<long> objectIDList)
|
||||||
{
|
//{
|
||||||
ArrayList alErrors = new ArrayList();
|
// ArrayList alErrors = new ArrayList();
|
||||||
foreach (long ayid in objectIDList)
|
// foreach (long ayid in objectIDList)
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
|
|
||||||
await ImportAyaCustomer(ayid, alErrors);
|
// await ImportAyaCustomer(ayid, alErrors);
|
||||||
|
|
||||||
}
|
// }
|
||||||
catch { };
|
// catch { };
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (alErrors.Count != 0)
|
// if (alErrors.Count != 0)
|
||||||
{
|
// {
|
||||||
|
|
||||||
|
|
||||||
StringBuilder sb = new StringBuilder();
|
// StringBuilder sb = new StringBuilder();
|
||||||
sb.Append("Export completed with some errors:\r\n\r\n");
|
// sb.Append("Export completed with some errors:\r\n\r\n");
|
||||||
foreach (object o in alErrors)
|
// foreach (object o in alErrors)
|
||||||
{
|
// {
|
||||||
sb.Append((string)o);
|
// sb.Append((string)o);
|
||||||
sb.Append("\r\n************\r\n");
|
// sb.Append("\r\n************\r\n");
|
||||||
|
|
||||||
}
|
// }
|
||||||
|
|
||||||
CopyableMessageBox cb = new CopyableMessageBox(sb.ToString());
|
// CopyableMessageBox cb = new CopyableMessageBox(sb.ToString());
|
||||||
cb.ShowDialog();
|
// cb.ShowDialog();
|
||||||
cb.Dispose();
|
// cb.Dispose();
|
||||||
|
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -4716,14 +4716,6 @@ namespace AyaNovaQBI
|
|||||||
//Link
|
//Link
|
||||||
var m = new IntegrationItem { AType = AyaType.Customer, IntegrationItemName = sName, IntegrationItemId = sNewCustID, LastSync = DateTime.Now, ObjectId = c.Id };
|
var m = new IntegrationItem { AType = AyaType.Customer, IntegrationItemName = sName, IntegrationItemId = sNewCustID, LastSync = DateTime.Now, ObjectId = c.Id };
|
||||||
QBIntegration.Items.Add(m);
|
QBIntegration.Items.Add(m);
|
||||||
await util.SaveIntegrationObject();
|
|
||||||
//IntegrationMap m = QBI.Maps.Add(QBI);
|
|
||||||
//m.Name = sName;
|
|
||||||
//m.RootObjectID = c.ID;
|
|
||||||
//m.RootObjectType = RootObjectTypes.Client;
|
|
||||||
//m.LastSync = DateTime.Now;
|
|
||||||
//m.ForeignID = sNewCustID;
|
|
||||||
//QBI = (Integration)QBI.Save();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -4933,14 +4925,7 @@ namespace AyaNovaQBI
|
|||||||
//Link
|
//Link
|
||||||
var m = new IntegrationItem { AType = AyaType.Vendor, IntegrationItemName = sName, IntegrationItemId = sNewCustID, LastSync = DateTime.Now, ObjectId = c.Id };
|
var m = new IntegrationItem { AType = AyaType.Vendor, IntegrationItemName = sName, IntegrationItemId = sNewCustID, LastSync = DateTime.Now, ObjectId = c.Id };
|
||||||
QBIntegration.Items.Add(m);
|
QBIntegration.Items.Add(m);
|
||||||
await util.SaveIntegrationObject();
|
|
||||||
//IntegrationMap m = QBI.Maps.Add(QBI);
|
|
||||||
//m.Name = sName;
|
|
||||||
//m.RootObjectID = c.ID;
|
|
||||||
//m.RootObjectType = RootObjectTypes.Vendor;
|
|
||||||
//m.LastSync = DateTime.Now;
|
|
||||||
//m.ForeignID = sNewCustID;
|
|
||||||
//QBI = (Integration)QBI.Save();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -4963,25 +4948,25 @@ namespace AyaNovaQBI
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
///// <summary>
|
||||||
/// Refresh the list of AyaNova parts to their linked QuickBooks item records
|
///// Refresh the list of AyaNova parts to their linked QuickBooks item records
|
||||||
/// </summary>
|
///// </summary>
|
||||||
/// <param name="objectIDList"></param>
|
///// <param name="objectIDList"></param>
|
||||||
public static async Task RefreshQBPartFromAyaNova(List<long> objectIDList)
|
//public static async Task RefreshQBPartFromAyaNova(List<long> objectIDList)
|
||||||
{
|
//{
|
||||||
foreach (long id in objectIDList)
|
// foreach (long id in objectIDList)
|
||||||
{
|
// {
|
||||||
try
|
// try
|
||||||
{
|
// {
|
||||||
var r = await GetAsync($"part/{id}");
|
// var r = await GetAsync($"part/{id}");
|
||||||
var c = r.ObjectResponse["data"].ToObject<Part>();
|
// var c = r.ObjectResponse["data"].ToObject<Part>();
|
||||||
await RefreshQBPartFromAyaNova(c);
|
// await RefreshQBPartFromAyaNova(c);
|
||||||
|
|
||||||
}
|
// }
|
||||||
catch { };
|
// catch { };
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
//}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Refresh the indicated AyaNova part
|
/// Refresh the indicated AyaNova part
|
||||||
@@ -5333,14 +5318,7 @@ namespace AyaNovaQBI
|
|||||||
//Link
|
//Link
|
||||||
var m = new IntegrationItem { AType = AyaType.Part, IntegrationItemName = sName, IntegrationItemId = sNewID, LastSync = DateTime.Now, ObjectId = c.Id };
|
var m = new IntegrationItem { AType = AyaType.Part, IntegrationItemName = sName, IntegrationItemId = sNewID, LastSync = DateTime.Now, ObjectId = c.Id };
|
||||||
QBIntegration.Items.Add(m);
|
QBIntegration.Items.Add(m);
|
||||||
await util.SaveIntegrationObject();
|
|
||||||
//IntegrationMap m = QBI.Maps.Add(QBI);
|
|
||||||
//m.Name = sName;
|
|
||||||
//m.RootObjectID = c.ID;
|
|
||||||
//m.RootObjectType = RootObjectTypes.Part;
|
|
||||||
//m.LastSync = DateTime.Now;
|
|
||||||
//m.ForeignID = sNewID;
|
|
||||||
//QBI = (Integration)QBI.Save();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -5492,14 +5470,7 @@ namespace AyaNovaQBI
|
|||||||
//Link
|
//Link
|
||||||
var m = new IntegrationItem { AType = AyaType.ServiceRate, IntegrationItemName = sName, IntegrationItemId = sNewID, LastSync = DateTime.Now, ObjectId = c.Id };
|
var m = new IntegrationItem { AType = AyaType.ServiceRate, IntegrationItemName = sName, IntegrationItemId = sNewID, LastSync = DateTime.Now, ObjectId = c.Id };
|
||||||
QBIntegration.Items.Add(m);
|
QBIntegration.Items.Add(m);
|
||||||
await util.SaveIntegrationObject();
|
|
||||||
//IntegrationMap m = QBI.Maps.Add(QBI);
|
|
||||||
//m.Name = sName;
|
|
||||||
//m.RootObjectID = c.ID;
|
|
||||||
//m.RootObjectType = RootObjectTypes.Rate;
|
|
||||||
//m.LastSync = DateTime.Now;
|
|
||||||
//m.ForeignID = sNewID;
|
|
||||||
//QBI = (Integration)QBI.Save();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -5649,14 +5620,7 @@ namespace AyaNovaQBI
|
|||||||
//Link
|
//Link
|
||||||
var m = new IntegrationItem { AType = AyaType.TravelRate, IntegrationItemName = sName, IntegrationItemId = sNewID, LastSync = DateTime.Now, ObjectId = c.Id };
|
var m = new IntegrationItem { AType = AyaType.TravelRate, IntegrationItemName = sName, IntegrationItemId = sNewID, LastSync = DateTime.Now, ObjectId = c.Id };
|
||||||
QBIntegration.Items.Add(m);
|
QBIntegration.Items.Add(m);
|
||||||
await util.SaveIntegrationObject();
|
|
||||||
//IntegrationMap m = QBI.Maps.Add(QBI);
|
|
||||||
//m.Name = sName;
|
|
||||||
//m.RootObjectID = c.ID;
|
|
||||||
//m.RootObjectType = RootObjectTypes.Rate;
|
|
||||||
//m.LastSync = DateTime.Now;
|
|
||||||
//m.ForeignID = sNewID;
|
|
||||||
//QBI = (Integration)QBI.Save();
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user