This commit is contained in:
2022-07-06 23:08:25 +00:00
parent d11dba69f9
commit 47d1fc14d2
3 changed files with 138 additions and 213 deletions

View File

@@ -28,10 +28,10 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle9 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle10 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle11 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle12 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle();
System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle();
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.objectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.customersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -45,6 +45,7 @@
this.unlinkedItemsOnlyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.linkSelectedItemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.importSelectedItemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.updateSelectedItemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.autoLinkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.gridAya = new System.Windows.Forms.DataGridView();
this.AyaName = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -57,7 +58,6 @@
this.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.updateSelectedItemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.gridAya)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.gridQB)).BeginInit();
@@ -71,10 +71,10 @@
//
this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.objectToolStripMenuItem,
this.showToolStripMenuItem,
this.linkSelectedItemsToolStripMenuItem,
this.importSelectedItemsToolStripMenuItem,
this.updateSelectedItemsToolStripMenuItem,
this.showToolStripMenuItem,
this.autoLinkToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
@@ -152,7 +152,7 @@
this.allItemsToolStripMenuItem.CheckOnClick = true;
this.allItemsToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.allItemsToolStripMenuItem.Name = "allItemsToolStripMenuItem";
this.allItemsToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.allItemsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.allItemsToolStripMenuItem.Tag = "all";
this.allItemsToolStripMenuItem.Text = "&All items";
this.allItemsToolStripMenuItem.Click += new System.EventHandler(this.showSubItemToolStripMenuItem_Click);
@@ -161,7 +161,7 @@
//
this.linkedItemsOnlyToolStripMenuItem.CheckOnClick = true;
this.linkedItemsOnlyToolStripMenuItem.Name = "linkedItemsOnlyToolStripMenuItem";
this.linkedItemsOnlyToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.linkedItemsOnlyToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.linkedItemsOnlyToolStripMenuItem.Tag = "linked";
this.linkedItemsOnlyToolStripMenuItem.Text = "&Linked items only";
this.linkedItemsOnlyToolStripMenuItem.Click += new System.EventHandler(this.showSubItemToolStripMenuItem_Click);
@@ -170,7 +170,7 @@
//
this.unlinkedItemsOnlyToolStripMenuItem.CheckOnClick = true;
this.unlinkedItemsOnlyToolStripMenuItem.Name = "unlinkedItemsOnlyToolStripMenuItem";
this.unlinkedItemsOnlyToolStripMenuItem.Size = new System.Drawing.Size(179, 22);
this.unlinkedItemsOnlyToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.unlinkedItemsOnlyToolStripMenuItem.Tag = "unlinked";
this.unlinkedItemsOnlyToolStripMenuItem.Text = "&Unlinked items only";
this.unlinkedItemsOnlyToolStripMenuItem.Click += new System.EventHandler(this.showSubItemToolStripMenuItem_Click);
@@ -189,6 +189,14 @@
this.importSelectedItemsToolStripMenuItem.Text = "&Import selected items";
this.importSelectedItemsToolStripMenuItem.Click += new System.EventHandler(this.importSelectedItemsToolStripMenuItem_Click);
//
// updateSelectedItemsToolStripMenuItem
//
this.updateSelectedItemsToolStripMenuItem.Name = "updateSelectedItemsToolStripMenuItem";
this.updateSelectedItemsToolStripMenuItem.Size = new System.Drawing.Size(135, 20);
this.updateSelectedItemsToolStripMenuItem.Text = "&Update selected items";
this.updateSelectedItemsToolStripMenuItem.Visible = false;
this.updateSelectedItemsToolStripMenuItem.Click += new System.EventHandler(this.updateSelectedItemsToolStripMenuItem_Click);
//
// autoLinkToolStripMenuItem
//
this.autoLinkToolStripMenuItem.Name = "autoLinkToolStripMenuItem";
@@ -201,17 +209,17 @@
this.gridAya.AllowUserToAddRows = false;
this.gridAya.AllowUserToDeleteRows = false;
this.gridAya.AllowUserToResizeRows = false;
dataGridViewCellStyle9.BackColor = System.Drawing.Color.WhiteSmoke;
this.gridAya.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle9;
dataGridViewCellStyle1.BackColor = System.Drawing.Color.WhiteSmoke;
this.gridAya.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle1;
this.gridAya.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewCellStyle10.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle10.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle10.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle10.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.SelectionBackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle10.SelectionForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle10.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.gridAya.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle10;
dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.gridAya.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle2;
this.gridAya.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gridAya.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.AyaName,
@@ -258,17 +266,17 @@
this.gridQB.AllowUserToAddRows = false;
this.gridQB.AllowUserToDeleteRows = false;
this.gridQB.AllowUserToResizeRows = false;
dataGridViewCellStyle11.BackColor = System.Drawing.Color.WhiteSmoke;
this.gridQB.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle11;
dataGridViewCellStyle3.BackColor = System.Drawing.Color.WhiteSmoke;
this.gridQB.AlternatingRowsDefaultCellStyle = dataGridViewCellStyle3;
this.gridQB.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.Fill;
dataGridViewCellStyle12.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle12.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle12.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.SelectionBackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle12.SelectionForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle12.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.gridQB.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle12;
dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Control;
dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.WindowText;
dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True;
this.gridQB.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4;
this.gridQB.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.gridQB.Columns.AddRange(new System.Windows.Forms.DataGridViewColumn[] {
this.dataGridViewTextBoxColumn1,
@@ -351,14 +359,6 @@
this.label2.TabIndex = 6;
this.label2.Text = "QuickBooks";
//
// updateSelectedItemsToolStripMenuItem
//
this.updateSelectedItemsToolStripMenuItem.Name = "updateSelectedItemsToolStripMenuItem";
this.updateSelectedItemsToolStripMenuItem.Size = new System.Drawing.Size(135, 20);
this.updateSelectedItemsToolStripMenuItem.Text = "&Update selected items";
this.updateSelectedItemsToolStripMenuItem.Visible = false;
this.updateSelectedItemsToolStripMenuItem.Click += new System.EventHandler(this.updateSelectedItemsToolStripMenuItem_Click);
//
// Map
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);

View File

@@ -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;
}
}

View File

@@ -3888,22 +3888,22 @@ namespace AyaNovaQBI
c.Country = a.Country;
c.Contact = dr["Contact"].ToString();
if (dr["Phone"].ToString() != "")
c.Phone1 = dr["Phone"].ToString();
if (dr["Fax"].ToString() != "")
c.Phone2 = dr["Fax"].ToString();
if (dr["AltPhone"].ToString() != "")
c.Phone3 = dr["AltPhone"].ToString();
if (dr["Email"].ToString() != "")
c.Phone3 = dr["AltPhone"].ToString();
if (dr["Email"].ToString() != "")
c.EmailAddress = dr["Email"].ToString();
if (dr["Account"].ToString() != "")
if (dr["Account"].ToString() != "")
c.AccountNumber = dr["Account"].ToString();
//Try to save and return errors if not in alerrors
var r = await PostAsync($"vendor", Newtonsoft.Json.JsonConvert.SerializeObject(c));
@@ -3912,25 +3912,7 @@ namespace AyaNovaQBI
//Link
var m = new IntegrationItem { AType = AyaType.Vendor, IntegrationItemName = sName, IntegrationItemId = QuickBooksID, LastSync = DateTime.Now, ObjectId = newId };
QBIntegration.Items.Add(m);
await util.SaveIntegrationObject();
//if (!c.IsSavable)
//{
// alErrors.Add("ImportQBVendor: AyaNova won't allow import of " + c.Name + "\r\n" +
// "Due to the following broken rules:\r\n" + c.GetBrokenRulesString());
// return;
//}
//c = (Vendor)c.Save();
////Link
//IntegrationMap m = QBI.Maps.Add(QBI);
//m.Name = sName;
//m.RootObjectID = c.ID;
//m.RootObjectType = RootObjectTypes.Vendor;
//m.LastSync = DateTime.Now;
//m.ForeignID = QuickBooksID;
//QBI = (Integration)QBI.Save();
await util.SaveIntegrationObject();
}
catch (Exception ex)
{
@@ -3962,13 +3944,6 @@ namespace AyaNovaQBI
}
string sName = dr["FullName"].ToString();
//if (sName.Length > 255)
//{
// alErrors.Add("ImportQBRate: QuickBooks Rate name exceeds 255 character limit for AyaNova\r\n" +
// "Name: " + dr["FullName"].ToString() + "\r\n" +
// "was imported as: " + sName);
// sName = sName.Substring(0, 255);
//}
try
{
//already a Rate by that name
@@ -4050,13 +4025,7 @@ namespace AyaNovaQBI
}
string sName = dr["FullName"].ToString();
//if (sName.Length > 255)
//{
// alErrors.Add("ImportQBRate: QuickBooks Rate name exceeds 255 character limit for AyaNova\r\n" +
// "Name: " + dr["FullName"].ToString() + "\r\n" +
// "was imported as: " + sName);
// sName = sName.Substring(0, 255);
//}
try
{
//already a Rate by that name
@@ -4068,9 +4037,7 @@ namespace AyaNovaQBI
}
//Import seems safe...
//Rates rates = Rates.GetItems(false);
//Rate c = rates.Add();
//c.RateType = AsRateType;
TravelRate c = new TravelRate();
c.Name = sName;
c.Charge = (decimal)dr["Price"];
@@ -4078,28 +4045,7 @@ namespace AyaNovaQBI
c.Cost = (decimal)dr["Cost"];
c.Notes = T(255, dr["SalesDesc"].ToString());
c.Active = true;
// c.RateUnitChargeDescriptionID = MostLikelyRateUnitChargeDescriptionID;
//if (!c.IsSavable)
//{
// alErrors.Add("ImportQBRate: AyaNova won't allow import of " + c.Name + "\r\n" +
// "Due to the following broken rules:\r\n" + c.GetBrokenRulesString());
// return;
//}
//rates = (Rates)rates.Save();
////Link
//IntegrationMap m = QBI.Maps.Add(QBI);
//m.Name = sName;
//m.RootObjectID = c.ID;
//m.RootObjectType = RootObjectTypes.Rate;
//m.LastSync = DateTime.Now;
//m.ForeignID = QuickBooksID;
//QBI = (Integration)QBI.Save();
var r = await PostAsync($"travel-rate", Newtonsoft.Json.JsonConvert.SerializeObject(c));
long newId = IdFromResponse(r);
@@ -4122,8 +4068,6 @@ namespace AyaNovaQBI
public static async Task RefreshAyaNovaPartFromQBAsync(IntegrationItem im, bool pricesOnly = false)
{
if (im == null) return;//this part is not linked
@@ -4169,13 +4113,6 @@ namespace AyaNovaQBI
}
string sName = dr["FullName"].ToString();
//if (sName.Length > 255)
//{
// alErrors.Add("ImportQBPart: QuickBooks Part name exceeds 255 character limit for AyaNova part number\r\n" +
// "Name: " + dr["FullName"].ToString() + "\r\n" +
// "was imported as: " + sName);
// sName = sName.Substring(0, 255);
//}
try
{
//already a Part by that number?
@@ -4196,27 +4133,6 @@ namespace AyaNovaQBI
c.Cost = (decimal)dr["Cost"];
c.Active = true;
//if (!c.IsSavable)
//{
// alErrors.Add("ImportQBPart: AyaNova won't allow import of " + c.Name + "\r\n" +
// "Due to the following broken rules:\r\n" + c.GetBrokenRulesString());
// return;
//}
////Save and get ready to provide the ID
//c = (Part)c.Save();
////Link
//IntegrationMap m = QBI.Maps.Add(QBI);
//m.Name = sName;
//m.RootObjectID = c.ID;
//m.RootObjectType = RootObjectTypes.Part;
//m.LastSync = DateTime.Now;
//m.ForeignID = QuickBooksID;
//QBI = (Integration)QBI.Save();
//Try to save and return errors if not in alerrors
var r = await PostAsync($"part", Newtonsoft.Json.JsonConvert.SerializeObject(c));
long newId = IdFromResponse(r);
@@ -4344,7 +4260,7 @@ namespace AyaNovaQBI
ca.BillAddress.Addr2.SetValue(T(41, sad[0].TrimEnd()));
if (sad.GetLength(0) > 1)
ca.BillAddress.Addr3.SetValue(T(41, sad[1].TrimEnd()));
if (QVersion > 1.1 && sad.GetLength(0) > 3)//4th address line is 2 or newer
ca.BillAddress.Addr4.SetValue(T(41, sad[2].TrimEnd()));
@@ -4472,11 +4388,6 @@ namespace AyaNovaQBI
}
}
/// <summary>
/// Import the indicated client
/// to QuickBooks customer record
@@ -4816,7 +4727,7 @@ namespace AyaNovaQBI
dr["Modified"] = DateTime.Now;//ditto
dr["Account"] = "";
ca.Name.SetValue(sName);
ca.Name.SetValue(sName);
ca.Contact.SetValue(T(41, c.Contact));
//ca.LastName.SetValue(T(25, c.Contact));
@@ -4828,7 +4739,7 @@ namespace AyaNovaQBI
ca.AltPhone.SetValue(T(21, c.Phone3));
ca.Email.SetValue(T(99, c.EmailAddress));
if (!string.IsNullOrWhiteSpace(c.PostAddress))
@@ -4988,8 +4899,6 @@ namespace AyaNovaQBI
//Case 687
ca.Contact.SetValue(T(41, c.Contact));
//ca.FirstName.SetValue(T(25,Primary.FirstName));
//ca.LastName.SetValue(T(25, c.Contact));
if (c.Phone1 != null)
ca.Phone.SetValue(T(21, c.Phone1));
@@ -5087,27 +4996,6 @@ namespace AyaNovaQBI
///// <summary>
///// Refresh the list of AyaNova parts to their linked QuickBooks item records
///// </summary>
///// <param name="objectIDList"></param>
//public static async Task RefreshQBPartFromAyaNova(List<long> objectIDList)
//{
// foreach (long id in objectIDList)
// {
// try
// {
// var r = await GetAsync($"part/{id}");
// var c = r.ObjectResponse["data"].ToObject<Part>();
// await RefreshQBPartFromAyaNova(c);
// }
// catch { };
// }
//}
/// <summary>
/// Refresh the indicated AyaNova part
/// to it's linked QuickBooks item record
@@ -5130,7 +5018,7 @@ namespace AyaNovaQBI
string sDescription = c.Description;// PartPickList.GetOnePart(c.ID)[0].DisplayName(AyaBizUtils.GlobalSettings.DefaultPartDisplayFormat);
string sDescription = c.Description ?? "";// PartPickList.GetOnePart(c.ID)[0].DisplayName(AyaBizUtils.GlobalSettings.DefaultPartDisplayFormat);
if (sDescription.Length > 4095)
sDescription = sDescription.Substring(0, 4095);
@@ -5312,7 +5200,7 @@ namespace AyaNovaQBI
"will be imported as: " + sName);
}
string sDescription = c.Description;//PartPickList.GetOnePart(c.ID)[0].DisplayName(AyaBizUtils.GlobalSettings.DefaultPartDisplayFormat);
string sDescription = c.Description ?? "";//PartPickList.GetOnePart(c.ID)[0].DisplayName(AyaBizUtils.GlobalSettings.DefaultPartDisplayFormat);
if (sDescription.Length > 4095)
{
sDescription = sDescription.Substring(0, 4095);
@@ -5752,7 +5640,7 @@ namespace AyaNovaQBI
private static string T(int nLength, string s)
{
if (s == null || s == "") return "";
if (string.IsNullOrWhiteSpace(s)) return "";
if (s.Length <= nLength) return s;
else
return s.Substring(0, nLength);