This commit is contained in:
2022-07-02 18:40:56 +00:00
parent dba8cc9287
commit 2660a87d44
6 changed files with 315 additions and 43 deletions

View File

@@ -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<long>();
//.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)
{