diff --git a/AyaNovaQBI/AyaNovaQBI.csproj b/AyaNovaQBI/AyaNovaQBI.csproj
index 0e437bc..abca2d7 100644
--- a/AyaNovaQBI/AyaNovaQBI.csproj
+++ b/AyaNovaQBI/AyaNovaQBI.csproj
@@ -105,6 +105,12 @@
Map.cs
+
+ Form
+
+
+ MapSelectQBItem.cs
+
@@ -196,6 +202,9 @@
Map.cs
+
+ MapSelectQBItem.cs
+
ResXFileCodeGenerator
Resources.Designer.cs
diff --git a/AyaNovaQBI/Map.Designer.cs b/AyaNovaQBI/Map.Designer.cs
index fb05900..daf36b6 100644
--- a/AyaNovaQBI/Map.Designer.cs
+++ b/AyaNovaQBI/Map.Designer.cs
@@ -44,7 +44,6 @@
this.autoLinkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.updateAyaNovaPricesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mapSelectedItemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.unmapSelectedItemsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.grid = new System.Windows.Forms.DataGridView();
this.AyaName = new System.Windows.Forms.DataGridViewTextBoxColumn();
this.QBName = new System.Windows.Forms.DataGridViewTextBoxColumn();
@@ -61,8 +60,7 @@
this.showToolStripMenuItem,
this.autoLinkToolStripMenuItem,
this.updateAyaNovaPricesToolStripMenuItem,
- this.mapSelectedItemsToolStripMenuItem,
- this.unmapSelectedItemsToolStripMenuItem});
+ this.mapSelectedItemsToolStripMenuItem});
this.menuStrip1.Location = new System.Drawing.Point(0, 0);
this.menuStrip1.Name = "menuStrip1";
this.menuStrip1.Size = new System.Drawing.Size(800, 24);
@@ -84,35 +82,35 @@
// customersToolStripMenuItem
//
this.customersToolStripMenuItem.Name = "customersToolStripMenuItem";
- this.customersToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
+ this.customersToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.customersToolStripMenuItem.Text = "&Customers";
this.customersToolStripMenuItem.Click += new System.EventHandler(this.customersToolStripMenuItem_Click);
//
// serviceRatesToolStripMenuItem
//
this.serviceRatesToolStripMenuItem.Name = "serviceRatesToolStripMenuItem";
- this.serviceRatesToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
+ this.serviceRatesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.serviceRatesToolStripMenuItem.Text = "&Service rates";
this.serviceRatesToolStripMenuItem.Click += new System.EventHandler(this.serviceRatesToolStripMenuItem_Click);
//
// travelRatesToolStripMenuItem
//
this.travelRatesToolStripMenuItem.Name = "travelRatesToolStripMenuItem";
- this.travelRatesToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
+ this.travelRatesToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.travelRatesToolStripMenuItem.Text = "&Travel rates";
this.travelRatesToolStripMenuItem.Click += new System.EventHandler(this.travelRatesToolStripMenuItem_Click);
//
// partsToolStripMenuItem
//
this.partsToolStripMenuItem.Name = "partsToolStripMenuItem";
- this.partsToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
+ this.partsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.partsToolStripMenuItem.Text = "&Parts";
this.partsToolStripMenuItem.Click += new System.EventHandler(this.partsToolStripMenuItem_Click);
//
// vendorsToolStripMenuItem
//
this.vendorsToolStripMenuItem.Name = "vendorsToolStripMenuItem";
- this.vendorsToolStripMenuItem.Size = new System.Drawing.Size(139, 22);
+ this.vendorsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.vendorsToolStripMenuItem.Text = "&Vendors";
this.vendorsToolStripMenuItem.Click += new System.EventHandler(this.vendorsToolStripMenuItem_Click);
//
@@ -172,14 +170,6 @@
this.mapSelectedItemsToolStripMenuItem.Visible = false;
this.mapSelectedItemsToolStripMenuItem.Click += new System.EventHandler(this.mapSelectedItemsToolStripMenuItem_Click);
//
- // unmapSelectedItemsToolStripMenuItem
- //
- this.unmapSelectedItemsToolStripMenuItem.Name = "unmapSelectedItemsToolStripMenuItem";
- this.unmapSelectedItemsToolStripMenuItem.Size = new System.Drawing.Size(136, 20);
- this.unmapSelectedItemsToolStripMenuItem.Text = "&Unmap selected items";
- this.unmapSelectedItemsToolStripMenuItem.Visible = false;
- this.unmapSelectedItemsToolStripMenuItem.Click += new System.EventHandler(this.unmapSelectedItemsToolStripMenuItem_Click);
- //
// grid
//
this.grid.AllowUserToAddRows = false;
@@ -280,7 +270,6 @@
private System.Windows.Forms.ToolStripMenuItem updateAyaNovaPricesToolStripMenuItem;
private System.Windows.Forms.DataGridView grid;
private System.Windows.Forms.ToolStripMenuItem mapSelectedItemsToolStripMenuItem;
- private System.Windows.Forms.ToolStripMenuItem unmapSelectedItemsToolStripMenuItem;
private System.Windows.Forms.DataGridViewTextBoxColumn AyaName;
private System.Windows.Forms.DataGridViewTextBoxColumn QBName;
private System.Windows.Forms.DataGridViewTextBoxColumn qbid;
diff --git a/AyaNovaQBI/Map.cs b/AyaNovaQBI/Map.cs
index 8623dbe..5d3fa9e 100644
--- a/AyaNovaQBI/Map.cs
+++ b/AyaNovaQBI/Map.cs
@@ -43,10 +43,9 @@ namespace AyaNovaQBI
_qb = new DataTable("QuickBooks");
_qb.Columns.Add("ID", typeof(string));
- _qb.Columns.Add("Name", typeof(string));
- _qb.Columns.Add("Linked", typeof(bool));
+ _qb.Columns.Add("FullName", typeof(string));
//Case 339
- _qb.DefaultView.Sort = "Name asc";
+ _qb.DefaultView.Sort = "FullName asc";
grid.DataSource = _aya;
}
@@ -120,9 +119,9 @@ namespace AyaNovaQBI
//Fill QB table with QB Customers from prefetched table
foreach (DataRow dr in util.QBClients.Rows)
{
- bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
- if (DisplayRow(bLinked))
- _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString(), bLinked });
+ //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
+ //if (DisplayRow(bLinked))
+ _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() });
}
#endregion client
break;
@@ -147,9 +146,9 @@ namespace AyaNovaQBI
//Fill QB table with QB Customers from prefetched table
foreach (DataRow dr in util.QBVendors.Rows)
{
- bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
- if (DisplayRow(bLinked))
- _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString(), bLinked });
+ //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
+ //if (DisplayRow(bLinked))
+ _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() });
}
#endregion Vendor
break;
@@ -188,9 +187,9 @@ namespace AyaNovaQBI
{
if ((util.qbitemtype)dr["Type"] == util.qbitemtype.Service || (util.qbitemtype)dr["Type"] == util.qbitemtype.OtherCharge)
{
- bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
- if (DisplayRow(bLinked))
- _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString(), bLinked });
+ //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
+ //if (DisplayRow(bLinked))
+ _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() });
}
}
#endregion Rate
@@ -231,9 +230,9 @@ namespace AyaNovaQBI
{
if ((util.qbitemtype)dr["Type"] == util.qbitemtype.Service || (util.qbitemtype)dr["Type"] == util.qbitemtype.OtherCharge)
{
- bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
- if (DisplayRow(bLinked))
- _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString(), bLinked });
+ //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
+ //if (DisplayRow(bLinked))
+ _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() });
}
}
#endregion Rate
@@ -267,9 +266,9 @@ namespace AyaNovaQBI
{
if ((util.qbitemtype)dr["Type"] == util.qbitemtype.Inventory || (util.qbitemtype)dr["Type"] == util.qbitemtype.NonInventory || (util.qbitemtype)dr["Type"] == util.qbitemtype.Assembly)
{
- bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
- if (DisplayRow(bLinked))
- _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString(), bLinked });
+ //bool bLinked = util.QBIntegration.Items.Any(z => z.AType == _Type && z.IntegrationItemId == dr["ID"].ToString());
+ //if (DisplayRow(bLinked))
+ _qb.Rows.Add(new object[] { dr["ID"].ToString(), dr["FullName"].ToString() });
}
}
#endregion Part
@@ -307,21 +306,30 @@ namespace AyaNovaQBI
private void mapSelectedItemsToolStripMenuItem_Click(object sender, EventArgs e)
{
- var selection = grid.SelectedRows;
+ if(grid.SelectedRows.Count==0) return;
+
+ //we have selection now get qb item
+ MapSelectQBItem s = new MapSelectQBItem();
+ s.DialogTitle = "AyaNova QBI setup - Charge outside service as?";
+
+ s.QBItems = _qb;
+
+ if (s.ShowDialog() == DialogResult.Cancel)
+ return ;
+ else
+ QDat.OutsideServiceChargeAs = s.SelectedQBItem;
+ s.Dispose();
+ s = null;
+
var selectedAyaNovaIndexes = new List();
- //.grid.SelectedRows[0].Cells[0].Value
foreach(DataGridViewRow r in grid.SelectedRows)
{
selectedAyaNovaIndexes.Add((long)r.Cells[0].Value);
}
- MessageBox.Show($"MAP: selected row count {selection.Count}");
+
}
- private void unmapSelectedItemsToolStripMenuItem_Click(object sender, EventArgs e)
- {
- var selection = grid.SelectedRows;
- MessageBox.Show($"UNMAP: selected row count {selection.Count}");
- }
+
private void customersToolStripMenuItem_Click(object sender, EventArgs e)
{
diff --git a/AyaNovaQBI/MapSelectQBItem.Designer.cs b/AyaNovaQBI/MapSelectQBItem.Designer.cs
new file mode 100644
index 0000000..9841c3d
--- /dev/null
+++ b/AyaNovaQBI/MapSelectQBItem.Designer.cs
@@ -0,0 +1,104 @@
+namespace AyaNovaQBI
+{
+ partial class MapSelectQBItem
+ {
+ ///
+ /// Required designer variable.
+ ///
+ private System.ComponentModel.IContainer components = null;
+
+ ///
+ /// Clean up any resources being used.
+ ///
+ /// true if managed resources should be disposed; otherwise, false.
+ protected override void Dispose(bool disposing)
+ {
+ if (disposing && (components != null))
+ {
+ components.Dispose();
+ }
+ base.Dispose(disposing);
+ }
+
+ #region Windows Form Designer generated code
+
+ ///
+ /// Required method for Designer support - do not modify
+ /// the contents of this method with the code editor.
+ ///
+ private void InitializeComponent()
+ {
+ this.label1 = new System.Windows.Forms.Label();
+ this.cbQBItems = new System.Windows.Forms.ComboBox();
+ this.btnOK = new System.Windows.Forms.Button();
+ this.btnCancel = new System.Windows.Forms.Button();
+ this.SuspendLayout();
+ //
+ // label1
+ //
+ this.label1.Dock = System.Windows.Forms.DockStyle.Top;
+ this.label1.Location = new System.Drawing.Point(16, 16);
+ this.label1.Name = "label1";
+ this.label1.Size = new System.Drawing.Size(715, 13);
+ this.label1.TabIndex = 0;
+ this.label1.Text = "Map selected AyaNova items to:";
+ //
+ // cbQBItems
+ //
+ this.cbQBItems.Dock = System.Windows.Forms.DockStyle.Top;
+ this.cbQBItems.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+ this.cbQBItems.FormattingEnabled = true;
+ this.cbQBItems.Location = new System.Drawing.Point(16, 29);
+ this.cbQBItems.Name = "cbQBItems";
+ this.cbQBItems.Size = new System.Drawing.Size(715, 21);
+ this.cbQBItems.TabIndex = 12;
+ //
+ // btnOK
+ //
+ this.btnOK.Location = new System.Drawing.Point(656, 106);
+ this.btnOK.Name = "btnOK";
+ this.btnOK.Size = new System.Drawing.Size(75, 23);
+ this.btnOK.TabIndex = 14;
+ this.btnOK.Text = "OK";
+ this.btnOK.UseVisualStyleBackColor = true;
+ this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
+ //
+ // btnCancel
+ //
+ this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
+ this.btnCancel.Location = new System.Drawing.Point(19, 106);
+ this.btnCancel.Name = "btnCancel";
+ this.btnCancel.Size = new System.Drawing.Size(75, 23);
+ this.btnCancel.TabIndex = 13;
+ this.btnCancel.Text = "Cancel";
+ this.btnCancel.UseVisualStyleBackColor = true;
+ this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);
+ //
+ // MapSelectQBItem
+ //
+ this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.CancelButton = this.btnCancel;
+ this.ClientSize = new System.Drawing.Size(747, 150);
+ this.Controls.Add(this.btnOK);
+ this.Controls.Add(this.btnCancel);
+ this.Controls.Add(this.cbQBItems);
+ this.Controls.Add(this.label1);
+ this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
+ this.Name = "MapSelectQBItem";
+ this.Padding = new System.Windows.Forms.Padding(16);
+ this.ShowInTaskbar = false;
+ this.Text = "QB Items";
+ this.Load += new System.EventHandler(this.MapSelectQBItem_Load);
+ this.ResumeLayout(false);
+
+ }
+
+ #endregion
+
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.ComboBox cbQBItems;
+ private System.Windows.Forms.Button btnOK;
+ private System.Windows.Forms.Button btnCancel;
+ }
+}
\ No newline at end of file
diff --git a/AyaNovaQBI/MapSelectQBItem.cs b/AyaNovaQBI/MapSelectQBItem.cs
new file mode 100644
index 0000000..7dee588
--- /dev/null
+++ b/AyaNovaQBI/MapSelectQBItem.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace AyaNovaQBI
+{
+ public partial class MapSelectQBItem : Form
+ {
+ public MapSelectQBItem()
+ {
+ InitializeComponent();
+ }
+ public string SelectedQBItem => cbQBItems.SelectedValue.ToString();
+ public DataTable QBItems { get; set; }
+ private void MapSelectQBItem_Load(object sender, EventArgs e)
+ {
+ cbQBItems.DataSource = QBItems;
+ cbQBItems.DisplayMember = "FullName";
+ cbQBItems.ValueMember = "ID";
+ btnCancel.Text = util.AyaTranslations["Cancel"];
+ btnOK.Text = util.AyaTranslations["OK"];
+ }
+
+ private void btnCancel_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.Cancel;
+ Close();
+ }
+
+ private void btnOK_Click(object sender, EventArgs e)
+ {
+ DialogResult = DialogResult.OK;
+ Close();
+ }
+ }
+}
diff --git a/AyaNovaQBI/MapSelectQBItem.resx b/AyaNovaQBI/MapSelectQBItem.resx
new file mode 100644
index 0000000..29dcb1b
--- /dev/null
+++ b/AyaNovaQBI/MapSelectQBItem.resx
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
\ No newline at end of file