This commit is contained in:
@@ -1,11 +1,8 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
|
||||||
using System.Data;
|
|
||||||
using System.Drawing;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using System.Windows.Forms;
|
using System.Windows.Forms;
|
||||||
|
|
||||||
namespace AyaNovaQBI
|
namespace AyaNovaQBI
|
||||||
@@ -150,7 +147,7 @@ namespace AyaNovaQBI
|
|||||||
if (d.Choice == "IMPORT")
|
if (d.Choice == "IMPORT")
|
||||||
{
|
{
|
||||||
ArrayList alErrors = new ArrayList();
|
ArrayList alErrors = new ArrayList();
|
||||||
util.ImportAyaClient((Guid)e.Cell.Row.Cells["RootObjectID"].Value, alErrors);
|
await util.ImportAyaCustomer(mm.ObjectId, alErrors);
|
||||||
//display errors if any
|
//display errors if any
|
||||||
if (alErrors.Count != 0)
|
if (alErrors.Count != 0)
|
||||||
{
|
{
|
||||||
@@ -176,20 +173,18 @@ namespace AyaNovaQBI
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
//it's a link by default
|
//it's a link by default
|
||||||
if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBClients.Rows.Contains(d.SelectedQBItem))
|
if (string.IsNullOrWhiteSpace(d.SelectedQBItemId) || !util.QBClients.Rows.Contains(d.SelectedQBItemId))
|
||||||
return;
|
return;
|
||||||
QBItemName = d.SelectedQBItemName;
|
QBItemName = d.SelectedQBItemName;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case AyaType.ServiceRate:
|
case AyaType.ServiceRate:
|
||||||
d.CanImport = false;
|
d.CanImport = false;
|
||||||
d.QBItems = util.QBItems;
|
d.QBItems = util.QBItems;
|
||||||
if (d.ShowDialog() == DialogResult.Cancel) return;
|
if (d.ShowDialog() == DialogResult.Cancel) return;
|
||||||
|
|
||||||
if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem))
|
if (string.IsNullOrWhiteSpace(d.SelectedQBItemId) || !util.QBItems.Rows.Contains(d.SelectedQBItemId))
|
||||||
return;
|
return;
|
||||||
QBItemName = d.SelectedQBItemName;
|
QBItemName = d.SelectedQBItemName;
|
||||||
break;
|
break;
|
||||||
@@ -198,7 +193,7 @@ namespace AyaNovaQBI
|
|||||||
d.QBItems = util.QBItems;
|
d.QBItems = util.QBItems;
|
||||||
if (d.ShowDialog() == DialogResult.Cancel) return;
|
if (d.ShowDialog() == DialogResult.Cancel) return;
|
||||||
|
|
||||||
if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem))
|
if (string.IsNullOrWhiteSpace(d.SelectedQBItemId) || !util.QBItems.Rows.Contains(d.SelectedQBItemId))
|
||||||
return;
|
return;
|
||||||
QBItemName = d.SelectedQBItemName;
|
QBItemName = d.SelectedQBItemName;
|
||||||
break;
|
break;
|
||||||
@@ -207,87 +202,66 @@ namespace AyaNovaQBI
|
|||||||
d.QBItems = util.QBItems;
|
d.QBItems = util.QBItems;
|
||||||
if (d.ShowDialog() == DialogResult.Cancel) return;
|
if (d.ShowDialog() == DialogResult.Cancel) return;
|
||||||
|
|
||||||
if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem))
|
if (string.IsNullOrWhiteSpace(d.SelectedQBItemId) || !util.QBItems.Rows.Contains(d.SelectedQBItemId))
|
||||||
return;
|
return;
|
||||||
QBItemName = d.SelectedQBItemName;
|
QBItemName = d.SelectedQBItemName;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case AyaType.WorkorderItemOutsideService:
|
case AyaType.WorkOrderItemOutsideService:
|
||||||
d.CanImport = false;
|
d.CanImport = false;
|
||||||
d.QBItems = util.QBItems;
|
d.QBItems = util.QBItems;
|
||||||
if (d.ShowDialog() == DialogResult.Cancel) return;
|
if (d.ShowDialog() == DialogResult.Cancel) return;
|
||||||
|
|
||||||
|
|
||||||
if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem))
|
if (string.IsNullOrWhiteSpace(d.SelectedQBItemId) || !util.QBItems.Rows.Contains(d.SelectedQBItemId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
util.QDat.OutsideServiceChargeAs = d.SelectedQBItem;
|
util.QDat.OutsideServiceChargeAs = d.SelectedQBItemId;
|
||||||
|
await util.SaveIntegrationObject();
|
||||||
//Case 299
|
|
||||||
util.QBI.AIObject = util.QDat.XMLData;
|
|
||||||
//util.QBI.AIObject = util.QDat;
|
|
||||||
|
|
||||||
util.QBI = (Integration)util.QBI.Save();
|
|
||||||
util.QDat.IsDirty = false;
|
|
||||||
goto REMOVEITEMS;
|
goto REMOVEITEMS;
|
||||||
|
|
||||||
|
case AyaType.WorkOrderItemLoan:
|
||||||
case AyaType.WorkorderItemLoan:
|
|
||||||
d.CanImport = false;
|
d.CanImport = false;
|
||||||
d.QBItems = util.QBItems;
|
d.QBItems = util.QBItems;
|
||||||
if (d.ShowDialog() == DialogResult.Cancel) return;
|
if (d.ShowDialog() == DialogResult.Cancel) return;
|
||||||
|
|
||||||
|
|
||||||
if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem))
|
if (string.IsNullOrWhiteSpace(d.SelectedQBItemId) || !util.QBItems.Rows.Contains(d.SelectedQBItemId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
util.QDat.WorkorderItemLoanChargeAs = d.SelectedQBItem;
|
util.QDat.WorkorderItemLoanChargeAs = d.SelectedQBItemId;
|
||||||
//Case 299
|
await util.SaveIntegrationObject();
|
||||||
util.QBI.AIObject = util.QDat.XMLData;
|
|
||||||
//util.QBI.AIObject = util.QDat;
|
|
||||||
util.QBI = (Integration)util.QBI.Save();
|
|
||||||
util.QDat.IsDirty = false;
|
|
||||||
goto REMOVEITEMS;
|
goto REMOVEITEMS;
|
||||||
|
|
||||||
|
|
||||||
case AyaType.WorkorderItemMiscExpense:
|
case AyaType.WorkOrderItemExpense:
|
||||||
d.CanImport = false;
|
d.CanImport = false;
|
||||||
d.QBItems = util.QBItems;
|
d.QBItems = util.QBItems;
|
||||||
if (d.ShowDialog() == DialogResult.Cancel) return;
|
if (d.ShowDialog() == DialogResult.Cancel) return;
|
||||||
|
|
||||||
|
|
||||||
if (d.SelectedQBItem == null || d.SelectedQBItem == "" || !util.QBItems.Rows.Contains(d.SelectedQBItem))
|
if (string.IsNullOrWhiteSpace(d.SelectedQBItemId) || !util.QBItems.Rows.Contains(d.SelectedQBItemId))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
util.QDat.MiscExpenseChargeAs = d.SelectedQBItem;
|
util.QDat.MiscExpenseChargeAs = d.SelectedQBItemId;
|
||||||
//Case 299
|
await util.SaveIntegrationObject();
|
||||||
util.QBI.AIObject = util.QDat.XMLData;
|
|
||||||
//util.QBI.AIObject = util.QDat;
|
|
||||||
util.QBI = (Integration)util.QBI.Save();
|
|
||||||
util.QDat.IsDirty = false;
|
|
||||||
goto REMOVEITEMS;
|
goto REMOVEITEMS;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//add the new link
|
||||||
//add the new link
|
util.QBIntegration.Items.Add(new IntegrationItem { AType = mm.ObjectType, IntegrationItemName = QBItemName, IntegrationItemId = d.SelectedQBItemId, LastSync = DateTime.Now, ObjectId = mm.ObjectId });
|
||||||
IntegrationMap m = util.QBI.Maps.Add(util.QBI);
|
await util.SaveIntegrationObject();
|
||||||
m.RootObjectID = (Guid)e.Cell.Row.Cells["RootObjectID"].Value;
|
|
||||||
m.RootObjectType = (RootObjectTypes)e.Cell.Row.Cells["ObjectType"].Value;
|
|
||||||
m.ForeignID = d.SelectedQBItem;
|
|
||||||
m.Name = QBItemName;
|
|
||||||
m.LastSync = System.DateTime.Now;
|
|
||||||
util.QBI = (Integration)util.QBI.Save();
|
|
||||||
|
|
||||||
REMOVEITEMS:
|
REMOVEITEMS:
|
||||||
|
|
||||||
//remove the object from the grid as it's now dealt with
|
//remove the object from the grid as it's now dealt with
|
||||||
e.Cell.Row.Delete(false);
|
MisMatches.RemoveAt(e.RowIndex);
|
||||||
_ChangesMade = true;
|
ChangesMade = true;
|
||||||
//If all done then close up
|
//If all done then close up
|
||||||
if (grid.Rows.Count == 0)
|
if (MisMatches.Count == 0)
|
||||||
this.Close();
|
Close();
|
||||||
|
else
|
||||||
|
grid.DataSource = MisMatches;//rebind to refresh the grid
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
|||||||
21
AyaNovaQBI/LinkOrImportAyaObject.Designer.cs
generated
21
AyaNovaQBI/LinkOrImportAyaObject.Designer.cs
generated
@@ -33,7 +33,7 @@
|
|||||||
this.lblTitle = new System.Windows.Forms.Label();
|
this.lblTitle = new System.Windows.Forms.Label();
|
||||||
this.cbQBItems = new System.Windows.Forms.ComboBox();
|
this.cbQBItems = new System.Windows.Forms.ComboBox();
|
||||||
this.label1 = new System.Windows.Forms.Label();
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
this.label2 = new System.Windows.Forms.Label();
|
this.lblImport = new System.Windows.Forms.Label();
|
||||||
this.btnImport = new System.Windows.Forms.Button();
|
this.btnImport = new System.Windows.Forms.Button();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@@ -88,14 +88,14 @@
|
|||||||
this.label1.TabIndex = 14;
|
this.label1.TabIndex = 14;
|
||||||
this.label1.Text = "Link to QuickBooks item:";
|
this.label1.Text = "Link to QuickBooks item:";
|
||||||
//
|
//
|
||||||
// label2
|
// lblImport
|
||||||
//
|
//
|
||||||
this.label2.AutoSize = true;
|
this.lblImport.AutoSize = true;
|
||||||
this.label2.Location = new System.Drawing.Point(4, 177);
|
this.lblImport.Location = new System.Drawing.Point(4, 177);
|
||||||
this.label2.Name = "label2";
|
this.lblImport.Name = "lblImport";
|
||||||
this.label2.Size = new System.Drawing.Size(194, 13);
|
this.lblImport.Size = new System.Drawing.Size(194, 13);
|
||||||
this.label2.TabIndex = 15;
|
this.lblImport.TabIndex = 15;
|
||||||
this.label2.Text = "Or import AyaNova item to QuickBooks:";
|
this.lblImport.Text = "Or import AyaNova item to QuickBooks:";
|
||||||
//
|
//
|
||||||
// btnImport
|
// btnImport
|
||||||
//
|
//
|
||||||
@@ -105,6 +105,7 @@
|
|||||||
this.btnImport.TabIndex = 16;
|
this.btnImport.TabIndex = 16;
|
||||||
this.btnImport.Text = "Import to QuickBooks";
|
this.btnImport.Text = "Import to QuickBooks";
|
||||||
this.btnImport.UseVisualStyleBackColor = true;
|
this.btnImport.UseVisualStyleBackColor = true;
|
||||||
|
this.btnImport.Click += new System.EventHandler(this.btnImport_Click);
|
||||||
//
|
//
|
||||||
// LinkOrImportAyaObject
|
// LinkOrImportAyaObject
|
||||||
//
|
//
|
||||||
@@ -115,7 +116,7 @@
|
|||||||
this.ClientSize = new System.Drawing.Size(637, 403);
|
this.ClientSize = new System.Drawing.Size(637, 403);
|
||||||
this.ControlBox = false;
|
this.ControlBox = false;
|
||||||
this.Controls.Add(this.btnImport);
|
this.Controls.Add(this.btnImport);
|
||||||
this.Controls.Add(this.label2);
|
this.Controls.Add(this.lblImport);
|
||||||
this.Controls.Add(this.label1);
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.cbQBItems);
|
this.Controls.Add(this.cbQBItems);
|
||||||
this.Controls.Add(this.lblTitle);
|
this.Controls.Add(this.lblTitle);
|
||||||
@@ -138,7 +139,7 @@
|
|||||||
private System.Windows.Forms.Label lblTitle;
|
private System.Windows.Forms.Label lblTitle;
|
||||||
private System.Windows.Forms.ComboBox cbQBItems;
|
private System.Windows.Forms.ComboBox cbQBItems;
|
||||||
private System.Windows.Forms.Label label1;
|
private System.Windows.Forms.Label label1;
|
||||||
private System.Windows.Forms.Label label2;
|
private System.Windows.Forms.Label lblImport;
|
||||||
private System.Windows.Forms.Button btnImport;
|
private System.Windows.Forms.Button btnImport;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -49,21 +49,29 @@ namespace AyaNovaQBI
|
|||||||
cbQBItems.ValueMember = "id";
|
cbQBItems.ValueMember = "id";
|
||||||
btnCancel.Text = util.AyaTranslations["Cancel"];
|
btnCancel.Text = util.AyaTranslations["Cancel"];
|
||||||
btnOK.Text = util.AyaTranslations["OK"];
|
btnOK.Text = util.AyaTranslations["OK"];
|
||||||
|
lblImport.Visible = btnImport.Visible = CanImport;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void btnCancel_Click(object sender, EventArgs e)
|
private void btnCancel_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Choice = "CANCEL";
|
||||||
DialogResult = DialogResult.Cancel;
|
DialogResult = DialogResult.Cancel;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnOK_Click(object sender, EventArgs e)
|
private void btnOK_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
|
Choice = "LINK";
|
||||||
DialogResult = DialogResult.OK;
|
DialogResult = DialogResult.OK;
|
||||||
Close();
|
Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnImport_Click(object sender, EventArgs e)
|
||||||
|
{
|
||||||
|
Choice = "IMPORT";
|
||||||
|
DialogResult = DialogResult.OK;
|
||||||
|
Close();
|
||||||
|
}
|
||||||
}//eoc
|
}//eoc
|
||||||
}//eons
|
}//eons
|
||||||
|
|||||||
Reference in New Issue
Block a user